diff options
author | Mathieu Othacehe <m.othacehe@gmail.com> | 2019-05-05 12:54:40 +0200 |
---|---|---|
committer | Mathieu Othacehe <m.othacehe@gmail.com> | 2019-05-07 09:25:45 +0200 |
commit | 445bd4d5e53d24f916ecbb62907d119da27e912b (patch) | |
tree | 9d8907288246d63fcc9f4eecdf9c81f8fb616243 /gnu/installer/newt/page.scm | |
parent | d9ef50b3bc41be80f93ba6a86a911f7c68ab5ca6 (diff) | |
download | guix-445bd4d5e53d24f916ecbb62907d119da27e912b.tar guix-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/page.scm')
-rw-r--r-- | gnu/installer/newt/page.scm | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/gnu/installer/newt/page.scm b/gnu/installer/newt/page.scm index 3173d54737..07779b16fa 100644 --- a/gnu/installer/newt/page.scm +++ b/gnu/installer/newt/page.scm @@ -75,6 +75,7 @@ this page to TITLE." #:key (allow-empty-input? #f) (default-text #f) + (input-hide-checkbox? #f) (input-field-width 40) (input-flags 0)) "Run a page to prompt user for an input. The given TEXT will be displayed @@ -86,22 +87,37 @@ input box, such as FLAG-PASSWORD." (make-reflowed-textbox -1 -1 text input-field-width #:flags FLAG-BORDER)) - (grid (make-grid 1 3)) + (input-visible-cb + (make-checkbox -1 -1 (G_ "Hide") #\x "x ")) + (input-flags* (if input-hide-checkbox? + (logior FLAG-PASSWORD input-flags) + input-flags)) (input-entry (make-entry -1 -1 20 - #:flags input-flags)) + #:flags input-flags*)) (ok-button (make-button -1 -1 (G_ "OK"))) + (grid (vertically-stacked-grid + GRID-ELEMENT-COMPONENT text-box + GRID-ELEMENT-SUBGRID + (apply + horizontal-stacked-grid + GRID-ELEMENT-COMPONENT input-entry + `(,@(if input-hide-checkbox? + (list GRID-ELEMENT-COMPONENT input-visible-cb) + '()))) + GRID-ELEMENT-COMPONENT ok-button)) (form (make-form))) + (add-component-callback + input-visible-cb + (lambda (component) + (set-entry-flags input-entry + FLAG-PASSWORD + FLAG-ROLE-TOGGLE))) + (when default-text (set-entry-text input-entry default-text)) - (set-grid-field grid 0 0 GRID-ELEMENT-COMPONENT text-box) - (set-grid-field grid 0 1 GRID-ELEMENT-COMPONENT input-entry - #:pad-top 1) - (set-grid-field grid 0 2 GRID-ELEMENT-COMPONENT ok-button - #:pad-top 1) - - (add-components-to-form form text-box input-entry ok-button) + (add-form-to-grid grid form #t) (make-wrapped-grid-window grid title) (let ((error-page (lambda () (run-error-page (G_ "Please enter a non empty input.") |