summary refs log tree commit diff
diff options
context:
space:
mode:
authorMathieu Othacehe <m.othacehe@gmail.com>2019-01-12 18:45:58 +0100
committerLudovic Courtès <ludo@gnu.org>2019-01-17 14:04:27 +0100
commitf40728f9d65fcff4ca289d5c9642194e60d369d3 (patch)
tree79b60505be17dd899c9bc46d9b5f473eaba37f33
parentcb614af01146d9d4be40e705f71db4efcbe684e7 (diff)
downloadguix-f40728f9d65fcff4ca289d5c9642194e60d369d3.tar.gz
installer: partition: Add encryption password confirmation.
* gnu/installer/newt/partition.scm (prompt-luks-passwords): Add password
confirmation page.
-rw-r--r--gnu/installer/newt/partition.scm23
1 files changed, 19 insertions, 4 deletions
diff --git a/gnu/installer/newt/partition.scm b/gnu/installer/newt/partition.scm
index d10e8cd2b7..1c3ce80ce5 100644
--- a/gnu/installer/newt/partition.scm
+++ b/gnu/installer/newt/partition.scm
@@ -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))