Write to the log message when account is banned.
GitOrigin-RevId: 087777440601fc56f9289fc8140497a1553755db
This commit is contained in:
parent
eeaed834d1
commit
c72ba02d85
@ -381,6 +381,10 @@ void AuthManager::start_net_query(NetQueryType net_query_type, NetQueryPtr net_q
|
||||
void AuthManager::on_send_code_result(NetQueryPtr &result) {
|
||||
auto r_sent_code = fetch_result<telegram_api::auth_sendCode>(result->ok());
|
||||
if (r_sent_code.is_error()) {
|
||||
if (r_sent_code.error().message() == CSlice("PHONE_NUMBER_BANNED")) {
|
||||
LOG(PLAIN) << "Your phone number was banned for suspicious activity. If you think that this is a mistake, please "
|
||||
"write to recover@telegram.org your phone number and other details to recover the account.";
|
||||
}
|
||||
return on_query_error(r_sent_code.move_as_error());
|
||||
}
|
||||
auto sent_code = r_sent_code.move_as_ok();
|
||||
|
@ -660,16 +660,20 @@ Status Session::on_message_result_ok(uint64 id, BufferSlice packet, size_t origi
|
||||
|
||||
void Session::on_message_result_error(uint64 id, int error_code, BufferSlice message) {
|
||||
// UNAUTHORIZED
|
||||
// TODO: some errors shouldn't cause loss of authorizations. Especially when PFS will be used
|
||||
if (error_code == 401 && message.as_slice() != CSlice("SESSION_PASSWORD_NEEDED")) {
|
||||
if (auth_data_.use_pfs() && message.as_slice() == CSlice("AUTH_KEY_PERM_EMPTY")) {
|
||||
LOG(ERROR) << "Receive AUTH_KEY_PERM_EMPTY in session " << auth_data_.get_session_id() << " for auth key "
|
||||
<< auth_data_.get_tmp_auth_key().id();
|
||||
LOG(INFO) << "Receive AUTH_KEY_PERM_EMPTY in session " << auth_data_.get_session_id() << " for auth key "
|
||||
<< auth_data_.get_tmp_auth_key().id();
|
||||
auth_data_.drop_tmp_auth_key();
|
||||
on_tmp_auth_key_updated();
|
||||
error_code = 500;
|
||||
} else {
|
||||
LOG(WARNING) << "Lost authorization due to " << tag("msg", message.as_slice());
|
||||
if (message.as_slice() == CSlice("USER_DEACTIVATED_BAN")) {
|
||||
LOG(PLAIN) << "Your account was suspended for suspicious activity. If you think that this is a mistake, please "
|
||||
"write to recover@telegram.org your phone number and other details to recover the account.";
|
||||
} else {
|
||||
LOG(WARNING) << "Lost authorization due to " << tag("msg", message.as_slice());
|
||||
}
|
||||
auth_data_.set_auth_flag(false);
|
||||
shared_auth_data_->set_auth_key(auth_data_.get_main_auth_key());
|
||||
on_session_failed(Status::OK());
|
||||
|
Loading…
Reference in New Issue
Block a user