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