Don't treat temp auth key as invalid before it is actually expired.

This commit is contained in:
levlam 2023-07-17 19:04:39 +03:00
parent 1b3d14a3f9
commit 9aed145fa1

View File

@ -84,7 +84,6 @@ class AuthData {
tmp_auth_key_ = std::move(auth_key); tmp_auth_key_ = std::move(auth_key);
} }
const AuthKey &get_tmp_auth_key() const { const AuthKey &get_tmp_auth_key() const {
// CHECK(has_tmp_auth_key());
return tmp_auth_key_; return tmp_auth_key_;
} }
bool was_tmp_auth_key() const { bool was_tmp_auth_key() const {
@ -100,9 +99,6 @@ class AuthData {
if (now > tmp_auth_key_.expires_at() - 60 * 60 * 2 /*2 hours*/) { if (now > tmp_auth_key_.expires_at() - 60 * 60 * 2 /*2 hours*/) {
return true; return true;
} }
if (!has_tmp_auth_key(now)) {
return true;
}
return false; return false;
} }
void drop_main_auth_key() { void drop_main_auth_key() {
@ -118,7 +114,7 @@ class AuthData {
if (tmp_auth_key_.empty()) { if (tmp_auth_key_.empty()) {
return false; return false;
} }
if (now > tmp_auth_key_.expires_at() - 60 * 60 /*1 hour*/) { if (now > tmp_auth_key_.expires_at()) {
return false; return false;
} }
return true; return true;