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

@ -31,7 +31,7 @@
Password password;
// public:
bool Password::is_set, Password::is_locked;
bool Password::is_set, Password::is_locked, Password::did_first_run; // = false
uint32_t Password::value, Password::value_entry;
//
@ -47,11 +47,14 @@ void Password::lock_machine() {
// Authentication check
//
void Password::authentication_check() {
if (value_entry == value)
if (value_entry == value) {
is_locked = false;
else
did_first_run = true;
}
else {
is_locked = true;
SERIAL_ECHOLNPGM(STR_WRONG_PASSWORD);
}
TERN_(HAS_LCD_MENU, authentication_done());
}

View File

@ -25,10 +25,10 @@
class Password {
public:
static bool is_set, is_locked;
static bool is_set, is_locked, did_first_run;
static uint32_t value, value_entry;
Password() { is_locked = false; }
Password() {}
static void lock_machine();
static void authentication_check();