diff --git a/frontend/src/locales/de.json b/frontend/src/locales/de.json index 478c9cba5..f17975c1f 100644 --- a/frontend/src/locales/de.json +++ b/frontend/src/locales/de.json @@ -146,6 +146,7 @@ "change-password": "Passwort ändern", "forgot_pwd": "Passwort vergessen?", "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-password": { "text": "Jetzt kannst du ein neues Passwort speichern, mit dem du dich zukünftig in der Gradido-App anmelden kannst." diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json index 179d5b4b4..b14ef5a35 100644 --- a/frontend/src/locales/en.json +++ b/frontend/src/locales/en.json @@ -146,6 +146,7 @@ "change-password": "Change password", "forgot_pwd": "Forgot password?", "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-password": { "text": "Now you can save a new password to login to the Gradido-App in the future." diff --git a/frontend/src/routes/routes.js b/frontend/src/routes/routes.js index 9f7895859..26f21f9cf 100755 --- a/frontend/src/routes/routes.js +++ b/frontend/src/routes/routes.js @@ -62,6 +62,10 @@ const routes = [ path: '/password', component: () => import('../views/Pages/ForgotPassword.vue'), }, + { + path: '/password/:comingFrom', + component: () => import('../views/Pages/ForgotPassword.vue'), + }, { path: '/register-community', component: () => import('../views/Pages/RegisterCommunity.vue'), diff --git a/frontend/src/views/Pages/ForgotPassword.vue b/frontend/src/views/Pages/ForgotPassword.vue index 444e94495..c27afae6a 100644 --- a/frontend/src/views/Pages/ForgotPassword.vue +++ b/frontend/src/views/Pages/ForgotPassword.vue @@ -5,8 +5,8 @@
-

{{ $t('settings.password.reset') }}

-

{{ $t('settings.password.subtitle') }}

+

{{ $t(displaySetup.headline) }}

+

{{ $t(displaySetup.subtitle) }}

@@ -22,7 +22,7 @@
- {{ $t('settings.password.send_now') }} + {{ $t(displaySetup.button) }}
@@ -41,6 +41,21 @@ import { sendResetPasswordEmail } from '../../graphql/queries' 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 { name: 'password', components: { @@ -52,6 +67,7 @@ export default { form: { email: '', }, + displaySetup: {}, } }, 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 + } + }, } diff --git a/frontend/src/views/Pages/ResetPassword.vue b/frontend/src/views/Pages/ResetPassword.vue index 8dc7ee5bc..a4d06a914 100644 --- a/frontend/src/views/Pages/ResetPassword.vue +++ b/frontend/src/views/Pages/ResetPassword.vue @@ -77,6 +77,7 @@ export default { password: '', passwordRepeat: '', }, + displaySetup: {}, } }, methods: { @@ -94,20 +95,29 @@ export default { this.$router.push('/thx/reset') }) .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() { // TODO validate somehow if present and looks good? // const optin = this.$route.params.optin }, - setDisplaySetup(from) { - this.displaySetup = textFields[this.$route.params.comingFrom] + setDisplaySetup() { + if (!this.$route.params.comingFrom) { + this.displaySetup = textFields.reset + } else { + this.displaySetup = textFields[this.$route.params.comingFrom] + } }, }, - async mounted() { - await this.authenticate() + created() { this.setDisplaySetup() + // await this.authenticate() }, }