mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-06-19 19:28:08 +02:00
Fix missing notifications in Auth views
This commit is contained in:
parent
06d5c62e8d
commit
6b0d605d01
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<form-wrapper :title="$t('auth.forms.login')" :fail="fail" :success="success">
|
<form-wrapper :title="$t('auth.forms.login')">
|
||||||
<div v-if="$root.appSettings.isDemoApp" class="notification is-info has-text-centered" v-html="$t('auth.forms.welcome_to_demo_app_use_those_credentials')" />
|
<div v-if="$root.appSettings.isDemoApp" class="notification is-info has-text-centered" v-html="$t('auth.forms.welcome_to_demo_app_use_those_credentials')" />
|
||||||
<form @submit.prevent="handleSubmit" @keydown="form.onKeydown($event)">
|
<form @submit.prevent="handleSubmit" @keydown="form.onKeydown($event)">
|
||||||
<form-field :form="form" fieldName="email" inputType="email" :label="$t('auth.forms.email')" autofocus />
|
<form-field :form="form" fieldName="email" inputType="email" :label="$t('auth.forms.email')" autofocus />
|
||||||
@ -18,8 +18,6 @@
|
|||||||
export default {
|
export default {
|
||||||
data(){
|
data(){
|
||||||
return {
|
return {
|
||||||
success: '',
|
|
||||||
fail: '',
|
|
||||||
form: new Form({
|
form: new Form({
|
||||||
email: '',
|
email: '',
|
||||||
password: ''
|
password: ''
|
||||||
@ -42,9 +40,11 @@
|
|||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
if( error.response.status === 401 ) {
|
if( error.response.status === 401 ) {
|
||||||
this.fail = this.$t('auth.forms.password_do_not_match')
|
|
||||||
|
this.$notify({ type: 'is-danger', text: this.$t('auth.forms.password_do_not_match'), duration:-1 })
|
||||||
}
|
}
|
||||||
else if( error.response.status !== 422 ) {
|
else if( error.response.status !== 422 ) {
|
||||||
|
|
||||||
this.$router.push({ name: 'genericError', params: { err: error.response } });
|
this.$router.push({ name: 'genericError', params: { err: error.response } });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -58,6 +58,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
next();
|
next();
|
||||||
|
},
|
||||||
|
|
||||||
|
beforeRouteLeave (to, from, next) {
|
||||||
|
this.$notify({
|
||||||
|
clean: true
|
||||||
|
})
|
||||||
|
|
||||||
|
next()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<form-wrapper :title="$t('auth.register')" :fail="fail" :success="success">
|
<form-wrapper :title="$t('auth.register')">
|
||||||
<form @submit.prevent="handleSubmit" @keydown="form.onKeydown($event)">
|
<form @submit.prevent="handleSubmit" @keydown="form.onKeydown($event)">
|
||||||
<form-field :form="form" fieldName="name" inputType="text" :label="$t('auth.forms.name')" autofocus />
|
<form-field :form="form" fieldName="name" inputType="text" :label="$t('auth.forms.name')" autofocus />
|
||||||
<form-field :form="form" fieldName="email" inputType="email" :label="$t('auth.forms.email')" />
|
<form-field :form="form" fieldName="email" inputType="email" :label="$t('auth.forms.email')" />
|
||||||
@ -18,8 +18,6 @@
|
|||||||
export default {
|
export default {
|
||||||
data(){
|
data(){
|
||||||
return {
|
return {
|
||||||
success: '',
|
|
||||||
fail: '',
|
|
||||||
form: new Form({
|
form: new Form({
|
||||||
name : '',
|
name : '',
|
||||||
email : '',
|
email : '',
|
||||||
@ -57,9 +55,18 @@
|
|||||||
|
|
||||||
if( data.userCount > 0 ) {
|
if( data.userCount > 0 ) {
|
||||||
vm.form.isDisabled = true
|
vm.form.isDisabled = true
|
||||||
vm.fail = vm.$t('errors.already_one_user_registered') + ' ' + vm.$t('errors.cannot_register_more_user')
|
|
||||||
|
vm.$notify({ type: 'is-danger', text: vm.$t('errors.already_one_user_registered') + ' ' + vm.$t('errors.cannot_register_more_user'), duration:-1 })
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
beforeRouteLeave (to, from, next) {
|
||||||
|
this.$notify({
|
||||||
|
clean: true
|
||||||
|
})
|
||||||
|
|
||||||
|
next()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<form-wrapper :title="$t('auth.forms.reset_password')" :fail="fail" :success="success">
|
<form-wrapper :title="$t('auth.forms.reset_password')">
|
||||||
<form @submit.prevent="handleSubmit" @keydown="form.onKeydown($event)">
|
<form @submit.prevent="handleSubmit" @keydown="form.onKeydown($event)">
|
||||||
<form-field :form="form" fieldName="email" inputType="email" :label="$t('auth.forms.email')" autofocus />
|
<form-field :form="form" fieldName="email" inputType="email" :label="$t('auth.forms.email')" autofocus />
|
||||||
<form-buttons :isBusy="form.isBusy" :caption="$t('auth.forms.send_password_reset_link')" :showCancelButton="true" cancelLandingView="login" />
|
<form-buttons :isBusy="form.isBusy" :caption="$t('auth.forms.send_password_reset_link')" :showCancelButton="true" cancelLandingView="login" />
|
||||||
@ -14,8 +14,6 @@
|
|||||||
export default {
|
export default {
|
||||||
data(){
|
data(){
|
||||||
return {
|
return {
|
||||||
success: '',
|
|
||||||
fail: '',
|
|
||||||
form: new Form({
|
form: new Form({
|
||||||
email: '',
|
email: '',
|
||||||
})
|
})
|
||||||
@ -27,19 +25,29 @@
|
|||||||
|
|
||||||
this.form.post('/api/password/email', {returnError: true})
|
this.form.post('/api/password/email', {returnError: true})
|
||||||
.then(response => {
|
.then(response => {
|
||||||
|
|
||||||
this.success = response.data.status
|
this.$notify({ type: 'is-success', text: response.data.status, duration:-1 })
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
if( error.response.data.requestFailed ) {
|
if( error.response.data.requestFailed ) {
|
||||||
this.fail = error.response.data.requestFailed
|
|
||||||
|
this.$notify({ type: 'is-danger', text: error.response.data.requestFailed, duration:-1 })
|
||||||
}
|
}
|
||||||
else if( error.response.status !== 422 ) {
|
else if( error.response.status !== 422 ) {
|
||||||
|
|
||||||
this.$router.push({ name: 'genericError', params: { err: error.response } });
|
this.$router.push({ name: 'genericError', params: { err: error.response } });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
beforeRouteLeave (to, from, next) {
|
||||||
|
this.$notify({
|
||||||
|
clean: true
|
||||||
|
})
|
||||||
|
|
||||||
|
next()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<form-wrapper :title="$t('auth.forms.new_password')" :fail="fail" :success="success">
|
<form-wrapper :title="$t('auth.forms.new_password')">
|
||||||
<form @submit.prevent="handleSubmit" @keydown="form.onKeydown($event)">
|
<form @submit.prevent="handleSubmit" @keydown="form.onKeydown($event)">
|
||||||
<form-field :form="form" fieldName="email" inputType="email" :label="$t('auth.forms.email')" disabled readonly />
|
<form-field :form="form" fieldName="email" inputType="email" :label="$t('auth.forms.email')" disabled readonly />
|
||||||
<form-field :form="form" fieldName="password" inputType="password" :label="$t('auth.forms.new_password')" />
|
<form-field :form="form" fieldName="password" inputType="password" :label="$t('auth.forms.new_password')" />
|
||||||
@ -39,17 +39,27 @@
|
|||||||
this.form.post('/api/password/reset', {returnError: true})
|
this.form.post('/api/password/reset', {returnError: true})
|
||||||
.then(response => {
|
.then(response => {
|
||||||
|
|
||||||
this.success = response.data.status
|
this.$notify({ type: 'is-success', text: response.data.status, duration:-1 })
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
if( error.response.data.resetFailed ) {
|
if( error.response.data.resetFailed ) {
|
||||||
this.fail = error.response.data.resetFailed
|
|
||||||
|
this.$notify({ type: 'is-danger', text: error.response.data.resetFailed, duration:-1 })
|
||||||
}
|
}
|
||||||
else if( error.response.status !== 422 ) {
|
else if( error.response.status !== 422 ) {
|
||||||
|
|
||||||
this.$router.push({ name: 'genericError', params: { err: error.response } });
|
this.$router.push({ name: 'genericError', params: { err: error.response } });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
beforeRouteLeave (to, from, next) {
|
||||||
|
this.$notify({
|
||||||
|
clean: true
|
||||||
|
})
|
||||||
|
|
||||||
|
next()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
Loading…
x
Reference in New Issue
Block a user