mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 14:29:34 +00:00
[Forgot, reset] Connected to BE
This commit is contained in:
1 parent
850b400a8c
commit
04774b0fb3
6 files changed
+10
-24
No files matched your search
@@ -110,8 +110,6 @@ export default class DateUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getWeek (date) {
|
getWeek (date) {
|
||||||
console.log(date)
|
|
||||||
console.log('kokot')
|
|
||||||
const d = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()))
|
const d = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()))
|
||||||
const dayNum = d.getUTCDay() || 7
|
const dayNum = d.getUTCDay() || 7
|
||||||
d.setUTCDate(d.getUTCDate() + 4 - dayNum)
|
d.setUTCDate(d.getUTCDate() + 4 - dayNum)
|
||||||
|
|||||||
@@ -45,7 +45,8 @@ export default {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
await this.$store.dispatch('auth/forgotPassword', this.credentials)
|
await this.$store.dispatch('auth/forgotPassword', this.credentials)
|
||||||
this.$router.push(`${this.navigateToAfterForgotPassword}?email=${this.credentials.email}`)
|
this.$router.push({name: 'Reset password', query: {email: this.credentials.email}})
|
||||||
|
this.$toast.success('Reset code has been sent to your email.')
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.$toast.error(error)
|
this.$toast.error(error)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<v-form @keydown.enter="submit()">
|
<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="credentials.token" label="Token" autocomplete="one-time-token" bg-color="white" variant="solo" type="number" class="mb-2" :hint="v$.credentials.token.$errors ? errorUtils.parseErrors(v$.credentials.token.$errors) : null" :counter="6" :class="{ error: v$.credentials.token.$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="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 }" />
|
||||||
|
|
||||||
@@ -32,10 +32,8 @@ export default {
|
|||||||
errorUtils,
|
errorUtils,
|
||||||
v$: useVuelidate(),
|
v$: useVuelidate(),
|
||||||
credentials: {
|
credentials: {
|
||||||
code: '',
|
token: this.$route.query.token,
|
||||||
email: '',
|
email: this.$route.query.email
|
||||||
password: '',
|
|
||||||
password_confirmation: ''
|
|
||||||
},
|
},
|
||||||
showPassword: false,
|
showPassword: false,
|
||||||
showConfirmationPassword: false
|
showConfirmationPassword: false
|
||||||
@@ -45,19 +43,14 @@ export default {
|
|||||||
validations() {
|
validations() {
|
||||||
return {
|
return {
|
||||||
credentials: {
|
credentials: {
|
||||||
code: { required, integer, minLength: minLength(6), maxLength: maxLength(6) },
|
token: { required },
|
||||||
email: { required, email },
|
email: { required, email },
|
||||||
password: { required, minLength: minLength(12) },
|
password: { required, minLength: minLength(12) },
|
||||||
password_confirmation: { required, minLength: minLength(12), sameAs: sameAs(this.form.password)}
|
password_confirmation: { required, minLength: minLength(12), sameAs: sameAs(this.credentials.password)}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
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: {
|
methods: {
|
||||||
async submit() {
|
async submit() {
|
||||||
if (!(await this.v$.$validate())) return
|
if (!(await this.v$.$validate())) return
|
||||||
@@ -65,6 +58,7 @@ export default {
|
|||||||
try {
|
try {
|
||||||
await this.$store.dispatch('auth/resetPassword', this.credentials)
|
await this.$store.dispatch('auth/resetPassword', this.credentials)
|
||||||
this.$router.push({ name: 'Login' })
|
this.$router.push({ name: 'Login' })
|
||||||
|
this.$toast.success('Your password has been successfully changed.')
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.$toast.error(error)
|
this.$toast.error(error)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,10 +78,6 @@ export default {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
console.log(blockers)
|
|
||||||
|
|
||||||
return blockers
|
return blockers
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -121,8 +117,6 @@ export default {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(events)
|
|
||||||
|
|
||||||
return events
|
return events
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -125,7 +125,6 @@ export default {
|
|||||||
this.config.date = this.filter.start
|
this.config.date = this.filter.start
|
||||||
this.subtasks = [...subtasks, ...blockers.map(blocker => ({...blocker, type: 'blocker'}))]
|
this.subtasks = [...subtasks, ...blockers.map(blocker => ({...blocker, type: 'blocker'}))]
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
|
||||||
this.$toast.error('Nepodarilo sa nacitat data!')
|
this.$toast.error('Nepodarilo sa nacitat data!')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ export default {
|
|||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
forgotPassword({commit}: {commit: any}, credentials: any) {
|
forgotPassword({commit}: {commit: any}, credentials: any) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
axios.post_auth_data('v1/users/forgot', credentials)
|
axios.post('v1/users/forgot', {data: credentials})
|
||||||
.then(response => resolve(response))
|
.then(response => resolve(response))
|
||||||
.catch(error => reject(error))
|
.catch(error => reject(error))
|
||||||
})
|
})
|
||||||
@@ -94,7 +94,7 @@ export default {
|
|||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
resetPassword({commit}: {commit: any}, credentials: any) {
|
resetPassword({commit}: {commit: any}, credentials: any) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
axios.post_auth_data('v1/users/reset', credentials)
|
axios.post_auth_data('v1/users/reset', {data: credentials})
|
||||||
.then(response => resolve(response))
|
.then(response => resolve(response))
|
||||||
.catch(error => reject(error))
|
.catch(error => reject(error))
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in new issue
Block a user