Implemented a switch for reset & checkEmail so that both send to ResetPassword.vue but show different textes.

This commit is contained in:
elweyn 2021-11-23 09:36:10 +01:00
parent 3ce3370e80
commit 7afbc8dc3c

View File

@ -8,10 +8,10 @@
<h1>{{ $t('settings.password.reset') }}</h1>
<div class="pb-4" v-if="!pending">
<span v-if="authenticated">
{{ $t('settings.password.reset-password.text') }}
{{ $t(displaySetup.authenticated) }}
</span>
<span v-else>
{{ $t('settings.password.reset-password.not-authenticated') }}
{{ $t(displaySetup.notAuthenticated) }}
</span>
</div>
</b-col>
@ -29,7 +29,7 @@
<input-password-confirmation v-model="form" :register="register" />
<div class="text-center">
<b-button type="submit" variant="primary" class="mt-4">
{{ $t('settings.password.reset') }}
{{ $t(displaySetup.button) }}
</b-button>
</div>
</b-form>
@ -38,9 +38,9 @@
</b-card>
</b-col>
</b-row>
<b-row>
<b-row v-if="displaySetup.linkTo">
<b-col class="text-center py-lg-4">
<router-link to="/Login" class="mt-3">{{ $t('back') }}</router-link>
<router-link :to="displaySetup.linkTo" class="mt-3">{{ $t('back') }}</router-link>
</b-col>
</b-row>
</b-container>
@ -51,6 +51,25 @@ import InputPasswordConfirmation from '../../components/Inputs/InputPasswordConf
import { loginViaEmailVerificationCode } from '../../graphql/queries'
import { resetPassword } from '../../graphql/mutations'
const textFields = {
reset: {
authenticated: 'settings.password.reset-password.text',
notAuthenticated: 'settings.password.not-authenticated',
button: 'settings.password.reset',
linkTo: '/login',
},
checkEmail: {
authenticated: 'settings.password.set-password.text',
notAuthenticated: 'settings.password.not-authenticated',
button: 'settings.password.set',
linkTo: '/login',
},
login: {
headline: 'site.thx.errorTitle',
subtitle: 'site.thx.activateEmail',
},
}
export default {
name: 'ResetPassword',
components: {
@ -67,6 +86,7 @@ export default {
email: null,
pending: true,
register: false,
displaySetup: {},
}
},
methods: {
@ -111,9 +131,13 @@ export default {
loader.hide()
this.pending = false
},
setDisplaySetup(from) {
this.displaySetup = textFields[this.$route.params.comingFrom]
},
},
mounted() {
this.authenticate()
this.setDisplaySetup()
},
}
</script>