Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix login with offline data after argon2 migration by a different client. #6936

Merged
merged 1 commit into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/api/worker/facades/LoginFacade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -701,10 +701,10 @@ export class LoginFacade {
const user = await this.noncachingEntityClient.load(UserTypeRef, userId)
await this.checkOutdatedVerifier(user, accessToken, userPassphraseKey)

const wasPartiallyLoggedIn = this.userFacade.isPartiallyLoggedIn()
if (!wasPartiallyLoggedIn) {
this.userFacade.setUser(user)
}
// this may be the second time we set user in case we had a partial offline login before
// we do it unconditionally here, to make sure we unlock the latest user group key right below
this.userFacade.setUser(user)

const wasFullyLoggedIn = this.userFacade.isFullyLoggedIn()

this.userFacade.unlockUserGroupKey(userPassphraseKey)
Expand Down
3 changes: 2 additions & 1 deletion test/tests/api/worker/facades/LoginFacadeTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,8 @@ o.spec("LoginFacadeTest", function () {
await deferred.promise

// we would love to prove that part of the login is done async but without injecting some asyncExecutor it's a bit tricky to do
o(calls).deepEquals(["setUser", "sessionService"])
// we assume to have seUser twice, once using caching entity client and once using non caching entity client.
o(calls).deepEquals(["setUser", "sessionService", "setUser"])

// just wait for the async login to not bleed into other test cases or to not randomly fail
await fullLoginDeferred.promise
Expand Down