summary refs log tree commit diff
path: root/gnu/installer/newt/user.scm
diff options
context:
space:
mode:
authorMathieu Othacehe <m.othacehe@gmail.com>2019-05-05 12:54:40 +0200
committerMathieu Othacehe <m.othacehe@gmail.com>2019-05-07 09:25:45 +0200
commit445bd4d5e53d24f916ecbb62907d119da27e912b (patch)
tree9d8907288246d63fcc9f4eecdf9c81f8fb616243 /gnu/installer/newt/user.scm
parentd9ef50b3bc41be80f93ba6a86a911f7c68ab5ca6 (diff)
downloadguix-445bd4d5e53d24f916ecbb62907d119da27e912b.tar.gz
installer: Add password 'hide' checkbox.
* gnu/installer/newt/page.scm (run-input-page)[input-hide-checkbox?]: New
parameter adding a checkbox to toggle password hiding. By default, the
checkbox is active and the password is hence hided.
* gnu/installer/newt/partition.scm (prompt-luks-passwords): Enable the
previous parameter on both password input pages.
* gnu/installer/newt/user.scm (run-root-password-page): Enable the previous
parameter,
(confirm-password): ditto,
(run-user-add-page): add a checkbox to toggle password hiding.
Diffstat (limited to 'gnu/installer/newt/user.scm')
-rw-r--r--gnu/installer/newt/user.scm22
1 files changed, 19 insertions, 3 deletions
diff --git a/gnu/installer/newt/user.scm b/gnu/installer/newt/user.scm
index ac07d26c8b..f866de54ce 100644
--- a/gnu/installer/newt/user.scm
+++ b/gnu/installer/newt/user.scm
@@ -51,9 +51,11 @@ REAL-NAME, and HOME-DIRECTORY as the initial values in the form."
                                       #:initial-value real-name))
          (entry-home-directory (make-entry -1 -1 entry-width
                                            #:initial-value home-directory))
+         (password-visible-cb
+          (make-checkbox -1 -1 (G_ "Hide") #\x "x "))
          (entry-password (make-entry -1 -1 entry-width
                                      #:flags FLAG-PASSWORD))
-         (entry-grid (make-grid 2 5))
+         (entry-grid (make-grid 3 5))
          (button-grid (make-grid 1 1))
          (ok-button (make-button -1 -1 (G_ "OK")))
          (grid (make-grid 1 2))
@@ -71,6 +73,12 @@ REAL-NAME, and HOME-DIRECTORY as the initial values in the form."
     (set-entry-grid-field 0 3 label-password)
     (set-entry-grid-field 1 3 entry-password)
 
+    (set-grid-field entry-grid
+                    2 3
+                    GRID-ELEMENT-COMPONENT
+                    password-visible-cb
+                    #:pad-left 1)
+
     (set-grid-field button-grid 0 0 GRID-ELEMENT-COMPONENT ok-button)
 
     (add-component-callback
@@ -83,11 +91,19 @@ REAL-NAME, and HOME-DIRECTORY as the initial values in the form."
          (set-entry-text entry-real-name
                          (string-titlecase (entry-value entry-name))))))
 
+    (add-component-callback
+     password-visible-cb
+     (lambda (component)
+       (set-entry-flags entry-password
+                        FLAG-PASSWORD
+                        FLAG-ROLE-TOGGLE)))
+
     (add-components-to-form form
                             label-name label-real-name
                             label-home-directory label-password
                             entry-name entry-real-name
                             entry-home-directory entry-password
+                            password-visible-cb
                             ok-button)
 
     (make-wrapped-grid-window (vertically-stacked-grid
@@ -136,7 +152,7 @@ a thunk, if the confirmation doesn't match PASSWORD, and return its result."
     (run-input-page (G_ "Please confirm the password.")
                     (G_ "Password confirmation required")
                     #:allow-empty-input? #t
-                    #:input-flags FLAG-PASSWORD))
+                    #:input-hide-checkbox? #t))
 
   (if (string=? password confirmation)
       password
@@ -153,7 +169,7 @@ a thunk, if the confirmation doesn't match PASSWORD, and return its result."
     (run-input-page (G_ "Please choose a password for the system \
 administrator (\"root\").")
                     (G_ "System administrator password")
-                    #:input-flags FLAG-PASSWORD))
+                    #:input-hide-checkbox? #t))
 
   (confirm-password password run-root-password-page))