Storing email in the store in case email not validated and no password set now. Taking email from store on forgotpassword.

This commit is contained in:
elweyn 2022-01-26 14:47:21 +01:00
parent 0ca8e702d7
commit 8b60ba623a
2 changed files with 4 additions and 1 deletions

View File

@ -19,7 +19,7 @@
<b-card-body class="p-4"> <b-card-body class="p-4">
<validation-observer ref="observer" v-slot="{ handleSubmit }"> <validation-observer ref="observer" v-slot="{ handleSubmit }">
<b-form role="form" @submit.prevent="handleSubmit(onSubmit)"> <b-form role="form" @submit.prevent="handleSubmit(onSubmit)">
<input-email v-model="form.email"></input-email> <input-email v-model="form.email" :defaultValue="defaultEmail"></input-email>
<div class="text-center"> <div class="text-center">
<b-button type="submit" variant="primary"> <b-button type="submit" variant="primary">
{{ $t(displaySetup.button) }} {{ $t(displaySetup.button) }}
@ -68,6 +68,7 @@ export default {
email: '', email: '',
}, },
displaySetup: {}, displaySetup: {},
defaultEmail: this.$store.state.email,
} }
}, },
methods: { methods: {

View File

@ -107,8 +107,10 @@ export default {
.catch((error) => { .catch((error) => {
this.$toasted.global.error(this.$t('error.no-account')) this.$toasted.global.error(this.$t('error.no-account'))
if (error.message.includes('User email not validated')) { if (error.message.includes('User email not validated')) {
this.$store.commit('email', this.form.email)
this.$router.push('/thx/login') this.$router.push('/thx/login')
} else if (error.message.includes('User has no password set yet')) { } else if (error.message.includes('User has no password set yet')) {
this.$store.commit('email', this.form.email)
this.$router.push('/reset/login') this.$router.push('/reset/login')
} }
loader.hide() loader.hide()