summaryrefslogtreecommitdiff
path: root/gnu/installer/newt
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-04-25 11:17:31 +0200
committerLudovic Courtès <ludo@gnu.org>2019-04-25 12:23:54 +0200
commit8f2b7e3cb469e3e484547bb9f4ba3d0e3a7e9ed7 (patch)
tree241c2cf5ed2c34c46a353cbb0803ccc7295748a7 /gnu/installer/newt
parent453c976501bb4d5c4c6b832b7c0c1ec3d493b80f (diff)
installer: Ask for confirmation of the root password.
* gnu/installer/newt/user.scm (confirm-password): New procedure. (run-root-password-page): Add call to 'confirm-password'.
Diffstat (limited to 'gnu/installer/newt')
-rw-r--r--gnu/installer/newt/user.scm27
1 files changed, 24 insertions, 3 deletions
diff --git a/gnu/installer/newt/user.scm b/gnu/installer/newt/user.scm
index 76eb63b710..7493edf85e 100644
--- a/gnu/installer/newt/user.scm
+++ b/gnu/installer/newt/user.scm
@@ -104,13 +104,34 @@
(lambda ()
(destroy-form-and-pop form)))))))
+(define (confirm-password password try-again)
+ "Ask the user to confirm PASSWORD, a possibly empty string. Call TRY-AGAIN,
+a thunk, if the confirmation doesn't match PASSWORD. Return the confirmed
+password."
+ (define confirmation
+ (run-input-page (G_ "Please confirm the password.")
+ (G_ "Password confirmation required")
+ #:allow-empty-input? #t
+ #:input-flags FLAG-PASSWORD))
+
+ (if (string=? password confirmation)
+ password
+ (begin
+ (run-error-page
+ (G_ "Password mismatch, please try again.")
+ (G_ "Password error"))
+ (try-again))))
+
(define (run-root-password-page)
;; TRANSLATORS: Leave "root" untranslated: it refers to the name of the
;; system administrator account.
- (run-input-page (G_ "Please choose a password for the system \
+ (define password
+ (run-input-page (G_ "Please choose a password for the system \
administrator (\"root\").")
- (G_ "System administrator password")
- #:input-flags FLAG-PASSWORD))
+ (G_ "System administrator password")
+ #:input-flags FLAG-PASSWORD))
+
+ (confirm-password password run-root-password-page))
(define (run-user-page)
(define (run users)