mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 22:39:34 +00:00
[forgot, reset pwd] + male doladovacky
This commit is contained in:
1 parent
92a5716ab9
commit
ff2bd3979a
7 files changed
+46
-22
No files matched your search
@@ -1,9 +1,9 @@
|
||||
<template>
|
||||
<v-form>
|
||||
<v-text-field v-model="form.email" variant="solo" bg-color="white" :hint="v$.form.email.$errors ? errorUtils.parseErrors(v$.form.email.$errors) : null" :class="{ error: v$.form.email.$errors.length }" class="mb-2" label="E-mail" autocomplete="email" />
|
||||
<v-form @keydown.enter="submit()">
|
||||
<v-text-field v-model="credentials.email" variant="solo" bg-color="white" :hint="v$.credentials.email.$errors ? errorUtils.parseErrors(v$.credentials.email.$errors) : null" :class="{ error: v$.credentials.email.$errors.length }" class="mb-2" label="E-mail" autocomplete="email" />
|
||||
|
||||
<div class="d-flex flex-column">
|
||||
<v-btn class="button" color="#7F39FB" @click="submit()">Send code</v-btn>
|
||||
<v-btn class="button" color="#7F39FB" @click.prevent="submit()">Send code</v-btn>
|
||||
<p class="mt-5 text-center cursor-pointer" @click="$router.push({ name: 'Login' })">Did you remember your password? Log in</p>
|
||||
</div>
|
||||
</v-form>
|
||||
@@ -15,18 +15,25 @@ import { required, email } from '@vuelidate/validators'
|
||||
import errorUtils from '@/plugins/lib@auth/_utils/error.utils'
|
||||
|
||||
export default {
|
||||
props: {
|
||||
navigateToAfterForgotPassword: {
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
errorUtils,
|
||||
v$: useVuelidate(),
|
||||
form: {},
|
||||
credentials: {},
|
||||
showPassword: false
|
||||
}
|
||||
},
|
||||
|
||||
validations() {
|
||||
return {
|
||||
form: {
|
||||
credentials: {
|
||||
email: { required, email }
|
||||
}
|
||||
}
|
||||
@@ -37,8 +44,8 @@ export default {
|
||||
if (!(await this.v$.$validate())) return
|
||||
|
||||
try {
|
||||
await this.$axios.post_data('v1/auth/forgot', this.form)
|
||||
this.$router.push({ name: 'Reset password' })
|
||||
await this.$store.dispatch('auth/forgotPassword', this.credentials)
|
||||
this.$router.push(`${this.navigateToAfterForgotPassword}?email=${this.credentials.email}`)
|
||||
} catch (error) {
|
||||
this.$toast.error(error)
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<h1>Forgotten password?</h1>
|
||||
<p class="mb-10">We will send you a confirmation code on your email with the instructions</p>
|
||||
|
||||
<A-forgot-password-form />
|
||||
<A-forgot-password-form navigate-to-after-forgot-password="/auth/reset-password" />
|
||||
</div>
|
||||
</v-container>
|
||||
</template>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<v-form>
|
||||
<v-form @keydown.enter="submit()">
|
||||
<v-text-field v-model="form.email" label="E-mail" variant="solo" autocomplete="email" class="mb-2" bg-color="white" :hint="v$.form.email.$errors ? errorUtils.parseErrors(v$.form.email.$errors) : null" :class="{ error: v$.form.email.$errors.length }" />
|
||||
|
||||
<v-text-field v-model="form.password" :type="showPassword ? 'text' : 'password'" variant="solo" bg-color="white" class="mb-2" :counter="12" label="Heslo" autocomplete="current-password" :hint="v$.form.password.$errors ? errorUtils.parseErrors(v$.form.password.$errors) : null"
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
<template>
|
||||
<v-form>
|
||||
<v-text-field v-model="form.code" label="Code" autocomplete="one-time-code" bg-color="white" variant="solo" type="number" class="mb-2" :hint="v$.form.code.$errors ? errorUtils.parseErrors(v$.form.code.$errors) : null" :counter="6" :class="{ error: v$.form.code.$errors.length }" />
|
||||
<v-form @keydown.enter="submit()">
|
||||
<v-text-field v-model="credentials.code" label="Code" autocomplete="one-time-code" bg-color="white" variant="solo" type="number" class="mb-2" :hint="v$.credentials.code.$errors ? errorUtils.parseErrors(v$.credentials.code.$errors) : null" :counter="6" :class="{ error: v$.credentials.code.$errors.length }" />
|
||||
|
||||
<v-text-field v-model="form.email" label="E-mail" autocomplete="email" bg-color="white" variant="solo" type="email" class="mb-2" :hint="v$.form.email.$errors ? errorUtils.parseErrors(v$.form.email.$errors) : null" :class="{ error: v$.form.email.$errors.length }" />
|
||||
<v-text-field v-model="credentials.email" label="E-mail" autocomplete="email" bg-color="white" variant="solo" type="email" class="mb-2" :hint="v$.credentials.email.$errors ? errorUtils.parseErrors(v$.credentials.email.$errors) : null" :class="{ error: v$.credentials.email.$errors.length }" />
|
||||
|
||||
<v-text-field v-model="form.password" label="Heslo" autocomplete="new-password" bg-color="white" variant="solo" :type="showPassword ? 'text' : 'password'" class="mb-2" :hint="v$.form.password.$errors ? errorUtils.parseErrors(v$.form.password.$errors) : null" :class="{ error: v$.form.password.$errors.length }" :counter="12" :append-icon="showPassword ? 'mdi-eye' : 'mdi-eye-off'" @click:append="showPassword = !showPassword" />
|
||||
<v-text-field v-model="credentials.password" label="Heslo" autocomplete="new-password" bg-color="white" variant="solo" :type="showPassword ? 'text' : 'password'" class="mb-2" :hint="v$.credentials.password.$errors ? errorUtils.parseErrors(v$.credentials.password.$errors) : null" :class="{ error: v$.credentials.password.$errors.length }" :counter="12" :append-icon="showPassword ? 'mdi-eye' : 'mdi-eye-off'" @click:append="showPassword = !showPassword" />
|
||||
|
||||
<v-text-field v-model="form.password_confirmation" autocomplete="new-password" bg-color="white" variant="solo" label="Potvrdenie hesla" :type="showConfirmationPassword ? 'text' : 'password'" :counter="12" class="mb-2" :hint="v$.form.password_confirmation.$errors ? errorUtils.parseErrors(v$.form.password_confirmation.$errors) : null" :class="{ error: v$.form.password_confirmation.$errors.length }" :append-icon="showConfirmationPassword ? 'mdi-eye' : 'mdi-eye-off'" @click:append="showConfirmationPassword = !showConfirmationPassword" />
|
||||
<v-text-field v-model="credentials.password_confirmation" autocomplete="new-password" bg-color="white" variant="solo" label="Potvrdenie hesla" :type="showConfirmationPassword ? 'text' : 'password'" :counter="12" class="mb-2" :hint="v$.credentials.password_confirmation.$errors ? errorUtils.parseErrors(v$.credentials.password_confirmation.$errors) : null" :class="{ error: v$.credentials.password_confirmation.$errors.length }" :append-icon="showConfirmationPassword ? 'mdi-eye' : 'mdi-eye-off'" @click:append="showConfirmationPassword = !showConfirmationPassword" />
|
||||
|
||||
<div class="d-flex flex-column">
|
||||
<v-btn class="button" color="#7F39FB" @click="submit()">Change password</v-btn>
|
||||
<v-btn class="button" color="#7F39FB" @click.prevent="submit()">Change password</v-btn>
|
||||
</div>
|
||||
</v-form>
|
||||
</template>
|
||||
@@ -20,11 +20,23 @@ import { required, email, integer, minLength, maxLength, sameAs } from '@vuelida
|
||||
import errorUtils from '@/plugins/lib@auth/_utils/error.utils'
|
||||
|
||||
export default {
|
||||
props: {
|
||||
navigateToAfterPasswordReset: {
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
errorUtils,
|
||||
v$: useVuelidate(),
|
||||
form: {},
|
||||
credentials: {
|
||||
code: '',
|
||||
email: '',
|
||||
password: '',
|
||||
password_confirmation: ''
|
||||
},
|
||||
showPassword: false,
|
||||
showConfirmationPassword: false
|
||||
}
|
||||
@@ -32,7 +44,7 @@ export default {
|
||||
|
||||
validations() {
|
||||
return {
|
||||
form: {
|
||||
credentials: {
|
||||
code: { required, integer, minLength: minLength(6), maxLength: maxLength(6) },
|
||||
email: { required, email },
|
||||
password: { required, minLength: minLength(12) },
|
||||
@@ -41,12 +53,17 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
created() {
|
||||
this.credentials.email = new URLSearchParams(window.location.search.substring(1).get('email'))
|
||||
this.credentials.code = new URLSearchParams(window.location.search.substring(1).get('code'))
|
||||
},
|
||||
|
||||
methods: {
|
||||
async submit() {
|
||||
if (!(await this.v$.$validate())) return
|
||||
|
||||
try {
|
||||
await this.$axios.post_data('v1/auth/reset', this.form)
|
||||
await this.$store.dispatch('auth/resetPassword', this.credentials)
|
||||
this.$router.push({ name: 'Login' })
|
||||
} catch (error) {
|
||||
this.$toast.error(error)
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<h1>Reset password</h1>
|
||||
<p class="mb-10">We have sent you a confirmation code on your email. You can insert him or continue with link in your email</p>
|
||||
|
||||
<A-reset-password-form />
|
||||
<A-reset-password-form navigate-to-after-password-reset="/auth/login" />
|
||||
</div>
|
||||
</v-container>
|
||||
</template>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<W-loadable :content="subtask" class="h-100">
|
||||
<v-card v-if="editMode" height="100%" class="d-flex flex-column scrolling">
|
||||
<div class="d-flex justify-space-between align-center modal-header">
|
||||
<h1>Upraviť task</h1>
|
||||
<h1>{{ subtask?.id ? 'Upraviť task' : 'Vytvoriť task' }}</h1>
|
||||
<v-icon @click.stop="closeModal()" icon="mdi-close" size="large"></v-icon>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ export default {
|
||||
// eslint-disable-next-line
|
||||
forgotPassword({commit}: {commit: any}, credentials: any) {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.post_auth_data('v1/auth/forgot', credentials)
|
||||
axios.post_auth_data('v1/users/forgot', credentials)
|
||||
.then(response => resolve(response))
|
||||
.catch(error => reject(error))
|
||||
})
|
||||
@@ -94,7 +94,7 @@ export default {
|
||||
// eslint-disable-next-line
|
||||
resetPassword({commit}: {commit: any}, credentials: any) {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.post_auth_data('v1/auth/reset', credentials)
|
||||
axios.post_auth_data('v1/users/reset', credentials)
|
||||
.then(response => resolve(response))
|
||||
.catch(error => reject(error))
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user