2022-09-20 19:59:52 +00:00
|
|
|
<template>
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-lg-8 m-auto px-4">
|
|
|
|
<h1 class="my-6">
|
2023-10-14 16:24:44 +00:00
|
|
|
Verify Email
|
2022-09-20 19:59:52 +00:00
|
|
|
</h1>
|
|
|
|
<template v-if="success">
|
|
|
|
<div class="alert alert-success" role="alert">
|
|
|
|
{{ success }}
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<router-link :to="{ name: 'login' }" class="btn btn-primary">
|
2023-10-14 16:24:44 +00:00
|
|
|
Login
|
2022-09-20 19:59:52 +00:00
|
|
|
</router-link>
|
|
|
|
</template>
|
|
|
|
<template v-else>
|
|
|
|
<div class="alert alert-danger" role="alert">
|
2023-10-14 16:24:44 +00:00
|
|
|
{{ error || 'Failed to verify email.' }}
|
2022-09-20 19:59:52 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<router-link :to="{ name: 'verification.resend' }" class="small float-right">
|
2023-10-14 16:24:44 +00:00
|
|
|
Resend Verification Link?
|
2022-09-20 19:59:52 +00:00
|
|
|
</router-link>
|
|
|
|
</template>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import axios from 'axios'
|
2023-01-21 11:57:37 +00:00
|
|
|
import SeoMeta from '../../../mixins/seo-meta.js'
|
2022-09-20 19:59:52 +00:00
|
|
|
|
|
|
|
const qs = (params) => Object.keys(params).map(key => `${key}=${params[key]}`).join('&')
|
|
|
|
|
|
|
|
export default {
|
2023-10-14 16:24:44 +00:00
|
|
|
mixins: [SeoMeta],
|
2022-09-20 19:59:52 +00:00
|
|
|
async beforeRouteEnter (to, from, next) {
|
|
|
|
try {
|
|
|
|
const { data } = await axios.post(`/api/email/verify/${to.params.id}?${qs(to.query)}`)
|
|
|
|
|
|
|
|
next(vm => {
|
|
|
|
vm.success = data.status
|
|
|
|
})
|
|
|
|
} catch (e) {
|
|
|
|
next(vm => {
|
|
|
|
vm.error = e.response.data.status
|
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
middleware: 'guest',
|
2023-10-14 16:24:44 +00:00
|
|
|
|
2022-09-20 19:59:52 +00:00
|
|
|
data: () => ({
|
2022-12-22 10:55:17 +00:00
|
|
|
metaTitle: 'Verify Email',
|
2022-09-20 19:59:52 +00:00
|
|
|
error: '',
|
|
|
|
success: ''
|
|
|
|
})
|
|
|
|
}
|
|
|
|
</script>
|