Work in progress
This commit is contained in:
56
client/pages/auth/password/email.vue
Normal file
56
client/pages/auth/password/email.vue
Normal file
@@ -0,0 +1,56 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="flex mt-6 mb-10">
|
||||
<div class="w-full md:w-2/3 md:mx-auto md:max-w-md px-4">
|
||||
<h1 class="my-6">
|
||||
Reset password
|
||||
</h1>
|
||||
<form @submit.prevent="send" @keydown="form.onKeydown($event)">
|
||||
<alert-success :form="form" :message="status" class="mb-4" />
|
||||
|
||||
<!-- Email -->
|
||||
<text-input name="email" :form="form" label="Email" :required="true" />
|
||||
|
||||
<!-- Submit Button -->
|
||||
<v-button class="w-full" :loading="form.busy">
|
||||
Send Password Reset Link
|
||||
</v-button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<open-form-footer />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Form from 'vform'
|
||||
import OpenFormFooter from '../../../components/pages/OpenFormFooter.vue'
|
||||
import SeoMeta from '../../../mixins/seo-meta.js'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
OpenFormFooter
|
||||
},
|
||||
|
||||
mixins: [SeoMeta],
|
||||
middleware: 'guest',
|
||||
|
||||
data: () => ({
|
||||
metaTitle: 'Reset Password',
|
||||
status: '',
|
||||
form: new Form({
|
||||
email: ''
|
||||
})
|
||||
}),
|
||||
|
||||
methods: {
|
||||
async send () {
|
||||
const { data } = await this.form.post('/api/password/email')
|
||||
|
||||
this.status = data.status
|
||||
|
||||
this.form.reset()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
74
client/pages/auth/password/reset.vue
Normal file
74
client/pages/auth/password/reset.vue
Normal file
@@ -0,0 +1,74 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="flex mt-6 mb-10">
|
||||
<div class="w-full md:w-2/3 md:mx-auto md:max-w-md px-4">
|
||||
<h1 class="my-6">
|
||||
Reset Password
|
||||
</h1>
|
||||
<form @submit.prevent="reset" @keydown="form.onKeydown($event)">
|
||||
<alert-success class="mb-4" :form="form" :message="status" />
|
||||
|
||||
<!-- Email -->
|
||||
<text-input name="email" :form="form" label="Email" :required="true" />
|
||||
|
||||
<!-- Password -->
|
||||
<text-input class="mt-8" native-type="password"
|
||||
name="password" :form="form" label="Password" :required="true"
|
||||
/>
|
||||
|
||||
<!-- Password Confirmation-->
|
||||
<text-input class="mt-8" native-type="password"
|
||||
name="password_confirmation" :form="form" label="Confirm Password" :required="true"
|
||||
/>
|
||||
|
||||
<!-- Submit Button -->
|
||||
<v-button class="w-full" :loading="form.busy">
|
||||
Reset Password
|
||||
</v-button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<open-form-footer />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Form from 'vform'
|
||||
import OpenFormFooter from '../../../components/pages/OpenFormFooter.vue'
|
||||
import SeoMeta from '../../../mixins/seo-meta.js'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
OpenFormFooter
|
||||
},
|
||||
|
||||
mixins: [SeoMeta],
|
||||
middleware: 'guest',
|
||||
|
||||
data: () => ({
|
||||
metaTitle: 'Reset Password',
|
||||
status: '',
|
||||
form: new Form({
|
||||
token: '',
|
||||
email: '',
|
||||
password: '',
|
||||
password_confirmation: ''
|
||||
})
|
||||
}),
|
||||
|
||||
created () {
|
||||
this.form.email = this.$route.query.email
|
||||
this.form.token = this.$route.params.token
|
||||
},
|
||||
|
||||
methods: {
|
||||
async reset () {
|
||||
const { data } = await this.form.post('/api/password/reset')
|
||||
|
||||
this.status = data.status
|
||||
|
||||
this.form.reset()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
58
client/pages/auth/verification/resend.vue
Normal file
58
client/pages/auth/verification/resend.vue
Normal file
@@ -0,0 +1,58 @@
|
||||
<template>
|
||||
<div class="row">
|
||||
<div class="col-lg-8 m-auto px-4">
|
||||
<h1 class="my-6">
|
||||
Verify Email
|
||||
</h1>
|
||||
<form @submit.prevent="send" @keydown="form.onKeydown($event)">
|
||||
<alert-success :form="form" :message="status" />
|
||||
|
||||
<!-- Email -->
|
||||
<text-input name="email" :form="form" label="Email" :required="true" />
|
||||
|
||||
<!-- Submit Button -->
|
||||
<div class="form-group row">
|
||||
<div class="col-md-9 ml-md-auto">
|
||||
<v-button :loading="form.busy">
|
||||
Send Verification Link
|
||||
</v-button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Form from 'vform'
|
||||
import SeoMeta from '../../../mixins/seo-meta.js'
|
||||
|
||||
export default {
|
||||
mixins: [SeoMeta],
|
||||
middleware: 'guest',
|
||||
|
||||
data: () => ({
|
||||
metaTitle: 'Verify Email',
|
||||
status: '',
|
||||
form: new Form({
|
||||
email: ''
|
||||
})
|
||||
}),
|
||||
|
||||
created () {
|
||||
if (this.$route.query.email) {
|
||||
this.form.email = this.$route.query.email
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
async send () {
|
||||
const { data } = await this.form.post('/api/email/resend')
|
||||
|
||||
this.status = data.status
|
||||
|
||||
this.form.reset()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
59
client/pages/auth/verification/verify.vue
Normal file
59
client/pages/auth/verification/verify.vue
Normal file
@@ -0,0 +1,59 @@
|
||||
<template>
|
||||
<div class="row">
|
||||
<div class="col-lg-8 m-auto px-4">
|
||||
<h1 class="my-6">
|
||||
Verify Email
|
||||
</h1>
|
||||
<template v-if="success">
|
||||
<div class="alert alert-success" role="alert">
|
||||
{{ success }}
|
||||
</div>
|
||||
|
||||
<router-link :to="{ name: 'login' }" class="btn btn-primary">
|
||||
Login
|
||||
</router-link>
|
||||
</template>
|
||||
<template v-else>
|
||||
<div class="alert alert-danger" role="alert">
|
||||
{{ error || 'Failed to verify email.' }}
|
||||
</div>
|
||||
|
||||
<router-link :to="{ name: 'verification.resend' }" class="small float-right">
|
||||
Resend Verification Link?
|
||||
</router-link>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import axios from 'axios'
|
||||
import SeoMeta from '../../../mixins/seo-meta.js'
|
||||
|
||||
const qs = (params) => Object.keys(params).map(key => `${key}=${params[key]}`).join('&')
|
||||
|
||||
export default {
|
||||
mixins: [SeoMeta],
|
||||
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',
|
||||
|
||||
data: () => ({
|
||||
metaTitle: 'Verify Email',
|
||||
error: '',
|
||||
success: ''
|
||||
})
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user