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');
|
||||
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();
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user