Allow one day to enter password or register.
GitOrigin-RevId: cc32c0ba6f89a39234e1456739ff8cff09b3649d
This commit is contained in:
parent
7ed9751b22
commit
f9f8b832e3
@ -883,7 +883,21 @@ bool AuthManager::load_state() {
|
|||||||
LOG(INFO) << "Ignore auth_state: timestamp in the future";
|
LOG(INFO) << "Ignore auth_state: timestamp in the future";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (Timestamp::at(db_state.state_timestamp_.at() + 5 * 60).is_in_past()) {
|
auto state_timeout = [state = db_state.state_] {
|
||||||
|
switch (state) {
|
||||||
|
case State::WaitPassword:
|
||||||
|
case State::WaitRegistration:
|
||||||
|
return 86400;
|
||||||
|
case State::WaitCode:
|
||||||
|
case State::WaitQrCodeConfirmation:
|
||||||
|
return 5 * 60;
|
||||||
|
default:
|
||||||
|
UNREACHABLE();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}();
|
||||||
|
|
||||||
|
if (Timestamp::at(db_state.state_timestamp_.at() + state_timeout).is_in_past()) {
|
||||||
LOG(INFO) << "Ignore auth_state: expired " << db_state.state_timestamp_.in();
|
LOG(INFO) << "Ignore auth_state: expired " << db_state.state_timestamp_.in();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user