Password reset update

This commit is contained in:
MakerLab-Dev
2020-12-03 19:04:50 +01:00
parent 69dcf1299b
commit 69c6c883c2
4 changed files with 14 additions and 68 deletions

View File

@ -48,16 +48,3 @@ export const logout = ({ state, commit }) => {
})
})
}
export const checkMail = ({ commit }, data) => {
return new Promise((resolve, reject) => {
window.axios
.post('/api/v1/is-registered', data)
.then((response) => {
resolve(response)
})
.catch((err) => {
reject(err)
})
})
}

View File

@ -20,19 +20,24 @@
</div>
</div>
<sw-button
v-if="!isSent"
:loading="isLoading"
:disabled="isLoading"
type="submit"
variant="primary"
>
{{ $t('validation.send_reset_link') }}
</sw-button>
<sw-button v-else :disabled="isLoading" variant="primary" type="submit">
{{ $t('validation.not_yet') }}
<div v-if="!isSent">
{{ $t('validation.send_reset_link') }}
</div>
<div v-else>
{{ $t('validation.not_yet') }}
</div>
</sw-button>
<div class="mt-4 mb-4 text-sm">
<router-link to="/login">
<router-link
to="/login"
class="text-sm text-primary-400 hover:text-gray-700"
>
{{ $t('general.back_to_login') }}
</router-link>
</div>
@ -52,7 +57,6 @@ export default {
},
isSent: false,
isLoading: false,
isRegisteredUser: false,
}
},
validations: {
@ -64,14 +68,9 @@ export default {
},
},
methods: {
...mapActions('auth', ['checkMail']),
...mapActions('auth'),
async validateBeforeSubmit(e) {
this.$v.formData.$touch()
let { data } = await this.checkMail()
if (data === false) {
toastr['error'](this.$t('validation.email_does_not_exist'))
return
}
if (!this.$v.formData.$invalid) {
try {
this.isLoading = true
@ -87,19 +86,10 @@ export default {
this.isSent = true
this.isLoading = false
} catch (err) {
if (err.response && err.response.status === 403) {
toastr['error'](err.response.data, 'Error')
}
this.isLoading = false
}
}
},
// async checkMail() {
// let response = await window.axios.post(
// '/api/v1/is-registered',
// this.formData
// )
// return response.data
// },
},
}
</script>