diff --git a/src/api/gramjs/methods/client.ts b/src/api/gramjs/methods/client.ts index 367461e5b..9acad5047 100644 --- a/src/api/gramjs/methods/client.ts +++ b/src/api/gramjs/methods/client.ts @@ -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', diff --git a/src/components/auth/helpers/backNavigation.ts b/src/components/auth/helpers/backNavigation.ts index 2a45b7872..9431d2e89 100644 --- a/src/components/auth/helpers/backNavigation.ts +++ b/src/components/auth/helpers/backNavigation.ts @@ -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; } diff --git a/src/lib/gramjs/network/MTProtoSender.ts b/src/lib/gramjs/network/MTProtoSender.ts index d318a60e2..c8784667d 100644 --- a/src/lib/gramjs/network/MTProtoSender.ts +++ b/src/lib/gramjs/network/MTProtoSender.ts @@ -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); }