Skip to content

Commit 0686403

Browse files
authored
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
1 parent f26d2a5 commit 0686403

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

website/client/src/app.vue

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,17 @@ export default {
269269
const loadingScreen = document.getElementById('loading-screen');
270270
if (loadingScreen) document.body.removeChild(loadingScreen);
271271
272+
// Check if we need to show password change success message
273+
if (sessionStorage.getItem('passwordChangeSuccess') === 'true') {
274+
sessionStorage.removeItem('passwordChangeSuccess');
275+
this.$store.dispatch('snackbars:add', {
276+
title: 'Habitica',
277+
text: this.$t('passwordSuccess'),
278+
type: 'success',
279+
timeout: true,
280+
});
281+
}
282+
272283
this.$router.onReady(() => {
273284
if (this.isStaticPage || !this.isUserLoggedIn) {
274285
this.hideLoadingScreen();

website/client/src/pages/settings/settingRows/passwordSetting.vue

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -168,12 +168,9 @@ export default {
168168
});
169169
170170
this.passwordUpdates = {};
171-
this.$store.dispatch('snackbars:add', {
172-
title: 'Habitica',
173-
text: this.$t('passwordSuccess'),
174-
type: 'success',
175-
timeout: true,
176-
});
171+
// Store a flag to show success message after reload
172+
sessionStorage.setItem('passwordChangeSuccess', 'true');
173+
window.location.reload();
177174
});
178175
},
179176

0 commit comments

Comments
 (0)