mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 15:48:04 +01:00
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:
@@ -269,6 +269,17 @@ export default {
|
|||||||
const loadingScreen = document.getElementById('loading-screen');
|
const loadingScreen = document.getElementById('loading-screen');
|
||||||
if (loadingScreen) document.body.removeChild(loadingScreen);
|
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(() => {
|
this.$router.onReady(() => {
|
||||||
if (this.isStaticPage || !this.isUserLoggedIn) {
|
if (this.isStaticPage || !this.isUserLoggedIn) {
|
||||||
this.hideLoadingScreen();
|
this.hideLoadingScreen();
|
||||||
|
|||||||
@@ -168,12 +168,9 @@ export default {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.passwordUpdates = {};
|
this.passwordUpdates = {};
|
||||||
this.$store.dispatch('snackbars:add', {
|
// Store a flag to show success message after reload
|
||||||
title: 'Habitica',
|
sessionStorage.setItem('passwordChangeSuccess', 'true');
|
||||||
text: this.$t('passwordSuccess'),
|
window.location.reload();
|
||||||
type: 'success',
|
|
||||||
timeout: true,
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user