diff options
author | Samuel Mendoza-Jonas <sam@mendozajonas.com> | 2018-06-20 10:45:56 +1000 |
---|---|---|
committer | Samuel Mendoza-Jonas <sam@mendozajonas.com> | 2018-12-03 14:48:41 +1100 |
commit | 07f6db7fc29a93fae3213af18371cccb17e0276a (patch) | |
tree | e6306f75ae6cb0e863d9c096d0a7a56140657634 /ui/ncurses/nc-widgets.c | |
parent | 9011b958364f2af965a33681e7375f079ba75d02 (diff) | |
download | talos-petitboot-07f6db7fc29a93fae3213af18371cccb17e0276a.tar.gz talos-petitboot-07f6db7fc29a93fae3213af18371cccb17e0276a.zip |
ui/ncurses: Add nc-auth and authenticate when required.
When the user tries to perform actions that require authentication a new
subscreen 'nc-auth' is launched which accepts a password and will send
an authentication request before performing the action.
This also adds a button in nc-config which launches an nc-auth screen
allowing the user to set or change the system password.
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
Diffstat (limited to 'ui/ncurses/nc-widgets.c')
-rw-r--r-- | ui/ncurses/nc-widgets.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/ui/ncurses/nc-widgets.c b/ui/ncurses/nc-widgets.c index 30915a9..afd56d7 100644 --- a/ui/ncurses/nc-widgets.c +++ b/ui/ncurses/nc-widgets.c @@ -365,8 +365,8 @@ static int textbox_destructor(void *ptr) return 0; } -struct nc_widget_textbox *widget_new_textbox(struct nc_widgetset *set, - int y, int x, int len, char *str) +struct nc_widget_textbox *widget_new_textbox_hidden(struct nc_widgetset *set, + int y, int x, int len, char *str, bool hide_input) { struct nc_widget_textbox *textbox; FIELD *f; @@ -383,6 +383,8 @@ struct nc_widget_textbox *widget_new_textbox(struct nc_widgetset *set, textbox->widget.unfocussed_attr = A_UNDERLINE; field_opts_off(f, O_STATIC | O_WRAP | O_BLANK); + if (hide_input) + field_opts_off(f, O_PUBLIC); set_field_buffer(f, 0, str); set_field_back(f, textbox->widget.unfocussed_attr); set_field_userptr(f, &textbox->widget); @@ -393,6 +395,12 @@ struct nc_widget_textbox *widget_new_textbox(struct nc_widgetset *set, return textbox; } +struct nc_widget_textbox *widget_new_textbox(struct nc_widgetset *set, + int y, int x, int len, char *str) +{ + return widget_new_textbox_hidden(set, y, x, len, str, false); +} + void widget_textbox_set_fixed_size(struct nc_widget_textbox *textbox) { field_opts_on(textbox->widget.field, O_STATIC); |