|
@@ -1,12 +1,12 @@
|
|
|
<template>
|
|
|
- <form-wrapper :title="$t('auth.forms.login')" :punchline="punchline" v-if="userCount === 1">
|
|
|
+ <form-wrapper :title="$t('auth.forms.login')" :punchline="punchline" v-if="username">
|
|
|
<div v-if="isDemo" 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-field :form="form" fieldName="email" inputType="email" :label="$t('auth.forms.email')" autofocus />
|
|
|
<form-field :form="form" fieldName="password" inputType="password" :label="$t('auth.forms.password')" />
|
|
|
<form-buttons :isBusy="form.isBusy" :caption="$t('auth.sign_in')" />
|
|
|
</form>
|
|
|
- <p v-if="userCount === 0 ">{{ $t('auth.forms.dont_have_account_yet') }} <router-link :to="{ name: 'register' }" class="is-link">{{ $t('auth.register') }}</router-link></p>
|
|
|
+ <p v-if=" !username ">{{ $t('auth.forms.dont_have_account_yet') }} <router-link :to="{ name: 'register' }" class="is-link">{{ $t('auth.register') }}</router-link></p>
|
|
|
<p>{{ $t('auth.forms.forgot_your_password') }} <router-link :to="{ name: 'password.request' }" class="is-link">{{ $t('auth.forms.request_password_reset') }}</router-link></p>
|
|
|
</form-wrapper>
|
|
|
</template>
|
|
@@ -18,9 +18,7 @@
|
|
|
export default {
|
|
|
data(){
|
|
|
return {
|
|
|
-
|
|
|
- userCount: null,
|
|
|
- username: '',
|
|
|
+ username: null,
|
|
|
isDemo: this.$root.appSettings.isDemoApp,
|
|
|
form: new Form({
|
|
|
email: '',
|
|
@@ -70,11 +68,10 @@
|
|
|
next(async vm => {
|
|
|
const { data } = await vm.axios.post('api/checkuser')
|
|
|
|
|
|
- if( data.userCount === 0 ) {
|
|
|
+ if( !data.username ) {
|
|
|
return next({ name: 'register' });
|
|
|
}
|
|
|
else {
|
|
|
- vm.userCount = data.userCount
|
|
|
vm.username = data.username
|
|
|
}
|
|
|
});
|