GramJS: Handle user deactivation (#6043)
This commit is contained in:
parent
90caadef1f
commit
bcaeee1d94
@ -474,7 +474,11 @@ async function handleTerminatedSession() {
|
||||
shouldThrow: true,
|
||||
});
|
||||
} catch (err: any) {
|
||||
if (err.errorMessage === 'AUTH_KEY_UNREGISTERED' || err.errorMessage === 'SESSION_REVOKED') {
|
||||
if (
|
||||
err.errorMessage === 'AUTH_KEY_UNREGISTERED'
|
||||
|| err.errorMessage === 'SESSION_REVOKED'
|
||||
|| err.errorMessage === 'USER_DEACTIVATED'
|
||||
) {
|
||||
sendApiUpdate({
|
||||
'@type': 'updateConnectionState',
|
||||
connectionState: 'connectionStateBroken',
|
||||
|
||||
@ -3,8 +3,9 @@ import { getAccountSlotUrl } from '../../../util/multiaccount';
|
||||
export function navigateBack() {
|
||||
const currentUrl = new URL(window.location.href);
|
||||
const referrer = document.referrer ? new URL(document.referrer) : undefined;
|
||||
if (referrer?.origin === currentUrl.origin && referrer.pathname === currentUrl.pathname) {
|
||||
window.history.back(); // Return to previous account with it's state
|
||||
if (referrer?.origin === currentUrl.origin && referrer.pathname === currentUrl.pathname
|
||||
&& referrer.searchParams.get('account') !== currentUrl.searchParams.get('account')) {
|
||||
window.location.assign(referrer); // Return to previous account with it's state
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -744,7 +744,9 @@ export default class MTProtoSender {
|
||||
} catch (e: any) {
|
||||
// `RPCError` errors except for 'AUTH_KEY_UNREGISTERED' should be handled by the client
|
||||
if (e instanceof RPCError) {
|
||||
if (e.errorMessage === 'AUTH_KEY_UNREGISTERED' || e.errorMessage === 'SESSION_REVOKED') {
|
||||
if (e.errorMessage === 'AUTH_KEY_UNREGISTERED'
|
||||
|| e.errorMessage === 'SESSION_REVOKED'
|
||||
|| e.errorMessage === 'USER_DEACTIVATED') {
|
||||
// 'AUTH_KEY_UNREGISTERED' for the main sender is thrown when unauthorized and should be ignored
|
||||
this._handleBadAuthKey(true);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user