mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-18 16:22:14 +00:00
sing in forms refactoring
This commit is contained in:
@@ -8,8 +8,7 @@
|
||||
:description="$t('page_create_password.subtitle')"
|
||||
/>
|
||||
|
||||
<ValidationObserver @submit.prevent="createNewPassword" ref="create_new_password" v-slot="{ invalid }"
|
||||
tag="form" class="form block-form create-new-password">
|
||||
<ValidationObserver @submit.prevent="createNewPassword" ref="create_new_password" v-slot="{ invalid }" tag="form" class="form block-form create-new-password">
|
||||
|
||||
<div class="block-wrapper">
|
||||
<label>{{ $t('page_create_password.label_email') }}:</label>
|
||||
|
||||
@@ -8,36 +8,33 @@
|
||||
:description="$t('page_forgotten_password.subtitle')"
|
||||
/>
|
||||
|
||||
<ValidationObserver @submit.prevent="forgottenPassword" ref="forgotten_password" v-slot="{ invalid }"
|
||||
tag="form" class="form inline-form">
|
||||
<ValidationProvider tag="div" mode="passive" class="input-wrapper mr-4" name="E-Mail" rules="required"
|
||||
v-slot="{ errors }">
|
||||
<input v-model="recoverEmail" :placeholder="$t('page_login.placeholder_email')" type="email"
|
||||
class="focus-border-theme"
|
||||
:class="{'border-red': errors[0]}"/>
|
||||
<span class="error-message" v-if="errors[0]">{{ errors[0] }}</span>
|
||||
<ValidationObserver @submit.prevent="forgottenPassword" ref="forgotten_password" v-slot="{ invalid }" tag="form" class="md:flex items-start md:space-x-4 md:space-y-0 space-y-4 mb-12">
|
||||
<ValidationProvider tag="div" mode="passive" class="w-full text-left relative" name="E-Mail" rules="required" v-slot="{ errors }">
|
||||
<input v-model="recoverEmail" :placeholder="$t('page_login.placeholder_email')" type="email" class="font-bold px-5 py-3.5 dark:bg-2x-dark-foreground bg-light-background w-full rounded-lg focus-border-theme appearance-none border border-transparent" :class="{'border-red': errors[0]}"/>
|
||||
<span class="text-red-600 text-xs text-left" v-if="errors[0]">{{ errors[0] }}</span>
|
||||
</ValidationProvider>
|
||||
|
||||
<AuthButton icon="chevron-right" :text="$t('page_forgotten_password.button_get_link')" :loading="isLoading" :disabled="isLoading"/>
|
||||
<AuthButton class="md:w-min w-full justify-center" icon="chevron-right" :text="$t('page_forgotten_password.button_get_link')" :loading="isLoading" :disabled="isLoading"/>
|
||||
</ValidationObserver>
|
||||
|
||||
<span class="additional-link">{{ $t('page_forgotten_password.password_remember_text') }}
|
||||
<router-link :to="{name: 'SignIn'}" class="text-theme">
|
||||
<span class="block">
|
||||
{{ $t('page_forgotten_password.password_remember_text') }}
|
||||
<router-link :to="{name: 'SignIn'}" class="font-bold text-theme">
|
||||
{{ $t('page_forgotten_password.password_remember_button') }}
|
||||
</router-link>
|
||||
</span>
|
||||
</AuthContent>
|
||||
|
||||
<!--Password reset link sended-->
|
||||
<!--Password reset link send-->
|
||||
<AuthContent name="password-reset-link-sended" :visible="false">
|
||||
<img v-if="config.app_logo" class="logo mx-auto" :src="$getImage(config.app_logo)" :alt="config.app_name">
|
||||
<b v-if="! config.app_logo" class="auth-logo-text">{{ config.app_name }}</b>
|
||||
<Headline
|
||||
:title="$t('page_forgotten_password.pass_sennded_title')"
|
||||
:description="$t('page_forgotten_password.pass_sennded_subtitle')"
|
||||
/>
|
||||
|
||||
<h1>{{ $t('page_forgotten_password.pass_sennded_title') }}</h1>
|
||||
<h2>{{ $t('page_forgotten_password.pass_sennded_subtitle') }}</h2>
|
||||
|
||||
<span class="additional-link">{{ $t('page_forgotten_password.password_remember_text') }}
|
||||
<router-link :to="{name: 'SignIn'}" class="text-theme">
|
||||
<span class="block">
|
||||
{{ $t('page_forgotten_password.password_remember_text') }}
|
||||
<router-link :to="{name: 'SignIn'}" class="font-bold text-theme">
|
||||
{{ $t('page_forgotten_password.password_remember_button') }}
|
||||
</router-link>
|
||||
</span>
|
||||
@@ -46,8 +43,8 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AuthContentWrapper from '/resources/js/components/Auth/AuthContentWrapper'
|
||||
import {ValidationProvider, ValidationObserver} from 'vee-validate/dist/vee-validate.full'
|
||||
import AuthContentWrapper from '/resources/js/components/Auth/AuthContentWrapper'
|
||||
import AuthContent from '/resources/js/components/Auth/AuthContent'
|
||||
import AuthButton from '/resources/js/components/Auth/AuthButton'
|
||||
import {required} from 'vee-validate/dist/rules'
|
||||
@@ -67,7 +64,9 @@
|
||||
Headline,
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['config']),
|
||||
...mapGetters([
|
||||
'config',
|
||||
]),
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -77,7 +76,6 @@
|
||||
},
|
||||
methods: {
|
||||
goToAuthPage(slug) {
|
||||
|
||||
this.$refs.auth.$children.forEach(page => {
|
||||
|
||||
// Hide current step
|
||||
@@ -107,27 +105,16 @@
|
||||
})
|
||||
.then(() => {
|
||||
|
||||
// End loading
|
||||
this.isLoading = false
|
||||
|
||||
this.goToAuthPage('password-reset-link-sended')
|
||||
}).catch(error => {
|
||||
|
||||
if (error.response.status == 422) {
|
||||
if (error.response.status === 422) {
|
||||
this.$refs.forgotten_password.setErrors({
|
||||
'E-Mail': error.response.data.message
|
||||
});
|
||||
}
|
||||
|
||||
// End loading
|
||||
this.isLoading = false
|
||||
})
|
||||
}).finally(() => this.isLoading = false)
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@import '/resources/sass/vuefilemanager/_auth-form';
|
||||
@import '/resources/sass/vuefilemanager/_auth';
|
||||
</style>
|
||||
|
||||
@@ -1,78 +1,42 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="mb-14">
|
||||
<!--Custom content-->
|
||||
<slot></slot>
|
||||
|
||||
<!--Default application logo-->
|
||||
<div v-if="! $slots.default">
|
||||
<img v-if="config.app_logo" class="logo mx-auto" :src="$getImage(config.app_logo)" :alt="config.app_name">
|
||||
<b v-if="! config.app_logo" class="auth-logo-text">{{ config.app_name }}</b>
|
||||
|
||||
<!--Image logo-->
|
||||
<img v-if="config.app_logo" class="md:w-32 w-28 mb-6 mx-auto" :src="$getImage(config.app_logo)" :alt="config.app_name">
|
||||
|
||||
<!--Text logo if image isn't available-->
|
||||
<b v-if="! config.app_logo" class="font-bold text-xl mb-10 block">
|
||||
{{ config.app_name }}
|
||||
</b>
|
||||
</div>
|
||||
|
||||
<h1>{{ title }}</h1>
|
||||
<h2>{{ description }}</h2>
|
||||
<h1 class="md:text-4xl text-3xl font-extrabold mb-0.5">
|
||||
{{ title }}
|
||||
</h1>
|
||||
|
||||
<h2 class="md:text-2xl text-xl font-normal">
|
||||
{{ description }}
|
||||
</h2>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import {mapGetters} from "vuex";
|
||||
import {mapGetters} from "vuex";
|
||||
|
||||
export default {
|
||||
name: 'Headline',
|
||||
props: [
|
||||
'description',
|
||||
'title',
|
||||
],
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'config',
|
||||
])
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
@import '/resources/sass/vuefilemanager/_variables';
|
||||
@import '/resources/sass/vuefilemanager/_mixins';
|
||||
|
||||
.logo {
|
||||
width: 120px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
@include font-size(34);
|
||||
font-weight: 800;
|
||||
line-height: 1.2;
|
||||
margin-bottom: 2px;
|
||||
color: $text;
|
||||
}
|
||||
|
||||
h2 {
|
||||
@include font-size(23);
|
||||
font-weight: 500;
|
||||
margin-bottom: 50px;
|
||||
color: $text;
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 690px) {
|
||||
|
||||
h1 {
|
||||
@include font-size(30);
|
||||
}
|
||||
|
||||
h2 {
|
||||
@include font-size(21);
|
||||
export default {
|
||||
name: 'Headline',
|
||||
props: [
|
||||
'description',
|
||||
'title',
|
||||
],
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'config',
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 490px) {
|
||||
|
||||
h1 {
|
||||
@include font-size(22);
|
||||
}
|
||||
|
||||
h2 {
|
||||
@include font-size(18);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</script>
|
||||
@@ -8,144 +8,125 @@
|
||||
:description="$t('page_login.subtitle')"
|
||||
/>
|
||||
|
||||
<ValidationObserver @submit.prevent="logIn" ref="log_in" v-slot="{ invalid }" tag="form"
|
||||
class="form inline-form">
|
||||
<ValidationProvider tag="div" mode="passive" class="input-wrapper mr-4" name="E-Mail" rules="required"
|
||||
v-slot="{ errors }">
|
||||
<input v-model="loginEmail" :placeholder="$t('page_login.placeholder_email')" type="email"
|
||||
class="focus-border-theme"
|
||||
:class="{'border-red': errors[0]}" />
|
||||
<span class="error-message" v-if="errors[0]">{{ errors[0] }}</span>
|
||||
<ValidationObserver @submit.prevent="logIn" ref="log_in" v-slot="{ invalid }" tag="form" class="md:flex items-start md:space-x-4 md:space-y-0 space-y-4 mb-12">
|
||||
<ValidationProvider class="w-full text-left relative" tag="div" mode="passive" name="E-Mail" rules="required" v-slot="{ errors }">
|
||||
<input class="font-bold px-5 py-3.5 dark:bg-2x-dark-foreground bg-light-background w-full rounded-lg focus-border-theme appearance-none border border-transparent" :class="{'border-red': errors[0]}" v-model="loginEmail" :placeholder="$t('page_login.placeholder_email')" type="email" />
|
||||
<span class="text-red-600 text-xs text-left" v-if="errors[0]">{{ errors[0] }}</span>
|
||||
</ValidationProvider>
|
||||
|
||||
<AuthButton icon="chevron-right" :text="$t('page_login.button_next')" :loading="isLoading"
|
||||
:disabled="isLoading" />
|
||||
<AuthButton class="md:w-min w-full justify-center" icon="chevron-right" :text="$t('page_login.button_next')" :loading="isLoading" :disabled="isLoading" />
|
||||
</ValidationObserver>
|
||||
|
||||
<SocialiteAuthenticationButtons/>
|
||||
<SocialiteAuthenticationButtons />
|
||||
|
||||
<span v-if="config.userRegistration" class="additional-link">
|
||||
<span v-if="config.userRegistration" class="block">
|
||||
{{ $t('page_login.registration_text') }}
|
||||
<router-link class="text-theme" :to="{name: 'SignUp'}">
|
||||
<router-link class="font-bold text-theme" :to="{name: 'SignUp'}">
|
||||
{{ $t('page_login.registration_button') }}
|
||||
</router-link>
|
||||
</span>
|
||||
</AuthContent>
|
||||
|
||||
<!--Log in By Password-->
|
||||
<!--Log in By Password-->
|
||||
<AuthContent name="sign-in" :visible="false">
|
||||
<Headline
|
||||
v-if="checkedAccount"
|
||||
:title="$t('page_sign_in.title', {name: checkedAccount.name})"
|
||||
:description="$t('page_sign_in.subtitle')"
|
||||
>
|
||||
<img class="user-avatar mx-auto rounded-xl w-28 mb-6 shadow-xl" :src="checkedAccount.avatar.md" :alt="checkedAccount.name">
|
||||
</Headline>
|
||||
|
||||
<div class="user" v-if="checkedAccount">
|
||||
<img class="user-avatar mx-auto" :src="checkedAccount.avatar.md" :alt="checkedAccount.name">
|
||||
<h1>{{ $t('page_sign_in.title', {name: checkedAccount.name}) }}</h1>
|
||||
<h2>{{ $t('page_sign_in.subtitle') }}:</h2>
|
||||
</div>
|
||||
|
||||
<ValidationObserver @submit.prevent="singIn" ref="sign_in" v-slot="{ invalid }" tag="form"
|
||||
class="form inline-form">
|
||||
<ValidationProvider tag="div" mode="passive" class="input-wrapper mr-4" name="User Password" rules="required"
|
||||
v-slot="{ errors }">
|
||||
<input v-model="loginPassword" :placeholder="$t('page_sign_in.placeholder_password')"
|
||||
type="password"
|
||||
class="focus-border-theme"
|
||||
:class="{'border-red': errors[0]}" />
|
||||
<span class="error-message" v-if="errors[0]">{{ errors[0] }}</span>
|
||||
<ValidationObserver @submit.prevent="singIn" ref="sign_in" v-slot="{ invalid }" tag="form" class="md:flex items-start md:space-x-4 md:space-y-0 space-y-4 mb-12">
|
||||
<ValidationProvider tag="div" mode="passive" class="w-full text-left" name="User Password" rules="required" v-slot="{ errors }">
|
||||
<input v-model="loginPassword" :placeholder="$t('page_sign_in.placeholder_password')" type="password" class="font-bold px-5 py-3.5 dark:bg-2x-dark-foreground bg-light-background w-full h-full rounded-lg focus-border-theme appearance-none border border-transparent" :class="{'border-red': errors[0]}" />
|
||||
<span class="text-red-600 text-xs text-left" v-if="errors[0]">{{ errors[0] }}</span>
|
||||
</ValidationProvider>
|
||||
|
||||
<AuthButton icon="chevron-right" :text="$t('page_sign_in.button_log_in')" :loading="isLoading"
|
||||
:disabled="isLoading" />
|
||||
<AuthButton class="md:w-min w-full justify-center" icon="chevron-right" :text="$t('page_sign_in.button_log_in')" :loading="isLoading" :disabled="isLoading" />
|
||||
</ValidationObserver>
|
||||
|
||||
<span class="additional-link">{{ $t('page_sign_in.password_reset_text') }}
|
||||
<router-link :to="{name: 'ForgottenPassword'}" class="text-theme">
|
||||
<span class="block">
|
||||
{{ $t('page_sign_in.password_reset_text') }}
|
||||
<router-link :to="{name: 'ForgottenPassword'}" class="font-bold text-theme">
|
||||
{{ $t('page_sign_in.password_reset_button') }}
|
||||
</router-link>
|
||||
</span>
|
||||
</AuthContent>
|
||||
|
||||
<!--Resend verification email-->
|
||||
<AuthContent name="not-verified" :visible="false">
|
||||
<Headline
|
||||
v-if="checkedAccount"
|
||||
:title="$t('page_sign_in_2fa_title', {name: checkedAccount.name})"
|
||||
:description="$t('page_not_verified.subtitle')"
|
||||
>
|
||||
<img class="user-avatar mx-auto rounded-xl w-28 mb-6 shadow-xl" :src="checkedAccount.avatar.md" :alt="checkedAccount.name">
|
||||
</Headline>
|
||||
|
||||
<div class="user" v-if="checkedAccount">
|
||||
<img class="user-avatar" :src="checkedAccount.avatar.md" :alt="checkedAccount.name">
|
||||
<h1>{{ checkedAccount.name }}</h1>
|
||||
<h2>{{ $t('page_not_verified.subtitle') }}</h2>
|
||||
</div>
|
||||
|
||||
<span class="additional-link"> {{ $t('page_not_verified.resend_text') }}
|
||||
<a @click="resendEmail" class="text-theme">{{ $t('page_not_verified.resend_button') }} </a>
|
||||
<span class="block">
|
||||
{{ $t('page_not_verified.resend_text') }}
|
||||
<b @click="resendEmail" class="text-theme cursor-pointer">
|
||||
{{ $t('page_not_verified.resend_button') }}
|
||||
</b>
|
||||
</span>
|
||||
</AuthContent>
|
||||
|
||||
<!-- Log in by 2fa -->
|
||||
<!-- Log in by 2fa -->
|
||||
<AuthContent name="two-factor-authentication" :visible="false">
|
||||
<Headline
|
||||
v-if="checkedAccount"
|
||||
:title="$t('page_sign_in_2fa_title', {name: checkedAccount.name})"
|
||||
:description="$t('page_sign_in_2fa_subtitle')"
|
||||
>
|
||||
<img class="user-avatar mx-auto rounded-xl w-28 mb-6 shadow-xl" :src="checkedAccount.avatar.md" :alt="checkedAccount.name">
|
||||
</Headline>
|
||||
|
||||
<div class="user" v-if="checkedAccount">
|
||||
<img class="user-avatar" :src="checkedAccount.avatar.md" :alt="checkedAccount.name">
|
||||
<h1> {{ $t('page_sign_in_2fa_title', {name: checkedAccount.name}) }} </h1>
|
||||
<h2> {{ $t('page_sign_in_2fa_subtitle') }}:</h2>
|
||||
</div>
|
||||
|
||||
<ValidationObserver ref="two_factor_authentication" v-slot="{ invalid }" tag="form"
|
||||
class="form inline-form">
|
||||
<ValidationProvider tag="div" mode="passive" class="input-wrapper" name="Two Factor Authentication" rules="required"
|
||||
v-slot="{ errors }">
|
||||
<input v-model="twoFactorCode" :placeholder="$t('page_sign_in.placeholder_2fa')"
|
||||
@input="twoFactorChallenge(false)"
|
||||
type="text"
|
||||
maxlength="6"
|
||||
class="focus-border-theme"
|
||||
:class="{'border-red': errors[0]}" />
|
||||
<span class="error-message" v-if="errors[0]">{{ errors[0] }}</span>
|
||||
<ValidationObserver ref="two_factor_authentication" v-slot="{ invalid }" tag="form" class="mb-12">
|
||||
<ValidationProvider tag="div" mode="passive" class="mx-auto" name="Two Factor Authentication" rules="required" v-slot="{ errors }">
|
||||
<input v-model="twoFactorCode" ref="twoFactorCodeInput" :placeholder="$t('page_sign_in.placeholder_2fa')" @input="twoFactorChallenge(false)" type="text" maxlength="6" class="font-bold px-5 py-3.5 dark:bg-2x-dark-foreground bg-light-background text-center md:w-80 w-full h-full rounded-lg focus-border-theme appearance-none border border-transparent" :class="{'border-red': errors[0]}" />
|
||||
<span class="text-red-600 text-xs mt-2 text-center block" v-if="errors[0]">{{ errors[0] }}</span>
|
||||
</ValidationProvider>
|
||||
|
||||
</ValidationObserver>
|
||||
|
||||
<span class="additional-link"> {{ $t('page_sign_in.2fa_recovery_text') }}
|
||||
<a @click="goToAuthPage('two-factor-recovery')" class="text-theme">
|
||||
<span class="block">
|
||||
{{ $t('page_sign_in.2fa_recovery_text') }}
|
||||
<b @click="goToAuthPage('two-factor-recovery')" class="text-theme cursor-pointer cursor-pointer">
|
||||
{{ $t('page_sign_in.2fa_recovery_button') }}
|
||||
</a>
|
||||
</b>
|
||||
</span>
|
||||
|
||||
<div class="spinner-wrapper">
|
||||
<Spinner v-if="isLoading" class="spinner"/>
|
||||
<Spinner v-if="isLoading" class="spinner" />
|
||||
</div>
|
||||
|
||||
</AuthContent>
|
||||
|
||||
<!-- Log in by 2fa recovery code -->
|
||||
<!-- Log in by 2fa with recovery code -->
|
||||
<AuthContent name="two-factor-recovery" :visible="false">
|
||||
<Headline
|
||||
v-if="checkedAccount"
|
||||
:title="$t('page_sign_in_2fa_title', {name: checkedAccount.name})"
|
||||
:description="$t('page_sign_in.2fa_recovery_subtitle')"
|
||||
>
|
||||
<img class="user-avatar mx-auto rounded-xl w-28 mb-6 shadow-xl" :src="checkedAccount.avatar.md" :alt="checkedAccount.name">
|
||||
</Headline>
|
||||
|
||||
<div class="user" v-if="checkedAccount">
|
||||
<img class="user-avatar" :src="checkedAccount.avatar.md" :alt="checkedAccount.name">
|
||||
<h1> {{ checkedAccount.name }} </h1>
|
||||
<h2>{{ $t('page_sign_in.2fa_recovery_subtitle') }}:</h2>
|
||||
</div>
|
||||
|
||||
<ValidationObserver ref="two_factor_recovery" v-slot="{ invalid }" tag="form"
|
||||
class="form inline-form">
|
||||
<ValidationProvider tag="div" mode="passive" class="input-wrapper" name="Two Factor Recovery" rules="required"
|
||||
v-slot="{ errors }">
|
||||
<input v-model="twoFactorRecoveryCode" :placeholder="$t('page_sign_in.placeholder_2fa_recovery')"
|
||||
@input="twoFactorChallenge(true)"
|
||||
type="text"
|
||||
maxlength="21"
|
||||
class="focus-border-theme"
|
||||
:class="{'border-red': errors[0]}" />
|
||||
<span class="error-message" v-if="errors[0]">{{ errors[0] }}</span>
|
||||
<ValidationObserver ref="two_factor_recovery" v-slot="{ invalid }" tag="form" class="mb-12">
|
||||
<ValidationProvider tag="div" mode="passive" class="mx-auto" name="Two Factor Recovery" rules="required" v-slot="{ errors }">
|
||||
<input v-model="twoFactorRecoveryCode" :placeholder="$t('page_sign_in.placeholder_2fa_recovery')" @input="twoFactorChallenge(true)" type="text" maxlength="21" class="font-bold px-5 py-3.5 dark:bg-2x-dark-foreground bg-light-background text-center md:w-80 w-full h-full rounded-lg focus-border-theme appearance-none border border-transparent" :class="{'border-red': errors[0]}" />
|
||||
<span class="text-red-600 text-xs mt-2 text-center block" v-if="errors[0]">{{ errors[0] }}</span>
|
||||
</ValidationProvider>
|
||||
|
||||
</ValidationObserver>
|
||||
|
||||
<span class="additional-link">
|
||||
<a @click="goToAuthPage('two-factor-authentication')" class="text-theme">
|
||||
{{ $t('2fa.i_have_2fa_app') }}
|
||||
</a>
|
||||
</span>
|
||||
<b @click="goToAuthPage('two-factor-authentication')" class="text-theme block cursor-pointer">
|
||||
{{ $t('2fa.i_have_2fa_app') }}
|
||||
</b>
|
||||
|
||||
<div v-if="isLoading" class="spinner-wrapper">
|
||||
<Spinner class="spinner"/>
|
||||
<Spinner class="spinner" />
|
||||
</div>
|
||||
|
||||
</AuthContent>
|
||||
</AuthContentWrapper>
|
||||
</template>
|
||||
@@ -153,7 +134,7 @@
|
||||
<script>
|
||||
import AuthContentWrapper from '/resources/js/components/Auth/AuthContentWrapper'
|
||||
import {ValidationObserver, ValidationProvider} from 'vee-validate/dist/vee-validate.full'
|
||||
import SocialiteAuthenticationButtons from '/resources/js/components/Auth/SocialiteAuthenticationButtons'
|
||||
import SocialiteAuthenticationButtons from '/resources/js/components/Auth/SocialiteAuthenticationButtons'
|
||||
import AuthContent from '/resources/js/components/Auth/AuthContent'
|
||||
import AuthButton from '/resources/js/components/Auth/AuthButton'
|
||||
import Spinner from '/resources/js/components/FilesView/Spinner'
|
||||
@@ -163,171 +144,169 @@
|
||||
import Headline from "./Headline";
|
||||
|
||||
export default {
|
||||
name: 'SignIn',
|
||||
components: {
|
||||
Headline,
|
||||
AuthContentWrapper,
|
||||
ValidationProvider,
|
||||
ValidationObserver,
|
||||
SocialiteAuthenticationButtons,
|
||||
AuthContent,
|
||||
AuthButton,
|
||||
Spinner,
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['config']),
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isLoading: false,
|
||||
validSignIn: false,
|
||||
checkedAccount: undefined,
|
||||
loginPassword: '',
|
||||
loginEmail: '',
|
||||
twoFactorCode: '',
|
||||
twoFactorRecoveryCode: '',
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
goToAuthPage(slug) {
|
||||
name: 'SignIn',
|
||||
components: {
|
||||
SocialiteAuthenticationButtons,
|
||||
AuthContentWrapper,
|
||||
ValidationProvider,
|
||||
ValidationObserver,
|
||||
AuthContent,
|
||||
AuthButton,
|
||||
Headline,
|
||||
Spinner,
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'config'
|
||||
]),
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isLoading: false,
|
||||
validSignIn: false,
|
||||
checkedAccount: undefined,
|
||||
loginPassword: '',
|
||||
loginEmail: '',
|
||||
twoFactorCode: '',
|
||||
twoFactorRecoveryCode: '',
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
goToAuthPage(slug) {
|
||||
|
||||
this.$refs.auth.$children.forEach(page => {
|
||||
this.$refs.auth.$children.forEach(page => {
|
||||
|
||||
// Hide current step
|
||||
page.isVisible = false
|
||||
// Hide current step
|
||||
page.isVisible = page.$props.name === slug;
|
||||
})
|
||||
},
|
||||
resendEmail() {
|
||||
axios.post('/api/user/email/verify/resend', {
|
||||
email: this.loginEmail
|
||||
})
|
||||
.then(() => {
|
||||
this.$router.push({name: 'SuccessfullySend'})
|
||||
})
|
||||
.catch(() => {
|
||||
this.$isSomethingWrong()
|
||||
})
|
||||
},
|
||||
async logIn() {
|
||||
|
||||
if (page.$props.name === slug) {
|
||||
// Validate fields
|
||||
const isValid = await this.$refs.log_in.validate();
|
||||
|
||||
// Go to next step
|
||||
page.isVisible = true
|
||||
}
|
||||
})
|
||||
},
|
||||
resendEmail() {
|
||||
axios.
|
||||
post('/api/user/email/verify/resend', {
|
||||
email: this.loginEmail
|
||||
})
|
||||
.then(
|
||||
this.$router.push({name: 'SuccessfullySend'})
|
||||
)
|
||||
.catch(() => {
|
||||
this.$isSomethingWrong()
|
||||
})
|
||||
},
|
||||
async logIn() {
|
||||
if (!isValid) return;
|
||||
|
||||
// Validate fields
|
||||
const isValid = await this.$refs.log_in.validate();
|
||||
// Start loading
|
||||
this.isLoading = true
|
||||
|
||||
if (!isValid) return;
|
||||
// Send request to get verify account
|
||||
axios
|
||||
.post('/api/user/check', {
|
||||
email: this.loginEmail,
|
||||
})
|
||||
.then(response => {
|
||||
|
||||
// Start loading
|
||||
this.isLoading = true
|
||||
// End loading
|
||||
this.isLoading = false
|
||||
|
||||
// Send request to get verify account
|
||||
axios
|
||||
.post('/api/user/check', {
|
||||
email: this.loginEmail,
|
||||
})
|
||||
.then(response => {
|
||||
this.checkedAccount = response.data
|
||||
|
||||
// End loading
|
||||
this.isLoading = false
|
||||
if (response.data.oauth_provider) {
|
||||
// Redirect user to socialite login if he's accout is registered by socialite
|
||||
this.$store.dispatch('socialiteRedirect', response.data.oauth_provider)
|
||||
|
||||
this.checkedAccount = response.data
|
||||
} else {
|
||||
// Show sign in password page
|
||||
this.goToAuthPage('sign-in')
|
||||
|
||||
if(response.data.oauth_provider) {
|
||||
// Redirect user to socialite login if he's accout is registered by socialite
|
||||
this.$store.dispatch('socialiteRedirect', response.data.oauth_provider)
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
|
||||
} else {
|
||||
// Show sign in password page
|
||||
this.goToAuthPage('sign-in')
|
||||
if (error.response.status == 404) {
|
||||
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
this.$refs.log_in.setErrors({
|
||||
'E-Mail': [error.response.data]
|
||||
});
|
||||
}
|
||||
|
||||
if (error.response.status == 404) {
|
||||
if (error.response.status == 500) {
|
||||
|
||||
this.$refs.log_in.setErrors({
|
||||
'E-Mail': [error.response.data]
|
||||
});
|
||||
}
|
||||
events.$emit('alert:open', {
|
||||
emoji: '🤔',
|
||||
title: this.$t('popup_signup_error.title'),
|
||||
message: this.$t('popup_signup_error.message')
|
||||
})
|
||||
}
|
||||
|
||||
if (error.response.status == 500) {
|
||||
// End loading
|
||||
this.isLoading = false
|
||||
})
|
||||
},
|
||||
async singIn() {
|
||||
|
||||
events.$emit('alert:open', {
|
||||
emoji: '🤔',
|
||||
title: this.$t('popup_signup_error.title'),
|
||||
message: this.$t('popup_signup_error.message')
|
||||
})
|
||||
}
|
||||
// Validate fields
|
||||
const isValid = this.validSignIn ? this.validSignIn : await this.$refs.sign_in.validate();
|
||||
|
||||
// End loading
|
||||
this.isLoading = false
|
||||
})
|
||||
},
|
||||
async singIn() {
|
||||
if (!isValid) return;
|
||||
|
||||
// Validate fields
|
||||
const isValid = this.validSignIn ? this.validSignIn : await this.$refs.sign_in.validate();
|
||||
if (!this.checkedAccount.verified) {
|
||||
|
||||
if (!isValid) return;
|
||||
this.goToAuthPage('not-verified')
|
||||
|
||||
if(!this.checkedAccount.verified) {
|
||||
return
|
||||
}
|
||||
|
||||
this.goToAuthPage('not-verified')
|
||||
// Start loading
|
||||
this.isLoading = true
|
||||
|
||||
return
|
||||
}
|
||||
// Send request to get user token
|
||||
axios
|
||||
.post('/login', {
|
||||
email: this.loginEmail,
|
||||
password: this.loginPassword,
|
||||
})
|
||||
.then((response) => {
|
||||
|
||||
// Start loading
|
||||
this.isLoading = true
|
||||
// End loading
|
||||
this.isLoading = false
|
||||
|
||||
// Send request to get user token
|
||||
axios
|
||||
.post('/login', {
|
||||
email: this.loginEmail,
|
||||
password: this.loginPassword,
|
||||
})
|
||||
.then((response) => {
|
||||
// If is enabled two factor authentication
|
||||
if (response.data.two_factor && !this.validSignIn) {
|
||||
|
||||
// End loading
|
||||
this.isLoading = false
|
||||
this.validSignIn = true
|
||||
|
||||
// If is enabled two factor authentication
|
||||
if(response.data.two_factor && ! this.validSignIn) {
|
||||
this.goToAuthPage('two-factor-authentication')
|
||||
|
||||
this.validSignIn = true
|
||||
// Autofocus to input
|
||||
this.$nextTick(() => this.$refs.twoFactorCodeInput.focus())
|
||||
}
|
||||
|
||||
this.goToAuthPage('two-factor-authentication')
|
||||
}
|
||||
// If is disabled two factor authentication
|
||||
if (!response.data.two_factor) {
|
||||
|
||||
// If is disabled two factor authentication
|
||||
if(! response.data.two_factor ) {
|
||||
// Set login state
|
||||
this.$store.commit('SET_AUTHORIZED', true)
|
||||
|
||||
// Set login state
|
||||
this.$store.commit('SET_AUTHORIZED', true)
|
||||
|
||||
// Go to files page
|
||||
// Go to files page
|
||||
this.proceedToAccount()
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
|
||||
if (error.response.status == 422) {
|
||||
if (error.response.status == 422) {
|
||||
|
||||
this.$refs.sign_in.setErrors({
|
||||
'User Password': [this.$t('validation_errors.incorrect_password')]
|
||||
});
|
||||
}
|
||||
this.$refs.sign_in.setErrors({
|
||||
'User Password': [this.$t('validation_errors.incorrect_password')]
|
||||
});
|
||||
}
|
||||
|
||||
// End loading
|
||||
this.isLoading = false
|
||||
})
|
||||
},
|
||||
// End loading
|
||||
this.isLoading = false
|
||||
})
|
||||
},
|
||||
async twoFactorChallenge(recovery) {
|
||||
// Check if is normal authentication or recovery
|
||||
if (!recovery && this.twoFactorCode.length === 6 || recovery && this.twoFactorRecoveryCode.length === 21) {
|
||||
@@ -386,31 +365,25 @@
|
||||
this.$router.push({name: 'Files'})
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.$scrollTop()
|
||||
this.$store.commit('PROCESSING_POPUP', undefined)
|
||||
},
|
||||
created() {
|
||||
this.$scrollTop()
|
||||
this.$store.commit('PROCESSING_POPUP', undefined)
|
||||
|
||||
//if (this.config.isDemo) {
|
||||
this.loginEmail = 'howdy@hi5ve.digital'
|
||||
this.loginPassword = 'vuefilemanager'
|
||||
//}
|
||||
|
||||
console.log(
|
||||
|
||||
);
|
||||
}
|
||||
}
|
||||
if (this.config.isDemo || this.config.isDev) {
|
||||
this.loginEmail = 'howdy@hi5ve.digital'
|
||||
this.loginPassword = 'vuefilemanager'
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@import '/resources/sass/vuefilemanager/_auth-form';
|
||||
@import '/resources/sass/vuefilemanager/_auth';
|
||||
|
||||
.spinner-wrapper {
|
||||
width: 100%;
|
||||
height: 50px;
|
||||
position: relative;
|
||||
top: 50px;
|
||||
}
|
||||
width: 100%;
|
||||
height: 50px;
|
||||
position: relative;
|
||||
top: 50px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
<script>
|
||||
import Spinner from '/resources/js/components/FilesView/Spinner'
|
||||
import {events} from "../../bus";
|
||||
import i18n from "../../i18n";
|
||||
|
||||
export default {
|
||||
name: 'SocialiteCallback',
|
||||
@@ -35,6 +34,5 @@ export default {
|
||||
this.$router.push({name: 'SignIn'})
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
@@ -6,10 +6,9 @@
|
||||
:description="$t('page_email_successfully_verified.subtitle')"
|
||||
/>
|
||||
|
||||
<a href="/sign-in">
|
||||
<router-link :to="{name: 'SignIn'}">
|
||||
<AuthButton icon="chevron-right" :text="$t('page_sign_in.button_log_in')"/>
|
||||
</a>
|
||||
|
||||
</router-link>
|
||||
</AuthContent>
|
||||
</AuthContentWrapper>
|
||||
</template>
|
||||
@@ -19,7 +18,6 @@
|
||||
import AuthContent from '/resources/js/components/Auth/AuthContent'
|
||||
import AuthButton from '/resources/js/components/Auth/AuthButton'
|
||||
import Headline from "./Headline";
|
||||
import {mapGetters} from 'vuex'
|
||||
|
||||
export default {
|
||||
name: 'SuccessfullyEmailVerified',
|
||||
@@ -29,13 +27,5 @@
|
||||
AuthButton,
|
||||
Headline,
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['config']),
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@import '/resources/sass/vuefilemanager/_auth-form';
|
||||
@import '/resources/sass/vuefilemanager/_auth';
|
||||
</style>
|
||||
|
||||
@@ -6,12 +6,11 @@
|
||||
:description="$t('page_email_successfully_send.subtitle')"
|
||||
/>
|
||||
|
||||
<span class="additional-link">
|
||||
<router-link :to="{name: 'Homepage'}" class="text-theme">
|
||||
<span class="block">
|
||||
<router-link :to="{name: 'Homepage'}" class="font-bold text-theme">
|
||||
{{ $t('go_home') }}
|
||||
</router-link>
|
||||
</span>
|
||||
|
||||
</AuthContent>
|
||||
</AuthContentWrapper>
|
||||
</template>
|
||||
@@ -20,8 +19,7 @@
|
||||
import AuthContentWrapper from '/resources/js/components/Auth/AuthContentWrapper'
|
||||
import AuthContent from '/resources/js/components/Auth/AuthContent'
|
||||
import AuthButton from '/resources/js/components/Auth/AuthButton'
|
||||
import Headline from "./Headline";
|
||||
import {mapGetters} from 'vuex'
|
||||
import Headline from "./Headline"
|
||||
|
||||
export default {
|
||||
name: 'SuccessfullySendEmail',
|
||||
@@ -31,13 +29,5 @@
|
||||
AuthButton,
|
||||
Headline,
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['config']),
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@import '/resources/sass/vuefilemanager/_auth-form';
|
||||
@import '/resources/sass/vuefilemanager/_auth';
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user