🍒 [PM-27902] Logout user after successful master password reset (#6137)

This commit is contained in:
aj-rosado 2025-11-07 17:14:48 +00:00 committed by GitHub
parent 317fd376a7
commit 23e4b1163c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 15 additions and 6 deletions

View File

@ -1023,12 +1023,6 @@ class AuthRepositoryImpl(
}
.fold(
onSuccess = {
// Clear the password reset reason, since it's no longer relevant.
storeUserResetPasswordReason(
userId = activeAccount.profile.userId,
reason = null,
)
// Update the saved master password hash.
authSdkSource
.hashPassword(
@ -1044,6 +1038,10 @@ class AuthRepositoryImpl(
)
}
// Log out the user after successful password reset.
// This clears all user state including forcePasswordResetReason.
logout(reason = LogoutReason.PasswordReset)
// Return the success.
ResetPasswordResult.Success
},

View File

@ -66,6 +66,11 @@ sealed class LogoutReason {
*/
data object Notification : LogoutReason()
/**
* Indicates that the logout is happening because the user reset their master password.
*/
data object PasswordReset : LogoutReason()
/**
* Indicates that the logout is happening because the sync security stamp was invalidated.
*/

View File

@ -5073,6 +5073,12 @@ class AuthRepositoryTest {
userId = USER_ID_1,
passwordHash = newPasswordHash,
)
verify {
userLogoutManager.logout(
userId = ACCOUNT_1.profile.userId,
reason = LogoutReason.PasswordReset,
)
}
}
@Test