diff --git a/packages/web/src/common/store/account/sagas.js b/packages/web/src/common/store/account/sagas.js index 861cba83edd..7d32555ce1b 100644 --- a/packages/web/src/common/store/account/sagas.js +++ b/packages/web/src/common/store/account/sagas.js @@ -179,8 +179,8 @@ export function* fetchAccountAsync({ isSignUp = false }) { const clientOrigin = isNativeMobile ? 'mobile' : isElectron - ? 'desktop' - : 'web' + ? 'desktop' + : 'web' fingerprintClient.identify(account.user_id, clientOrigin) yield call(recordIPIfNotRecent, account.handle) @@ -192,13 +192,19 @@ export function* fetchAccountAsync({ isSignUp = false }) { export function* fetchLocalAccountAsync() { const localStorage = yield getContext('localStorage') + const audiusBackendInstance = yield getContext('audiusBackendInstance') yield put(accountActions.fetchAccountRequested()) + const audiusLibs = yield call([audiusBackendInstance, audiusBackendInstance.getAudiusLibs]) + const wallet = yield call([audiusLibs.web3Manager, audiusLibs.web3Manager.getWalletAddress]) const cachedAccount = yield call([localStorage, 'getAudiusAccount']) const cachedAccountUser = yield call([localStorage, 'getAudiusAccountUser']) const currentUserExists = yield call([localStorage, 'getCurrentUserExists']) - if (cachedAccount && cachedAccountUser && !cachedAccountUser.is_deactivated) { + + const walletMatches = wallet.toLowerCase() === cachedAccountUser.wallet.toLowerCase() + + if (cachedAccount && cachedAccountUser && !cachedAccountUser.is_deactivated && walletMatches) { yield call( cacheAccount, { ...cachedAccountUser, local: true },