installer: partition: Add encryption password confirmation.
authorMathieu Othacehe <m.othacehe@gmail.com>
Sat, 12 Jan 2019 17:45:58 +0000 (18:45 +0100)
committerLudovic Courtès <ludo@gnu.org>
Thu, 17 Jan 2019 13:04:27 +0000 (14:04 +0100)
* gnu/installer/newt/partition.scm (prompt-luks-passwords): Add password
confirmation page.

gnu/installer/newt/partition.scm

index d10e8cd..1c3ce80 100644 (file)
@@ -149,11 +149,26 @@ USER-PARTITIONS list. Return this list with password fields filled-in."
                    (run-input-page
                     (format #f (G_ "Please enter the password for the \
 encryption of partition ~a (label: ~a).") file-name crypt-label)
-                    (G_ "Password required")))))
+                    (G_ "Password required"))))
+                (password-confirm-page
+                 (lambda ()
+                   (run-input-page
+                    (format #f (G_ "Please confirm the password for the \
+encryption of partition ~a (label: ~a).") file-name crypt-label)
+                    (G_ "Password confirmation required")))))
            (if crypt-label
-               (user-partition
-                (inherit user-part)
-                (crypt-password (password-page)))
+               (let loop ()
+                 (let ((password (password-page))
+                       (confirmation (password-confirm-page)))
+                   (if (string=? password confirmation)
+                       (user-partition
+                        (inherit user-part)
+                        (crypt-password password))
+                       (begin
+                         (run-error-page
+                          (G_ "Password mismatch, please try again.")
+                          (G_ "Password error"))
+                         (loop)))))
                user-part)))
        user-partitions))