From 624e4e6d2714e06fb8d509eaaba6c4a99a6dbb90 Mon Sep 17 00:00:00 2001 From: kolaente Date: Wed, 30 Dec 2020 21:43:43 +0100 Subject: [PATCH] Fix password reset --- src/App.vue | 4 ++-- src/components/home/contentNoAuth.vue | 4 +++- src/views/user/PasswordReset.vue | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/App.vue b/src/App.vue index 898c1350..e9966911 100644 --- a/src/App.vue +++ b/src/App.vue @@ -73,14 +73,14 @@ export default { window.addEventListener('offline', () => this.$store.commit(ONLINE, navigator.onLine)) }, setupPasswortResetRedirect() { - if (this.$route.query.userPasswordReset !== undefined) { + if (typeof this.$route.query.userPasswordReset !== 'undefined') { localStorage.removeItem('passwordResetToken') // Delete an eventually preexisting old token localStorage.setItem('passwordResetToken', this.$route.query.userPasswordReset) this.$router.push({name: 'user.password-reset.reset'}) } }, setupEmailVerificationRedirect() { - if (this.$route.query.userEmailConfirm !== undefined) { + if (typeof this.$route.query.userEmailConfirm !== 'undefined') { localStorage.removeItem('emailConfirmToken') // Delete an eventually preexisting old token localStorage.setItem('emailConfirmToken', this.$route.query.userEmailConfirm) this.$router.push({name: 'user.login'}) diff --git a/src/components/home/contentNoAuth.vue b/src/components/home/contentNoAuth.vue index 05a8dae2..a491329e 100644 --- a/src/components/home/contentNoAuth.vue +++ b/src/components/home/contentNoAuth.vue @@ -33,7 +33,9 @@ export default { this.$route.name !== 'user.password-reset.reset' && this.$route.name !== 'user.register' && this.$route.name !== 'link-share.auth' && - this.$route.name !== 'openid.auth' + this.$route.name !== 'openid.auth' && + localStorage.getItem('passwordResetToken') === null && + localStorage.getItem('emailConfirmToken') === null ) { this.$router.push({name: 'user.login'}) } diff --git a/src/views/user/PasswordReset.vue b/src/views/user/PasswordReset.vue index 78a6ebe5..a5750495 100644 --- a/src/views/user/PasswordReset.vue +++ b/src/views/user/PasswordReset.vue @@ -96,7 +96,7 @@ export default { let passwordReset = new PasswordResetModel({newPassword: this.credentials.password}) this.passwordResetService.resetPassword(passwordReset) .then(response => { - this.successMessage = response.data.message + this.successMessage = response.message localStorage.removeItem('passwordResetToken') }) .catch(e => {