Uh oh!
There was an error while loading. Please reload this page.
fix(account): stop signing in deactivated accounts - #14580
Merged
Conversation
fetchAccountAsync detected a deactivated account, dispatched resetAccount
and fetchAccountFailed({ reason: 'ACCOUNT_DEACTIVATED' }), then fell
through to setLocalStorageAccountAndUser, fetchAccountSucceeded and
signedIn — so the account was fully restored (and cached) anyway. The
`return` existed in the old JS saga and was dropped in the JS -> TS port
in #10447.
The sign-in form's own check does block, but it left the hedgehog session
from the login intact, so reloading the page ran fetchAccountAsync and
signed the user straight in. Clear the session there too.
Affects web and mobile (shared saga). Reported by a deactivated user who
sent a screenshot of their own feed.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Uh oh!
There was an error while loading. Please reload this page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
A user who deactivated their account (
audius.co/timitamminen,is_deactivated: truein prod) reported they can still log in, and sent a screenshot of their own feed from "inside my deactivated account".Two things combine:
fetchAccountAsyncis missing areturn. It detects the deactivated account, dispatchesresetAccount()+fetchAccountFailed({ reason: 'ACCOUNT_DEACTIVATED' }), and then falls straight through tosetLocalStorageAccountAndUser,fetchAccountSucceededandsignedIn. The account is fully restored — and written to local storage — despite the "failure". Thereturnwas present in the oldpackages/web/src/common/store/account/sagas.jsand was dropped when the saga was ported to TS in [C-5416] Basic guest checkout behind feature flag #10447 (Nov 2024). The sibling cached pathfetchLocalAccountAsyncstill guards correctly, which is why this only bites on the network path.The sign-in saga leaves the hedgehog session live.
signIncorrectly detectsis_deactivatedand toasts, but by thenauthService.signInhas already persisted the wallet. A page refresh then runsfetchAccountAsync, hits (1), and signs the user in. Now callsauthService.signOutbefore bailing.packages/commonis shared, so this affected both web and mobile.Tests
Adds
packages/common/src/store/account/sagas.test.ts— asserts a deactivated account producesfetchAccountFailedand neverfetchAccountSucceeded/signedIn. Verified it fails with thereturnremoved.How to test
🤖 Generated with Claude Code