mirror of
https://github.com/Bubka/2FAuth.git
synced 2024-11-23 08:43:19 +01:00
Replace modal by notification in case of already registered user alert
This commit is contained in:
parent
719c02e625
commit
960faa7c2d
@ -5,7 +5,7 @@
|
||||
<form-field :form="form" fieldName="email" inputType="email" :label="$t('auth.forms.email')" />
|
||||
<form-field :form="form" fieldName="password" inputType="password" :label="$t('auth.forms.password')" />
|
||||
<form-field :form="form" fieldName="password_confirmation" inputType="password" :label="$t('auth.forms.confirm_password')" />
|
||||
<form-buttons :isBusy="form.isBusy" :caption="$t('auth.register')" />
|
||||
<form-buttons :isBusy="form.isBusy" :isDisabled="form.isDisabled" :caption="$t('auth.register')" />
|
||||
</form>
|
||||
<p>{{ $t('auth.forms.already_register') }} <router-link :to="{ name: 'login' }" class="is-link">{{ $t('auth.sign_in') }}</router-link></p>
|
||||
</form-wrapper>
|
||||
@ -29,17 +29,6 @@
|
||||
}
|
||||
},
|
||||
|
||||
async created() {
|
||||
// we check if a user account already exists
|
||||
const { data } = await this.axios.post('api/checkuser')
|
||||
|
||||
if( data.userCount > 0 ) {
|
||||
this.fail = this.$t('errors.already_one_user_registered') + ' ' + this.$t('errors.cannot_register_more_user')
|
||||
this.$router.push({ name: 'flooded' });
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
methods : {
|
||||
async handleSubmit(e) {
|
||||
e.preventDefault()
|
||||
@ -63,7 +52,14 @@
|
||||
return next('/');
|
||||
}
|
||||
|
||||
next();
|
||||
next(async vm => {
|
||||
const { data } = await vm.axios.post('api/checkuser')
|
||||
|
||||
if( data.userCount > 0 ) {
|
||||
vm.form.isDisabled = true
|
||||
vm.fail = vm.$t('errors.already_one_user_registered') + ' ' + vm.$t('errors.cannot_register_more_user')
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user