mirror of
https://github.com/bitwarden/android.git
synced 2025-12-10 09:56:45 -06:00
🍒 [PM-27902] Logout user after successful master password reset (#6137)
This commit is contained in:
parent
317fd376a7
commit
23e4b1163c
@ -1023,12 +1023,6 @@ class AuthRepositoryImpl(
|
|||||||
}
|
}
|
||||||
.fold(
|
.fold(
|
||||||
onSuccess = {
|
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.
|
// Update the saved master password hash.
|
||||||
authSdkSource
|
authSdkSource
|
||||||
.hashPassword(
|
.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.
|
// Return the success.
|
||||||
ResetPasswordResult.Success
|
ResetPasswordResult.Success
|
||||||
},
|
},
|
||||||
|
|||||||
@ -66,6 +66,11 @@ sealed class LogoutReason {
|
|||||||
*/
|
*/
|
||||||
data object Notification : 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.
|
* Indicates that the logout is happening because the sync security stamp was invalidated.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -5073,6 +5073,12 @@ class AuthRepositoryTest {
|
|||||||
userId = USER_ID_1,
|
userId = USER_ID_1,
|
||||||
passwordHash = newPasswordHash,
|
passwordHash = newPasswordHash,
|
||||||
)
|
)
|
||||||
|
verify {
|
||||||
|
userLogoutManager.logout(
|
||||||
|
userId = ACCOUNT_1.profile.userId,
|
||||||
|
reason = LogoutReason.PasswordReset,
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user