Added a comingFrom parameter to ForgotPassword so we can have different texte in case of optin code expired.

This commit is contained in:
elweyn 2021-12-07 09:48:22 +01:00
parent 6cbedc55f2
commit 00f08ff2db
5 changed files with 48 additions and 8 deletions

View File

@ -146,6 +146,7 @@
"change-password": "Passwort ändern", "change-password": "Passwort ändern",
"forgot_pwd": "Passwort vergessen?", "forgot_pwd": "Passwort vergessen?",
"not-authenticated": "Leider konnten wir dich nicht authentifizieren. Bitte wende dich an den Support.", "not-authenticated": "Leider konnten wir dich nicht authentifizieren. Bitte wende dich an den Support.",
"resend_subtitle": "Dein Aktivierungslink ist abgelaufen, Du kannst hier ein neuen anfordern.",
"reset": "Passwort zurücksetzen", "reset": "Passwort zurücksetzen",
"reset-password": { "reset-password": {
"text": "Jetzt kannst du ein neues Passwort speichern, mit dem du dich zukünftig in der Gradido-App anmelden kannst." "text": "Jetzt kannst du ein neues Passwort speichern, mit dem du dich zukünftig in der Gradido-App anmelden kannst."

View File

@ -146,6 +146,7 @@
"change-password": "Change password", "change-password": "Change password",
"forgot_pwd": "Forgot password?", "forgot_pwd": "Forgot password?",
"not-authenticated": "Unfortunately we could not authenticate you. Please contact the support.", "not-authenticated": "Unfortunately we could not authenticate you. Please contact the support.",
"resend_subtitle": "Your activation link is expired, here you can order a new one.",
"reset": "Reset password", "reset": "Reset password",
"reset-password": { "reset-password": {
"text": "Now you can save a new password to login to the Gradido-App in the future." "text": "Now you can save a new password to login to the Gradido-App in the future."

View File

@ -62,6 +62,10 @@ const routes = [
path: '/password', path: '/password',
component: () => import('../views/Pages/ForgotPassword.vue'), component: () => import('../views/Pages/ForgotPassword.vue'),
}, },
{
path: '/password/:comingFrom',
component: () => import('../views/Pages/ForgotPassword.vue'),
},
{ {
path: '/register-community', path: '/register-community',
component: () => import('../views/Pages/RegisterCommunity.vue'), component: () => import('../views/Pages/RegisterCommunity.vue'),

View File

@ -5,8 +5,8 @@
<div class="header-body text-center mb-7"> <div class="header-body text-center mb-7">
<b-row class="justify-content-center"> <b-row class="justify-content-center">
<b-col xl="5" lg="6" md="8" class="px-2"> <b-col xl="5" lg="6" md="8" class="px-2">
<h1>{{ $t('settings.password.reset') }}</h1> <h1>{{ $t(displaySetup.headline) }}</h1>
<p class="text-lead">{{ $t('settings.password.subtitle') }}</p> <p class="text-lead">{{ $t(displaySetup.subtitle) }}</p>
</b-col> </b-col>
</b-row> </b-row>
</div> </div>
@ -22,7 +22,7 @@
<input-email v-model="form.email"></input-email> <input-email v-model="form.email"></input-email>
<div class="text-center"> <div class="text-center">
<b-button type="submit" variant="primary"> <b-button type="submit" variant="primary">
{{ $t('settings.password.send_now') }} {{ $t(displaySetup.button) }}
</b-button> </b-button>
</div> </div>
</b-form> </b-form>
@ -41,6 +41,21 @@
import { sendResetPasswordEmail } from '../../graphql/queries' import { sendResetPasswordEmail } from '../../graphql/queries'
import InputEmail from '../../components/Inputs/InputEmail' import InputEmail from '../../components/Inputs/InputEmail'
const textFields = {
reset: {
headline: 'settings.password.reset',
subtitle: 'settings.password.resend_subtitle',
button: 'settings.password.send_now',
cancel: 'back',
},
login: {
headline: 'settings.password.reset',
subtitle: 'settings.password.subtitle',
button: 'settings.password.send_now',
cancel: 'back',
},
}
export default { export default {
name: 'password', name: 'password',
components: { components: {
@ -52,6 +67,7 @@ export default {
form: { form: {
email: '', email: '',
}, },
displaySetup: {},
} }
}, },
methods: { methods: {
@ -71,6 +87,14 @@ export default {
}) })
}, },
}, },
created() {
console.log('comingFrom', this.$route.params.comingFrom)
if (this.$route.params.comingFrom) {
this.displaySetup = textFields[this.$route.params.comingFrom]
} else {
this.displaySetup = textFields.login
}
},
} }
</script> </script>
<style></style> <style></style>

View File

@ -77,6 +77,7 @@ export default {
password: '', password: '',
passwordRepeat: '', passwordRepeat: '',
}, },
displaySetup: {},
} }
}, },
methods: { methods: {
@ -94,20 +95,29 @@ export default {
this.$router.push('/thx/reset') this.$router.push('/thx/reset')
}) })
.catch((error) => { .catch((error) => {
this.$toasted.error(error.message) if (error.message.includes('Code is older than 10 minutes')) {
this.$toasted.error(error.message)
this.$router.push('/password/reset')
} else {
this.$toasted.error(error.message)
}
}) })
}, },
async authenticate() { async authenticate() {
// TODO validate somehow if present and looks good? // TODO validate somehow if present and looks good?
// const optin = this.$route.params.optin // const optin = this.$route.params.optin
}, },
setDisplaySetup(from) { setDisplaySetup() {
this.displaySetup = textFields[this.$route.params.comingFrom] if (!this.$route.params.comingFrom) {
this.displaySetup = textFields.reset
} else {
this.displaySetup = textFields[this.$route.params.comingFrom]
}
}, },
}, },
async mounted() { created() {
await this.authenticate()
this.setDisplaySetup() this.setDisplaySetup()
// await this.authenticate()
}, },
} }
</script> </script>