Fix password menu stickiness before first auth (#21295)

This commit is contained in:
ellensp
2021-03-11 11:02:35 +13:00
committed by GitHub
parent f671e6d138
commit 8857fc6c4b
3 changed files with 18 additions and 10 deletions

View File

@ -44,12 +44,18 @@ static uint8_t digit_no;
// Screen for both editing and setting the password
//
void Password::menu_password_entry() {
ui.defer_status_screen(!did_first_run); // No timeout to status before first auth
START_MENU();
// "Login" or "New Code"
STATIC_ITEM_P(authenticating ? GET_TEXT(MSG_LOGIN_REQUIRED) : GET_TEXT(MSG_EDIT_PASSWORD), SS_CENTER|SS_INVERT);
STATIC_ITEM_P(NUL_STR, SS_CENTER|SS_INVERT, string);
STATIC_ITEM_P(NUL_STR, SS_CENTER, string);
#if HAS_MARLINUI_U8GLIB
STATIC_ITEM_P(NUL_STR, SS_CENTER, "");
#endif
// Make the digit edit item look like a sub-menu
PGM_P const label = GET_TEXT(MSG_ENTER_DIGIT);
@ -57,7 +63,7 @@ void Password::menu_password_entry() {
MENU_ITEM_ADDON_START(utf8_strlen_P(label) + 1);
lcd_put_wchar(' ');
lcd_put_wchar('1' + digit_no);
SETCURSOR_X(LCD_WIDTH - 1);
SETCURSOR_X(LCD_WIDTH - 2);
lcd_put_wchar('>');
MENU_ITEM_ADDON_END();
@ -104,7 +110,7 @@ void Password::screen_password_entry() {
value_entry = 0;
digit_no = 0;
editable.uint8 = 0;
memset(string, '-', PASSWORD_LENGTH);
memset(string, '_', PASSWORD_LENGTH);
string[PASSWORD_LENGTH] = '\0';
menu_password_entry();
}
@ -120,7 +126,6 @@ void Password::authenticate_user(const screenFunc_t in_succ_scr, const screenFun
if (is_set) {
authenticating = true;
ui.goto_screen(screen_password_entry);
ui.defer_status_screen();
ui.update();
}
else {