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'.
This commit is contained in:
Ludovic Courtès 2019-04-25 11:17:31 +02:00
parent 453c976501
commit 8f2b7e3cb4
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 24 additions and 3 deletions

View File

@ -104,14 +104,35 @@
(lambda () (lambda ()
(destroy-form-and-pop form))))))) (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) (define (run-root-password-page)
;; TRANSLATORS: Leave "root" untranslated: it refers to the name of the ;; TRANSLATORS: Leave "root" untranslated: it refers to the name of the
;; system administrator account. ;; system administrator account.
(define password
(run-input-page (G_ "Please choose a password for the system \ (run-input-page (G_ "Please choose a password for the system \
administrator (\"root\").") administrator (\"root\").")
(G_ "System administrator password") (G_ "System administrator password")
#:input-flags FLAG-PASSWORD)) #:input-flags FLAG-PASSWORD))
(confirm-password password run-root-password-page))
(define (run-user-page) (define (run-user-page)
(define (run users) (define (run users)
(let* ((listbox (make-listbox (let* ((listbox (make-listbox