Reload window after changing password (#15474)

* Reload window after changing password

* Shows password change success message

Displays a success snackbar after a user successfully changes their password. This provides visual confirmation to the user that the password update was successful.
The success message is displayed only once after the page reloads.

* lint fix trailing spaces
This commit is contained in:
Fiz
2025-07-16 13:07:28 -05:00
committed by GitHub
parent f26d2a59ae
commit 068640311e
2 changed files with 14 additions and 6 deletions

View File

@@ -269,6 +269,17 @@ export default {
const loadingScreen = document.getElementById('loading-screen');
if (loadingScreen) document.body.removeChild(loadingScreen);
// Check if we need to show password change success message
if (sessionStorage.getItem('passwordChangeSuccess') === 'true') {
sessionStorage.removeItem('passwordChangeSuccess');
this.$store.dispatch('snackbars:add', {
title: 'Habitica',
text: this.$t('passwordSuccess'),
type: 'success',
timeout: true,
});
}
this.$router.onReady(() => {
if (this.isStaticPage || !this.isUserLoggedIn) {
this.hideLoadingScreen();

View File

@@ -168,12 +168,9 @@ export default {
});
this.passwordUpdates = {};
this.$store.dispatch('snackbars:add', {
title: 'Habitica',
text: this.$t('passwordSuccess'),
type: 'success',
timeout: true,
});
// Store a flag to show success message after reload
sessionStorage.setItem('passwordChangeSuccess', 'true');
window.location.reload();
});
},