Improve error logging for banned accounts.
This commit is contained in:
parent
67cf6d7fe5
commit
8fb3fca841
@ -1141,6 +1141,16 @@ void AuthManager::on_log_out_result(NetQueryPtr &&net_query) {
|
||||
destroy_auth_keys();
|
||||
on_current_query_ok();
|
||||
}
|
||||
|
||||
void AuthManager::on_account_banned() const {
|
||||
if (is_bot()) {
|
||||
return;
|
||||
}
|
||||
LOG(ERROR) << "Your account was banned for suspicious activity. If you think that this is a mistake, please try to "
|
||||
"log in from an official mobile app and send a email to recover the account by following instructions "
|
||||
"provided by the app";
|
||||
}
|
||||
|
||||
void AuthManager::on_authorization_lost(string source) {
|
||||
if (state_ == State::LoggingOut && net_query_type_ == NetQueryType::LogOut) {
|
||||
LOG(INFO) << "Ignore authorization loss because of " << source << ", while logging out";
|
||||
@ -1151,6 +1161,9 @@ void AuthManager::on_authorization_lost(string source) {
|
||||
return;
|
||||
}
|
||||
LOG(WARNING) << "Lost authorization because of " << source;
|
||||
if (source == "USER_DEACTIVATED_BAN") {
|
||||
on_account_banned();
|
||||
}
|
||||
destroy_auth_keys();
|
||||
}
|
||||
|
||||
@ -1290,9 +1303,7 @@ void AuthManager::on_result(NetQueryPtr net_query) {
|
||||
return;
|
||||
}
|
||||
if (net_query->error().message() == CSlice("PHONE_NUMBER_BANNED")) {
|
||||
LOG(ERROR) << "Your phone number was banned for suspicious activity. If you think that this is a mistake, "
|
||||
"please try to log in from an official mobile app and send a email to recover the account by "
|
||||
"following instructions provided by the app.";
|
||||
on_account_banned();
|
||||
}
|
||||
if (type != NetQueryType::LogOut && type != NetQueryType::DeleteAccount) {
|
||||
if (query_id_ != 0) {
|
||||
|
@ -196,6 +196,8 @@ class AuthManager final : public NetActor {
|
||||
void send_log_out_query();
|
||||
void destroy_auth_keys();
|
||||
|
||||
void on_account_banned() const;
|
||||
|
||||
void on_sent_code(telegram_api::object_ptr<telegram_api::auth_SentCode> &&sent_code_ptr);
|
||||
|
||||
void on_send_code_result(NetQueryPtr &&net_query);
|
||||
|
@ -957,11 +957,6 @@ void Session::on_message_result_error(uint64 message_id, int error_code, string
|
||||
on_auth_key_updated();
|
||||
error_code = 500;
|
||||
} else {
|
||||
if (message == "USER_DEACTIVATED_BAN") {
|
||||
LOG(ERROR) << "Your phone number was banned for suspicious activity. If you think that this is a mistake, "
|
||||
"please try to log in from an official mobile app and send a email to recover the account by "
|
||||
"following instructions provided by the app.";
|
||||
}
|
||||
auth_data_.set_auth_flag(false);
|
||||
G()->log_out(message);
|
||||
shared_auth_data_->set_auth_key(auth_data_.get_main_auth_key());
|
||||
|
Loading…
x
Reference in New Issue
Block a user