From 068640311e63c24deef6f43208f3e9b2f2a26121 Mon Sep 17 00:00:00 2001 From: Fiz <34069775+Hafizzle@users.noreply.github.com> Date: Wed, 16 Jul 2025 13:07:28 -0500 Subject: [PATCH] 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 --- website/client/src/app.vue | 11 +++++++++++ .../pages/settings/settingRows/passwordSetting.vue | 9 +++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/website/client/src/app.vue b/website/client/src/app.vue index 5b72ea8782..d8f561c3c3 100644 --- a/website/client/src/app.vue +++ b/website/client/src/app.vue @@ -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(); diff --git a/website/client/src/pages/settings/settingRows/passwordSetting.vue b/website/client/src/pages/settings/settingRows/passwordSetting.vue index 706cf9204b..353ba96485 100644 --- a/website/client/src/pages/settings/settingRows/passwordSetting.vue +++ b/website/client/src/pages/settings/settingRows/passwordSetting.vue @@ -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(); }); },