Fix password reset

This commit is contained in:
kolaente 2020-12-30 21:43:43 +01:00
parent 60c21cc36a
commit 624e4e6d27
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B
3 changed files with 6 additions and 4 deletions

View file

@ -73,14 +73,14 @@ export default {
window.addEventListener('offline', () => this.$store.commit(ONLINE, navigator.onLine)) window.addEventListener('offline', () => this.$store.commit(ONLINE, navigator.onLine))
}, },
setupPasswortResetRedirect() { setupPasswortResetRedirect() {
if (this.$route.query.userPasswordReset !== undefined) { if (typeof this.$route.query.userPasswordReset !== 'undefined') {
localStorage.removeItem('passwordResetToken') // Delete an eventually preexisting old token localStorage.removeItem('passwordResetToken') // Delete an eventually preexisting old token
localStorage.setItem('passwordResetToken', this.$route.query.userPasswordReset) localStorage.setItem('passwordResetToken', this.$route.query.userPasswordReset)
this.$router.push({name: 'user.password-reset.reset'}) this.$router.push({name: 'user.password-reset.reset'})
} }
}, },
setupEmailVerificationRedirect() { setupEmailVerificationRedirect() {
if (this.$route.query.userEmailConfirm !== undefined) { if (typeof this.$route.query.userEmailConfirm !== 'undefined') {
localStorage.removeItem('emailConfirmToken') // Delete an eventually preexisting old token localStorage.removeItem('emailConfirmToken') // Delete an eventually preexisting old token
localStorage.setItem('emailConfirmToken', this.$route.query.userEmailConfirm) localStorage.setItem('emailConfirmToken', this.$route.query.userEmailConfirm)
this.$router.push({name: 'user.login'}) this.$router.push({name: 'user.login'})

View file

@ -33,7 +33,9 @@ export default {
this.$route.name !== 'user.password-reset.reset' && this.$route.name !== 'user.password-reset.reset' &&
this.$route.name !== 'user.register' && this.$route.name !== 'user.register' &&
this.$route.name !== 'link-share.auth' && 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'}) this.$router.push({name: 'user.login'})
} }

View file

@ -96,7 +96,7 @@ export default {
let passwordReset = new PasswordResetModel({newPassword: this.credentials.password}) let passwordReset = new PasswordResetModel({newPassword: this.credentials.password})
this.passwordResetService.resetPassword(passwordReset) this.passwordResetService.resetPassword(passwordReset)
.then(response => { .then(response => {
this.successMessage = response.data.message this.successMessage = response.message
localStorage.removeItem('passwordResetToken') localStorage.removeItem('passwordResetToken')
}) })
.catch(e => { .catch(e => {