Routes can route to /thx/login & /activateEmail , thx page now integrates email not activated logic.

This commit is contained in:
elweyn 2021-11-12 10:06:31 +01:00
parent b1e419530c
commit fefcb7251a
4 changed files with 97 additions and 5 deletions

View File

@ -40,7 +40,7 @@ const routes = [
path: '/thx/:comingFrom',
component: () => import('../views/Pages/thx.vue'),
beforeEnter: (to, from, next) => {
const validFrom = ['password', 'reset', 'register']
const validFrom = ['password', 'reset', 'register', 'login', 'activateEmail']
if (!validFrom.includes(from.path.split('/')[1])) {
next({ path: '/login' })
} else {
@ -68,6 +68,10 @@ const routes = [
path: '/checkEmail/:optin',
component: () => import('../views/Pages/CheckEmail.vue'),
},
{
path: '/activateEmail',
component: () => import('../views/Pages/ActivateEmail.vue'),
},
{ path: '*', component: NotFound },
]

View File

@ -0,0 +1,76 @@
<template>
<div class="forgot-password">
<div class="header p-4">
<b-container class="container">
<div class="header-body text-center mb-7">
<b-row class="justify-content-center">
<b-col xl="5" lg="6" md="8" class="px-2">
<h1>{{ $t('site.activateEmail.headline') }}</h1>
<p class="text-lead">{{ $t('site.activateEmail.subtitle') }}</p>
</b-col>
</b-row>
</div>
</b-container>
</div>
<b-container class="mt--8 p-1">
<b-row class="justify-content-center">
<b-col lg="6" md="8">
<b-card no-body class="border-0" style="background-color: #ebebeba3 !important">
<b-card-body class="p-4">
<validation-observer ref="observer" v-slot="{ handleSubmit }">
<b-form role="form" @submit.prevent="handleSubmit(onSubmit)">
<input-email v-model="form.email"></input-email>
<div class="text-center">
<b-button type="submit" variant="primary">
{{ $t('site.activateEmail.send_now') }}
</b-button>
</div>
</b-form>
</validation-observer>
</b-card-body>
</b-card>
</b-col>
</b-row>
<div class="text-center py-lg-4">
<router-link to="/Login" class="mt-3">{{ $t('back') }}</router-link>
</div>
</b-container>
</div>
</template>
<script>
import { sendResetPasswordEmail } from '../../graphql/queries'
import InputEmail from '../../components/Inputs/InputEmail'
export default {
name: 'activateEmail',
components: {
InputEmail,
},
data() {
return {
disable: 'disabled',
form: {
email: '',
},
}
},
methods: {
async onSubmit() {
this.$apollo
.query({
query: sendResetPasswordEmail,
variables: {
email: this.form.email,
},
})
.then(() => {
this.$router.push('/thx/activateEmail')
})
.catch(() => {
this.$router.push('/thx/activateEmail')
})
},
},
}
</script>
<style></style>

View File

@ -103,11 +103,13 @@ export default {
loader.hide()
})
.catch((error) => {
if (!error.message.includes('user email not validated')) {
this.$toasted.error(this.$t('error.no-account'))
} else {
// : this.$t('error.no-email-verify')
this.$router.push('/thx/login')
}
loader.hide()
const toastedError = !error.message.includes('user email not validated')
? this.$t('error.no-account')
: this.$t('error.no-email-verify')
this.$toasted.error(toastedError)
})
},
async onCreated() {

View File

@ -36,6 +36,16 @@ const textFields = {
button: 'login',
linkTo: '/login',
},
login: {
subtitle: 'site.thx.activateEmail',
button: 'Send Activation Link',
linkTo: '/activateEmail',
},
activateEmail: {
subtitle: 'site.thx.emailActivated',
button: 'login',
linkTo: '/login',
},
}
export default {