added prettier

This commit is contained in:
Čarodej
2022-02-01 12:21:38 +01:00
parent 5ae875233b
commit b38b532cbe
284 changed files with 25410 additions and 25338 deletions

View File

@@ -1,53 +1,66 @@
<template>
<AuthContentWrapper ref="auth">
<!--Create new password-->
<AuthContent name="create-new-password" :visible="true">
<Headline
:title="$t('page_create_password.title')"
:description="$t('page_create_password.subtitle')"
/>
<Headline :title="$t('page_create_password.title')" :description="$t('page_create_password.subtitle')" />
<ValidationObserver @submit.prevent="createNewPassword" ref="create_new_password" v-slot="{ invalid }" tag="form" class="space-y-4 mb-12 text-left">
<div class="md:flex md:items-center mb-5 md:max-w-lg mx-auto">
<label class="md:w-72 md:text-right md:pr-4 font-bold md:mb-0 mb-1.5 block">
{{ $t('page_create_password.label_email') }}:
</label>
<ValidationObserver @submit.prevent="createNewPassword" ref="create_new_password" v-slot="{ invalid }" tag="form" class="mb-12 space-y-4 text-left">
<div class="mx-auto mb-5 md:flex md:max-w-lg md:items-center">
<label class="mb-1.5 block font-bold md:mb-0 md:w-72 md:pr-4 md:text-right"> {{ $t('page_create_password.label_email') }}: </label>
<ValidationProvider tag="div" mode="passive" class="w-full text-left" name="E-Mail" rules="required" v-slot="{ errors }">
<input v-model="recoverPassword.email" :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]}"/>
<input
v-model="recoverPassword.email"
:placeholder="$t('page_login.placeholder_email')"
type="email"
class="focus-border-theme w-full appearance-none rounded-lg border border-transparent bg-light-background px-5 py-3.5 font-bold dark:bg-2x-dark-foreground"
:class="{ 'border-red': errors[0] }"
/>
<span class="error-message" v-if="errors[0]">{{ errors[0] }}</span>
</ValidationProvider>
</div>
<div class="md:flex md:items-center mb-5 md:max-w-lg mx-auto">
<label class="md:w-72 md:text-right md:pr-4 font-bold md:mb-0 mb-1.5 block">
{{ $t('page_create_password.label_new_pass') }}:
</label>
<div class="mx-auto mb-5 md:flex md:max-w-lg md:items-center">
<label class="mb-1.5 block font-bold md:mb-0 md:w-72 md:pr-4 md:text-right"> {{ $t('page_create_password.label_new_pass') }}: </label>
<ValidationProvider tag="div" mode="passive" class="w-full text-left" name="New Password" rules="required" v-slot="{ errors }">
<input v-model="recoverPassword.newPassword" :placeholder="$t('page_create_password.label_new_pass')" type="password" 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]}"/>
<input
v-model="recoverPassword.newPassword"
:placeholder="$t('page_create_password.label_new_pass')"
type="password"
class="focus-border-theme w-full appearance-none rounded-lg border border-transparent bg-light-background px-5 py-3.5 font-bold dark:bg-2x-dark-foreground"
:class="{ 'border-red': errors[0] }"
/>
<span class="error-message" v-if="errors[0]">{{ errors[0] }}</span>
</ValidationProvider>
</div>
<div class="md:flex md:items-center mb-5 md:max-w-lg mx-auto">
<label class="md:w-72 md:text-right md:pr-4 font-bold md:mb-0 mb-1.5 block">
{{ $t('page_create_password.label_confirm_pass') }}:
</label>
<div class="mx-auto mb-5 md:flex md:max-w-lg md:items-center">
<label class="mb-1.5 block font-bold md:mb-0 md:w-72 md:pr-4 md:text-right"> {{ $t('page_create_password.label_confirm_pass') }}: </label>
<ValidationProvider tag="div" mode="passive" class="w-full text-left" name="Confirm Password" rules="required" v-slot="{ errors }">
<input v-model="recoverPassword.newPasswordConfirm" :placeholder="$t('page_create_password.label_confirm_pass')" type="password" 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]}"/>
<input
v-model="recoverPassword.newPasswordConfirm"
:placeholder="$t('page_create_password.label_confirm_pass')"
type="password"
class="focus-border-theme w-full appearance-none rounded-lg border border-transparent bg-light-background px-5 py-3.5 font-bold dark:bg-2x-dark-foreground"
:class="{ 'border-red': errors[0] }"
/>
<span class="error-message" v-if="errors[0]">{{ errors[0] }}</span>
</ValidationProvider>
</div>
<div>
<AuthButton class="md:w-min w-full justify-center mt-12" icon="chevron-right" :text="$t('page_create_password.button_update')" :loading="isLoading" :disabled="isLoading"/>
</div>
<div>
<AuthButton
class="mt-12 w-full justify-center md:w-min"
icon="chevron-right"
:text="$t('page_create_password.button_update')"
:loading="isLoading"
:disabled="isLoading"
/>
</div>
</ValidationObserver>
<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_text') }}
<router-link :to="{ name: 'SignIn' }" class="text-theme font-bold">
{{ $t('page_forgotten_password.password_remember_button') }}
</router-link>
</span>
@@ -55,122 +68,112 @@
<!--Password reset successfully-->
<AuthContent name="password-reset-successfully" :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>
<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>
<h1>{{ $t('page_forgotten_password.pass_reseted_title') }}</h1>
<h2>{{ $t('page_forgotten_password.pass_reseted_subtitle') }}</h2>
<router-link :to="{name: 'SignIn'}">
<AuthButton icon="chevron-right" :text="$t('page_forgotten_password.pass_reseted_signin')"/>
<router-link :to="{ name: 'SignIn' }">
<AuthButton icon="chevron-right" :text="$t('page_forgotten_password.pass_reseted_signin')" />
</router-link>
</AuthContent>
</AuthContentWrapper>
</template>
<script>
import AuthContentWrapper from "../../components/Auth/AuthContentWrapper";
import {ValidationProvider, ValidationObserver} from 'vee-validate/dist/vee-validate.full'
import AuthContent from "../../components/Auth/AuthContent";
import AuthButton from "../../components/Auth/AuthButton";
import {required} from 'vee-validate/dist/rules'
import Headline from "./Headline";
import {mapGetters} from 'vuex'
import axios from 'axios'
import AuthContentWrapper from '../../components/Auth/AuthContentWrapper'
import { ValidationProvider, ValidationObserver } from 'vee-validate/dist/vee-validate.full'
import AuthContent from '../../components/Auth/AuthContent'
import AuthButton from '../../components/Auth/AuthButton'
import { required } from 'vee-validate/dist/rules'
import Headline from './Headline'
import { mapGetters } from 'vuex'
import axios from 'axios'
export default {
name: 'CreateNewPassword',
components: {
AuthContentWrapper,
ValidationProvider,
ValidationObserver,
AuthContent,
AuthButton,
Headline,
required,
},
computed: {
...mapGetters(['config']),
},
data() {
return {
isLoading: false,
recoverPassword: {
token: undefined,
email: '',
newPassword: '',
newPasswordConfirm: '',
},
}
},
methods: {
goToAuthPage(slug) {
this.$refs.auth.$children.forEach(page => {
// Hide current step
page.isVisible = false
if (page.$props.name === slug) {
// Go to next step
page.isVisible = true
}
})
export default {
name: 'CreateNewPassword',
components: {
AuthContentWrapper,
ValidationProvider,
ValidationObserver,
AuthContent,
AuthButton,
Headline,
required,
},
computed: {
...mapGetters(['config']),
},
data() {
return {
isLoading: false,
recoverPassword: {
token: undefined,
email: '',
newPassword: '',
newPasswordConfirm: '',
},
async createNewPassword() {
}
},
methods: {
goToAuthPage(slug) {
this.$refs.auth.$children.forEach((page) => {
// Hide current step
page.isVisible = false
// Validate fields
const isValid = await this.$refs.create_new_password.validate();
if (page.$props.name === slug) {
// Go to next step
page.isVisible = true
}
})
},
async createNewPassword() {
// Validate fields
const isValid = await this.$refs.create_new_password.validate()
if (!isValid) return;
if (!isValid) return
// Start loading
this.isLoading = true
// Start loading
this.isLoading = true
// Send request to get user reset link
axios
.post(this.$store.getters.api + '/password/reset', {
email: this.recoverPassword.email,
token: this.recoverPassword.token,
password: this.recoverPassword.newPassword,
password_confirmation: this.recoverPassword.newPasswordConfirm,
})
.then(() => {
// Send request to get user reset link
axios
.post(this.$store.getters.api + '/password/reset', {
email: this.recoverPassword.email,
token: this.recoverPassword.token,
password: this.recoverPassword.newPassword,
password_confirmation: this.recoverPassword.newPasswordConfirm,
})
.then(() => {
// End loading
this.isLoading = false
// End loading
this.isLoading = false
this.goToAuthPage('password-reset-successfully')
})
.catch(error => {
if (error.response.status === 422) {
if (error.response.data.error) {
this.$refs.create_new_password.setErrors({
'E-Mail': error.response.data.error
});
}
if (error.response.data.errors['password']) {
this.$refs.create_new_password.setErrors({
'New Password': error.response.data.errors['password']
});
}
this.goToAuthPage('password-reset-successfully')
})
.catch((error) => {
if (error.response.status === 422) {
if (error.response.data.error) {
this.$refs.create_new_password.setErrors({
'E-Mail': error.response.data.error,
})
}
// End loading
this.isLoading = false
})
},
},
created() {
if (error.response.data.errors['password']) {
this.$refs.create_new_password.setErrors({
'New Password': error.response.data.errors['password'],
})
}
}
// Get token
this.recoverPassword.token = this.$route.query.token
}
}
</script>
// End loading
this.isLoading = false
})
},
},
created() {
// Get token
this.recoverPassword.token = this.$route.query.token
},
}
</script>

View File

@@ -1,25 +1,39 @@
<template>
<AuthContentWrapper ref="auth" class="h-screen">
<!--Forgotten your password?-->
<AuthContent name="forgotten-password" :visible="true">
<Headline
:title="$t('page_forgotten_password.title')"
:description="$t('page_forgotten_password.subtitle')"
/>
<Headline :title="$t('page_forgotten_password.title')" :description="$t('page_forgotten_password.subtitle')" />
<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>
<ValidationObserver
@submit.prevent="forgottenPassword"
ref="forgotten_password"
v-slot="{ invalid }"
tag="form"
class="mb-12 items-start space-y-4 md:flex md:space-x-4 md:space-y-0"
>
<ValidationProvider tag="div" mode="passive" class="relative w-full text-left" name="E-Mail" rules="required" v-slot="{ errors }">
<input
v-model="recoverEmail"
:placeholder="$t('page_login.placeholder_email')"
type="email"
class="focus-border-theme w-full appearance-none rounded-lg border border-transparent bg-light-background px-5 py-3.5 font-bold dark:bg-2x-dark-foreground"
:class="{ 'border-red': errors[0] }"
/>
<span class="text-left text-xs text-red-600" v-if="errors[0]">{{ errors[0] }}</span>
</ValidationProvider>
<AuthButton class="md:w-min w-full justify-center" icon="chevron-right" :text="$t('page_forgotten_password.button_get_link')" :loading="isLoading" :disabled="isLoading"/>
<AuthButton
class="w-full justify-center md:w-min"
icon="chevron-right"
:text="$t('page_forgotten_password.button_get_link')"
:loading="isLoading"
:disabled="isLoading"
/>
</ValidationObserver>
<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_text') }}
<router-link :to="{ name: 'SignIn' }" class="text-theme font-bold">
{{ $t('page_forgotten_password.password_remember_button') }}
</router-link>
</span>
@@ -27,14 +41,11 @@
<!--Password reset link send-->
<AuthContent name="password-reset-link-sended" :visible="false">
<Headline
:title="$t('page_forgotten_password.pass_sennded_title')"
:description="$t('page_forgotten_password.pass_sennded_subtitle')"
/>
<Headline :title="$t('page_forgotten_password.pass_sennded_title')" :description="$t('page_forgotten_password.pass_sennded_subtitle')" />
<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_text') }}
<router-link :to="{ name: 'SignIn' }" class="text-theme font-bold">
{{ $t('page_forgotten_password.password_remember_button') }}
</router-link>
</span>
@@ -43,78 +54,73 @@
</template>
<script>
import {ValidationProvider, ValidationObserver} from 'vee-validate/dist/vee-validate.full'
import AuthContentWrapper from "../../components/Auth/AuthContentWrapper";
import AuthContent from "../../components/Auth/AuthContent";
import AuthButton from "../../components/Auth/AuthButton";
import {required} from 'vee-validate/dist/rules'
import Headline from "./Headline";
import {mapGetters} from 'vuex'
import axios from 'axios'
import { ValidationProvider, ValidationObserver } from 'vee-validate/dist/vee-validate.full'
import AuthContentWrapper from '../../components/Auth/AuthContentWrapper'
import AuthContent from '../../components/Auth/AuthContent'
import AuthButton from '../../components/Auth/AuthButton'
import { required } from 'vee-validate/dist/rules'
import Headline from './Headline'
import { mapGetters } from 'vuex'
import axios from 'axios'
export default {
name: 'ForgottenPassword',
components: {
AuthContentWrapper,
ValidationProvider,
ValidationObserver,
AuthContent,
AuthButton,
required,
Headline,
export default {
name: 'ForgottenPassword',
components: {
AuthContentWrapper,
ValidationProvider,
ValidationObserver,
AuthContent,
AuthButton,
required,
Headline,
},
computed: {
...mapGetters(['config']),
},
data() {
return {
isLoading: false,
recoverEmail: '',
}
},
methods: {
goToAuthPage(slug) {
this.$refs.auth.$children.forEach((page) => {
// Hide current step
page.isVisible = false
if (page.$props.name === slug) {
// Go to next step
page.isVisible = true
}
})
},
computed: {
...mapGetters([
'config',
]),
},
data() {
return {
isLoading: false,
recoverEmail: '',
}
},
methods: {
goToAuthPage(slug) {
this.$refs.auth.$children.forEach(page => {
async forgottenPassword() {
// Validate fields
const isValid = await this.$refs.forgotten_password.validate()
// Hide current step
page.isVisible = false
if (!isValid) return
if (page.$props.name === slug) {
// Start loading
this.isLoading = true
// Go to next step
page.isVisible = true
// Send request to get user reset link
axios
.post('/api/password/email', {
email: this.recoverEmail,
})
.then(() => {
this.goToAuthPage('password-reset-link-sended')
})
.catch((error) => {
if (error.response.status === 422) {
this.$refs.forgotten_password.setErrors({
'E-Mail': error.response.data.message,
})
}
})
},
async forgottenPassword() {
// Validate fields
const isValid = await this.$refs.forgotten_password.validate();
if (!isValid) return;
// Start loading
this.isLoading = true
// Send request to get user reset link
axios
.post('/api/password/email', {
email: this.recoverEmail
})
.then(() => {
this.goToAuthPage('password-reset-link-sended')
}).catch(error => {
if (error.response.status === 422) {
this.$refs.forgotten_password.setErrors({
'E-Mail': error.response.data.message
});
}
}).finally(() => this.isLoading = false)
},
}
}
.finally(() => (this.isLoading = false))
},
},
}
</script>

View File

@@ -1,42 +1,36 @@
<template>
<div class="mb-14">
<!--Custom content-->
<slot></slot>
<div class="mb-14">
<!--Custom content-->
<slot></slot>
<!--Default application logo-->
<div v-if="! $slots.default">
<!--Default application logo-->
<div v-if="!$slots.default">
<!--Image logo-->
<img v-if="config.app_logo" class="mx-auto mb-6 w-28 md:w-32" :src="$getImage(config.app_logo)" :alt="config.app_name" />
<!--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="mb-10 block text-xl font-bold">
{{ config.app_name }}
</b>
</div>
<!--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 class="mb-0.5 text-3xl font-extrabold md:text-4xl">
{{ title }}
</h1>
<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>
<h2 class="text-xl font-normal md:text-2xl">
{{ description }}
</h2>
</div>
</template>
<script>
import {mapGetters} from "vuex";
import { mapGetters } from 'vuex'
export default {
name: 'Headline',
props: [
'description',
'title',
],
computed: {
...mapGetters([
'config',
])
}
}
</script>
export default {
name: 'Headline',
props: ['description', 'title'],
computed: {
...mapGetters(['config']),
},
}
</script>

View File

@@ -1,130 +1,137 @@
<template>
<AuthContentWrapper ref="auth" class="h-screen">
<!--Log In by Email-->
<AuthContent name="log-in" :visible="true">
<Headline
:title="$t('page_login.title')"
:description="$t('page_login.subtitle')"
/>
<Headline :title="$t('page_login.title')" :description="$t('page_login.subtitle')" />
<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">
<ValidationObserver @submit.prevent="logIn" ref="log_in" v-slot="{ invalid }" tag="form" class="mb-12 items-start space-y-4 md:flex md:space-x-4 md:space-y-0">
<ValidationProvider class="w-full text-left" 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>
<input
class="focus-border-theme w-full appearance-none rounded-lg border border-transparent bg-light-background px-5 py-3.5 font-bold dark:bg-2x-dark-foreground"
:class="{ 'border-red': errors[0] }"
v-model="loginEmail"
:placeholder="$t('page_login.placeholder_email')"
type="email"
/>
<span class="text-left text-xs text-red-600" v-if="errors[0]">{{ errors[0] }}</span>
</ValidationProvider>
<AuthButton class="md:w-min w-full justify-center" icon="chevron-right" :text="$t('page_login.button_next')" :loading="isLoading" :disabled="isLoading" />
<AuthButton class="w-full justify-center md:w-min" icon="chevron-right" :text="$t('page_login.button_next')" :loading="isLoading" :disabled="isLoading" />
</ValidationObserver>
<SocialiteAuthenticationButtons />
<span v-if="config.userRegistration" class="block">
{{ $t('page_login.registration_text') }}
<router-link class="font-bold text-theme" :to="{name: 'SignUp'}">
<router-link class="text-theme font-bold" :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>
<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 mb-6 w-28 rounded-xl shadow-xl" :src="checkedAccount.avatar.md" :alt="checkedAccount.name" />
</Headline>
<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">
<ValidationObserver @submit.prevent="singIn" ref="sign_in" v-slot="{ invalid }" tag="form" class="mb-12 items-start space-y-4 md:flex md:space-x-4 md:space-y-0">
<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>
<input
v-model="loginPassword"
:placeholder="$t('page_sign_in.placeholder_password')"
type="password"
class="focus-border-theme h-full w-full appearance-none rounded-lg border border-transparent bg-light-background px-5 py-3.5 font-bold dark:bg-2x-dark-foreground"
:class="{ 'border-red': errors[0] }"
/>
<span class="text-left text-xs text-red-600" v-if="errors[0]">{{ errors[0] }}</span>
</ValidationProvider>
<AuthButton class="md:w-min w-full justify-center" icon="chevron-right" :text="$t('page_sign_in.button_log_in')" :loading="isLoading" :disabled="isLoading" />
<AuthButton class="w-full justify-center md:w-min" icon="chevron-right" :text="$t('page_sign_in.button_log_in')" :loading="isLoading" :disabled="isLoading" />
</ValidationObserver>
<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_text') }}
<router-link :to="{ name: 'ForgottenPassword' }" class="text-theme font-bold">
{{ $t('page_sign_in.password_reset_button') }}
</router-link>
</span>
</AuthContent>
<!--Resend verification email-->
<!--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>
<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 mb-6 w-28 rounded-xl shadow-xl" :src="checkedAccount.avatar.md" :alt="checkedAccount.name" />
</Headline>
<span class="block">
{{ $t('page_not_verified.resend_text') }}
{{ $t('page_not_verified.resend_text') }}
<b @click="resendEmail" class="text-theme cursor-pointer">
{{ $t('page_not_verified.resend_button') }}
</b>
{{ $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>
<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 mb-6 w-28 rounded-xl shadow-xl" :src="checkedAccount.avatar.md" :alt="checkedAccount.name" />
</Headline>
<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>
<input
v-model="twoFactorCode"
ref="twoFactorCodeInput"
:placeholder="$t('page_sign_in.placeholder_2fa')"
@input="twoFactorChallenge(false)"
type="text"
maxlength="6"
class="focus-border-theme h-full w-full appearance-none rounded-lg border border-transparent bg-light-background px-5 py-3.5 text-center font-bold dark:bg-2x-dark-foreground md:w-80"
:class="{ 'border-red': errors[0] }"
/>
<span class="mt-2 block text-center text-xs text-red-600" v-if="errors[0]">{{ errors[0] }}</span>
</ValidationProvider>
</ValidationObserver>
<span class="block">
{{ $t('page_sign_in.2fa_recovery_text') }}
<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') }}
{{ $t('page_sign_in.2fa_recovery_button') }}
</b>
</span>
<div class="relative h-12 mt-10 w-full">
<div class="relative mt-10 h-12 w-full">
<Spinner v-if="isLoading" class="spinner" />
</div>
</AuthContent>
<!-- Log in by 2fa with 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>
<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 mb-6 w-28 rounded-xl shadow-xl" :src="checkedAccount.avatar.md" :alt="checkedAccount.name" />
</Headline>
<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>
<input
v-model="twoFactorRecoveryCode"
:placeholder="$t('page_sign_in.placeholder_2fa_recovery')"
@input="twoFactorChallenge(true)"
type="text"
maxlength="21"
class="focus-border-theme h-full w-full appearance-none rounded-lg border border-transparent bg-light-background px-5 py-3.5 text-center font-bold dark:bg-2x-dark-foreground md:w-80"
:class="{ 'border-red': errors[0] }"
/>
<span class="mt-2 block text-center text-xs text-red-600" v-if="errors[0]">{{ errors[0] }}</span>
</ValidationProvider>
</ValidationObserver>
<b @click="goToAuthPage('two-factor-authentication')" class="text-theme block cursor-pointer">
{{ $t('2fa.i_have_2fa_app') }}
</b>
<b @click="goToAuthPage('two-factor-authentication')" class="text-theme block cursor-pointer">
{{ $t('2fa.i_have_2fa_app') }}
</b>
<div v-if="isLoading" class="relative h-12 mt-10 w-full">
<div v-if="isLoading" class="relative mt-10 h-12 w-full">
<Spinner class="spinner" />
</div>
</AuthContent>
@@ -132,248 +139,222 @@
</template>
<script>
import AuthContentWrapper from "../../components/Auth/AuthContentWrapper";
import {ValidationObserver, ValidationProvider} from 'vee-validate/dist/vee-validate.full'
import SocialiteAuthenticationButtons from "../../components/Auth/SocialiteAuthenticationButtons";
import AuthContent from "../../components/Auth/AuthContent";
import AuthButton from "../../components/Auth/AuthButton";
import Spinner from "../../components/FilesView/Spinner";
import {mapGetters} from 'vuex'
import {events} from '../../bus'
import axios from 'axios'
import Headline from "./Headline";
import AuthContentWrapper from '../../components/Auth/AuthContentWrapper'
import { ValidationObserver, ValidationProvider } from 'vee-validate/dist/vee-validate.full'
import SocialiteAuthenticationButtons from '../../components/Auth/SocialiteAuthenticationButtons'
import AuthContent from '../../components/Auth/AuthContent'
import AuthButton from '../../components/Auth/AuthButton'
import Spinner from '../../components/FilesView/Spinner'
import { mapGetters } from 'vuex'
import { events } from '../../bus'
import axios from 'axios'
import Headline from './Headline'
export default {
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) {
export default {
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) => {
// 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() {
// Validate fields
const isValid = await this.$refs.log_in.validate()
this.$refs.auth.$children.forEach(page => {
if (!isValid) return
// 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() {
// Start loading
this.isLoading = true
// Validate fields
const isValid = await this.$refs.log_in.validate();
// Send request to get verify account
axios
.post('/api/user/check', {
email: this.loginEmail,
})
.then((response) => {
// End loading
this.isLoading = false
if (!isValid) return;
this.checkedAccount = response.data
// Start loading
this.isLoading = true
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)
} else {
// Show sign in password page
this.goToAuthPage('sign-in')
}
})
.catch((error) => {
if (error.response.status == 404) {
this.$refs.log_in.setErrors({
'E-Mail': [error.response.data],
})
}
// Send request to get verify account
axios
.post('/api/user/check', {
email: this.loginEmail,
})
.then(response => {
if (error.response.status == 500) {
events.$emit('alert:open', {
emoji: '🤔',
title: this.$t('popup_signup_error.title'),
message: this.$t('popup_signup_error.message'),
})
}
// End loading
this.isLoading = false
// End loading
this.isLoading = false
})
},
async singIn() {
// Validate fields
const isValid = this.validSignIn ? this.validSignIn : await this.$refs.sign_in.validate()
this.checkedAccount = response.data
if (!isValid) return
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)
if (!this.checkedAccount.verified) {
this.goToAuthPage('not-verified')
} else {
// Show sign in password page
this.goToAuthPage('sign-in')
return
}
}
})
.catch(error => {
// Start loading
this.isLoading = true
if (error.response.status == 404) {
// Send request to get user token
axios
.post('/login', {
email: this.loginEmail,
password: this.loginPassword,
})
.then((response) => {
// End loading
this.isLoading = false
this.$refs.log_in.setErrors({
'E-Mail': [error.response.data]
});
}
// If is enabled two factor authentication
if (response.data.two_factor && !this.validSignIn) {
this.validSignIn = true
if (error.response.status == 500) {
this.goToAuthPage('two-factor-authentication')
events.$emit('alert:open', {
emoji: '🤔',
title: this.$t('popup_signup_error.title'),
message: this.$t('popup_signup_error.message')
})
}
// Autofocus to input
this.$nextTick(() => this.$refs.twoFactorCodeInput.focus())
}
// End loading
this.isLoading = false
})
},
async singIn() {
// If is disabled two factor authentication
if (!response.data.two_factor) {
// Set login state
this.$store.commit('SET_AUTHORIZED', true)
// Validate fields
const isValid = this.validSignIn ? this.validSignIn : await this.$refs.sign_in.validate();
// Go to files page
this.proceedToAccount()
}
})
.catch((error) => {
if (error.response.status == 422) {
this.$refs.sign_in.setErrors({
'User Password': [this.$t('validation_errors.incorrect_password')],
})
}
if (!isValid) return;
// 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)) {
this.isLoading = true
if (!this.checkedAccount.verified) {
let payload = recovery ? { recovery_code: this.twoFactorRecoveryCode } : { code: this.twoFactorCode }
this.goToAuthPage('not-verified')
axios
.post('/two-factor-challenge', payload)
.then(() => {
this.isLoading = false
return
}
// Set login state
this.$store.commit('SET_AUTHORIZED', true)
// Start loading
this.isLoading = true
// Go to files page
this.proceedToAccount()
})
.catch((error) => {
if (error.response.status == 422) {
//Authentication bad input
if (!recovery) {
this.$refs.two_factor_authentication.setErrors({
'Two Factor Authentication': this.$t('validation_errors.incorrect_2fa_code'),
})
}
// Send request to get user token
axios
.post('/login', {
email: this.loginEmail,
password: this.loginPassword,
})
.then((response) => {
// Recovery bad input
if (recovery) {
this.$refs.two_factor_recovery.setErrors({
'Two Factor Recovery': this.$t('validation_errors.incorrect_2fa_recovery_code'),
})
}
}
// End loading
this.isLoading = false
// Repeat the login for next try to type right 2fa code / recovery code
this.singIn()
// If is enabled two factor authentication
if (response.data.two_factor && !this.validSignIn) {
this.isLoading = false
})
}
},
proceedToAccount() {
if (this.$route.query.redirect) {
this.$router.push(this.$route.query.redirect)
} else {
this.$router.push({ name: 'Files' })
}
},
},
created() {
this.$scrollTop()
this.$store.commit('PROCESSING_POPUP', undefined)
this.validSignIn = true
this.goToAuthPage('two-factor-authentication')
// Autofocus to input
this.$nextTick(() => this.$refs.twoFactorCodeInput.focus())
}
// If is disabled two factor authentication
if (!response.data.two_factor) {
// Set login state
this.$store.commit('SET_AUTHORIZED', true)
// Go to files page
this.proceedToAccount()
}
})
.catch(error => {
if (error.response.status == 422) {
this.$refs.sign_in.setErrors({
'User Password': [this.$t('validation_errors.incorrect_password')]
});
}
// 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) {
this.isLoading = true
let payload = recovery
? {recovery_code: this.twoFactorRecoveryCode}
: {code: this.twoFactorCode}
axios.post('/two-factor-challenge', payload)
.then(() => {
this.isLoading = false
// Set login state
this.$store.commit('SET_AUTHORIZED', true)
// Go to files page
this.proceedToAccount()
})
.catch(error => {
if (error.response.status == 422) {
//Authentication bad input
if (!recovery) {
this.$refs.two_factor_authentication.setErrors({
'Two Factor Authentication': this.$t('validation_errors.incorrect_2fa_code')
})
}
// Recovery bad input
if (recovery) {
this.$refs.two_factor_recovery.setErrors({
'Two Factor Recovery': this.$t('validation_errors.incorrect_2fa_recovery_code')
})
}
}
// Repeat the login for next try to type right 2fa code / recovery code
this.singIn()
this.isLoading = false
})
}
},
proceedToAccount() {
if (this.$route.query.redirect) {
this.$router.push(this.$route.query.redirect)
} else {
this.$router.push({name: 'Files'})
}
}
},
created() {
this.$scrollTop()
this.$store.commit('PROCESSING_POPUP', undefined)
if (this.config.isDemo || this.config.isDev) {
this.loginEmail = 'howdy@hi5ve.digital'
this.loginPassword = 'vuefilemanager'
}
}
}
if (this.config.isDemo || this.config.isDev) {
this.loginEmail = 'howdy@hi5ve.digital'
this.loginPassword = 'vuefilemanager'
}
},
}
</script>

View File

@@ -1,72 +1,104 @@
<template>
<AuthContentWrapper ref="auth">
<!--Registration-->
<AuthContent name="sign-up" :visible="true" class="mt-4 mb-12">
<Headline
:title="$t('page_registration.title')"
:description="$t('page_registration.subtitle')"
/>
<Headline :title="$t('page_registration.title')" :description="$t('page_registration.subtitle')" />
<ValidationObserver @submit.prevent="signUp" ref="sign_up" v-slot="{ invalid }" tag="form" class="space-y-4 mb-12 text-left">
<ValidationObserver @submit.prevent="signUp" ref="sign_up" v-slot="{ invalid }" tag="form" class="mb-12 space-y-4 text-left">
<div class="mx-auto mb-5 md:flex md:max-w-lg md:items-center">
<label class="mb-1.5 block font-bold md:mb-0 md:w-72 md:pr-4 md:text-right"> {{ $t('page_registration.label_email') }}: </label>
<ValidationProvider tag="div" mode="passive" class="w-full text-left" name="E-Mail" rules="required" v-slot="{ errors }">
<input
v-model="register.email"
:placeholder="$t('page_registration.placeholder_email')"
type="email"
class="focus-border-theme w-full appearance-none rounded-lg border border-transparent bg-light-background px-5 py-3.5 font-bold dark:bg-2x-dark-foreground"
:class="{ 'border-red': errors[0] }"
/>
<span class="text-left text-xs text-red-600" v-if="errors[0]">{{ errors[0] }}</span>
</ValidationProvider>
</div>
<div class="md:flex md:items-center mb-5 md:max-w-lg mx-auto">
<label class="md:w-72 md:text-right md:pr-4 font-bold md:mb-0 mb-1.5 block">
{{ $t('page_registration.label_email') }}:
</label>
<ValidationProvider tag="div" mode="passive" class="w-full text-left" name="E-Mail" rules="required" v-slot="{ errors }">
<input v-model="register.email" :placeholder="$t('page_registration.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>
</div>
<div class="mx-auto mb-5 md:flex md:max-w-lg md:items-center">
<label class="mb-1.5 block font-bold md:mb-0 md:w-72 md:pr-4 md:text-right"> {{ $t('page_registration.label_name') }}: </label>
<ValidationProvider tag="div" mode="passive" class="w-full text-left" name="Full Name" rules="required" v-slot="{ errors }">
<input
v-model="register.name"
:placeholder="$t('page_registration.placeholder_name')"
type="text"
class="focus-border-theme w-full appearance-none rounded-lg border border-transparent bg-light-background px-5 py-3.5 font-bold dark:bg-2x-dark-foreground"
:class="{ 'border-red': errors[0] }"
/>
<span class="text-left text-xs text-red-600" v-if="errors[0]">{{ errors[0] }}</span>
</ValidationProvider>
</div>
<div class="md:flex md:items-center mb-5 md:max-w-lg mx-auto">
<label class="md:w-72 md:text-right md:pr-4 font-bold md:mb-0 mb-1.5 block">
{{ $t('page_registration.label_name') }}:
</label>
<ValidationProvider tag="div" mode="passive" class="w-full text-left" name="Full Name" rules="required" v-slot="{ errors }">
<input v-model="register.name" :placeholder="$t('page_registration.placeholder_name')" type="text" 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>
</div>
<div class="mx-auto mb-5 md:flex md:max-w-lg md:items-center">
<label class="mb-1.5 block font-bold md:mb-0 md:w-72 md:pr-4 md:text-right"> {{ $t('page_registration.label_pass') }}: </label>
<ValidationProvider tag="div" mode="passive" class="w-full text-left" name="Your New Password" rules="required" v-slot="{ errors }">
<input
v-model="register.password"
:placeholder="$t('page_registration.placeholder_pass')"
type="password"
class="focus-border-theme w-full appearance-none rounded-lg border border-transparent bg-light-background px-5 py-3.5 font-bold dark:bg-2x-dark-foreground"
:class="{ 'border-red': errors[0] }"
/>
<span class="text-left text-xs text-red-600" v-if="errors[0]">{{ errors[0] }}</span>
</ValidationProvider>
</div>
<div class="md:flex md:items-center mb-5 md:max-w-lg mx-auto">
<label class="md:w-72 md:text-right md:pr-4 font-bold md:mb-0 mb-1.5 block">
{{ $t('page_registration.label_pass') }}:
</label>
<ValidationProvider tag="div" mode="passive" class="w-full text-left" name="Your New Password" rules="required" v-slot="{ errors }">
<input v-model="register.password" :placeholder="$t('page_registration.placeholder_pass')" type="password" 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>
</div>
<div class="md:flex md:items-center mb-5 md:max-w-lg mx-auto">
<label class="md:w-72 md:text-right md:pr-4 font-bold md:mb-0 mb-1.5 block">
{{ $t('page_registration.label_confirm_pass') }}:
</label>
<ValidationProvider tag="div" mode="passive" class="w-full text-left" name="Confirm Your Password" rules="required" v-slot="{ errors }">
<input v-model="register.password_confirmation" :placeholder="$t('page_registration.placeholder_confirm_pass')" 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" type="password" :class="{'border-red': errors[0]}"/>
<span class="text-red-600 text-xs text-left" v-if="errors[0]">{{ errors[0] }}</span>
</ValidationProvider>
</div>
<div class="mx-auto mb-5 md:flex md:max-w-lg md:items-center">
<label class="mb-1.5 block font-bold md:mb-0 md:w-72 md:pr-4 md:text-right"> {{ $t('page_registration.label_confirm_pass') }}: </label>
<ValidationProvider tag="div" mode="passive" class="w-full text-left" name="Confirm Your Password" rules="required" v-slot="{ errors }">
<input
v-model="register.password_confirmation"
:placeholder="$t('page_registration.placeholder_confirm_pass')"
class="focus-border-theme w-full appearance-none rounded-lg border border-transparent bg-light-background px-5 py-3.5 font-bold dark:bg-2x-dark-foreground"
type="password"
:class="{ 'border-red': errors[0] }"
/>
<span class="text-left text-xs text-red-600" v-if="errors[0]">{{ errors[0] }}</span>
</ValidationProvider>
</div>
<div class="text-center">
<i18n path="page_registration.agreement" tag="p" class="mx-auto mt-12 mb-6 w-96 font-bold">
<router-link :to="{name: 'DynamicPage', params: {slug: 'terms-of-service'}}" target="_blank" class="text-theme">
{{ termsOfService.title }}
</router-link>
<router-link :to="{name: 'DynamicPage', params: {slug: 'privacy-policy'}}" target="_blank" class="text-theme">
{{ privacyPolicy.title }}
</router-link>
<router-link
:to="{
name: 'DynamicPage',
params: { slug: 'terms-of-service' },
}"
target="_blank"
class="text-theme"
>
{{ termsOfService.title }}
</router-link>
<router-link
:to="{
name: 'DynamicPage',
params: { slug: 'privacy-policy' },
}"
target="_blank"
class="text-theme"
>
{{ privacyPolicy.title }}
</router-link>
</i18n>
<AuthButton class="md:w-min w-full justify-center" icon="chevron-right" :text="$t('page_registration.button_create_account')" :loading="isLoading" :disabled="isLoading"/>
<AuthButton
class="w-full justify-center md:w-min"
icon="chevron-right"
:text="$t('page_registration.button_create_account')"
:loading="isLoading"
:disabled="isLoading"
/>
</div>
</ValidationObserver>
<SocialiteAuthenticationButtons/>
<SocialiteAuthenticationButtons />
<span class="block">{{ $t('page_registration.have_an_account') }}
<router-link :to="{name: 'SignIn'}" class="font-bold text-theme">
<span class="block"
>{{ $t('page_registration.have_an_account') }}
<router-link :to="{ name: 'SignIn' }" class="text-theme font-bold">
{{ $t('page_forgotten_password.password_remember_button') }}
</router-link>
</span>
@@ -75,129 +107,119 @@
</template>
<script>
import Headline from "./Headline";
import AuthContentWrapper from "../../components/Auth/AuthContentWrapper";
import {ValidationProvider, ValidationObserver} from 'vee-validate/dist/vee-validate.full'
import AuthContent from "../../components/Auth/AuthContent";
import AuthButton from "../../components/Auth/AuthButton";
import SocialiteAuthenticationButtons from "../../components/Auth/SocialiteAuthenticationButtons";
import {required} from 'vee-validate/dist/rules'
import {mapGetters} from 'vuex'
import {events} from '../../bus'
import axios from 'axios'
import Headline from './Headline'
import AuthContentWrapper from '../../components/Auth/AuthContentWrapper'
import { ValidationProvider, ValidationObserver } from 'vee-validate/dist/vee-validate.full'
import AuthContent from '../../components/Auth/AuthContent'
import AuthButton from '../../components/Auth/AuthButton'
import SocialiteAuthenticationButtons from '../../components/Auth/SocialiteAuthenticationButtons'
import { required } from 'vee-validate/dist/rules'
import { mapGetters } from 'vuex'
import { events } from '../../bus'
import axios from 'axios'
export default {
name: 'SignUp',
components: {
SocialiteAuthenticationButtons,
AuthContentWrapper,
ValidationProvider,
ValidationObserver,
AuthContent,
AuthButton,
Headline,
required,
export default {
name: 'SignUp',
components: {
SocialiteAuthenticationButtons,
AuthContentWrapper,
ValidationProvider,
ValidationObserver,
AuthContent,
AuthButton,
Headline,
required,
},
computed: {
...mapGetters(['config']),
privacyPolicy() {
return this.config.legal.find((legal) => {
return legal.slug === 'privacy-policy'
})
},
computed: {
...mapGetters([
'config'
]),
privacyPolicy() {
return this.config.legal.find(legal => {
return legal.slug === 'privacy-policy'
})
},
termsOfService() {
return this.config.legal.find(legal => {
return legal.slug === 'terms-of-service'
})
},
termsOfService() {
return this.config.legal.find((legal) => {
return legal.slug === 'terms-of-service'
})
},
data() {
return {
isLoading: false,
register: {
name: '',
email: '',
password: '',
password_confirmation: '',
reCaptcha:null,
},
},
data() {
return {
isLoading: false,
register: {
name: '',
email: '',
password: '',
password_confirmation: '',
reCaptcha: null,
},
}
},
methods: {
async signUp() {
// Validate fields
const isValid = await this.$refs.sign_up.validate()
if (!isValid) return
// Start loading
this.isLoading = true
// Get ReCaptcha token
if (config.allowedRecaptcha) {
this.register.reCaptcha = await this.$reCaptchaToken('register').then((response) => {
return response
})
}
},
methods: {
async signUp() {
// Validate fields
const isValid = await this.$refs.sign_up.validate();
// Send request to get user token
axios
.post('/api/register', this.register)
.then(() => {
// End loading
this.isLoading = false
if (!isValid) return;
if (!this.config.userVerification) {
// Set login state
this.$store.commit('SET_AUTHORIZED', true)
// Start loading
this.isLoading = true
// Go to files page
this.$router.push({ name: 'Files' })
} else {
// Go to SuccessfullySend page
this.$router.push({ name: 'SuccessfullySend' })
}
})
.catch((error) => {
if (error.response.status == 500) {
events.$emit('alert:open', {
emoji: '🤔',
title: this.$t('popup_signup_error.title'),
message: this.$t('popup_signup_error.message'),
})
}
// Get ReCaptcha token
if(config.allowedRecaptcha) {
this.register.reCaptcha = await this.$reCaptchaToken('register').then((response) => {
return response
})
}
// Send request to get user token
axios
.post('/api/register', this.register)
.then(() => {
// End loading
this.isLoading = false
if(! this.config.userVerification) {
// Set login state
this.$store.commit('SET_AUTHORIZED', true)
// Go to files page
this.$router.push({name: 'Files'})
} else {
// Go to SuccessfullySend page
this.$router.push({name: 'SuccessfullySend'})
}
})
.catch(error => {
if (error.response.status == 500) {
events.$emit('alert:open', {
emoji: '🤔',
title: this.$t('popup_signup_error.title'),
message: this.$t('popup_signup_error.message')
if (error.response.status == 422) {
if (error.response.data.errors['email']) {
this.$refs.sign_up.setErrors({
'E-Mail': error.response.data.errors['email'],
})
}
if (error.response.status == 422) {
if (error.response.data.errors['email']) {
this.$refs.sign_up.setErrors({
'E-Mail': error.response.data.errors['email']
});
}
if (error.response.data.errors['password']) {
this.$refs.sign_up.setErrors({
'Your New Password': error.response.data.errors['password']
});
}
if (error.response.data.errors['password']) {
this.$refs.sign_up.setErrors({
'Your New Password': error.response.data.errors['password'],
})
}
}
// End loading
this.isLoading = false
})
}
// End loading
this.isLoading = false
})
},
created() {
this.$scrollTop()
}
}
},
created() {
this.$scrollTop()
},
}
</script>

View File

@@ -1,38 +1,37 @@
<template>
<Spinner/>
<Spinner />
</template>
<script>
import Spinner from "../../components/FilesView/Spinner";
import {events} from "../../bus";
import Spinner from '../../components/FilesView/Spinner'
import { events } from '../../bus'
export default {
name: 'SocialiteCallback',
components: {
Spinner
},
created () {
Spinner,
},
created() {
axios
.get(`/api${this.$route.fullPath}`)
.then(() => {
// Set login state
this.$store.commit('SET_AUTHORIZED', true)
// Go to files page
this.$router.push({name: 'Files'})
this.$router.push({ name: 'Files' })
})
.catch(error => {
if (error.response.status === 401) {
events.$emit('alert:open', {
title: error.response.data.message,
})
} else {
this.$isSomethingWrong()
}
.catch((error) => {
if (error.response.status === 401) {
events.$emit('alert:open', {
title: error.response.data.message,
})
} else {
this.$isSomethingWrong()
}
this.$router.push({name: 'SignIn'})
})
}
this.$router.push({ name: 'SignIn' })
})
},
}
</script>
</script>

View File

@@ -1,31 +1,28 @@
<template>
<AuthContentWrapper class="h-screen">
<AuthContent :visible="true">
<Headline
:title="$t('page_email_successfully_verified.title')"
:description="$t('page_email_successfully_verified.subtitle')"
/>
<router-link :to="{name: 'SignIn'}">
<AuthButton icon="chevron-right" :text="$t('page_sign_in.button_log_in')"/>
<Headline :title="$t('page_email_successfully_verified.title')" :description="$t('page_email_successfully_verified.subtitle')" />
<router-link :to="{ name: 'SignIn' }">
<AuthButton icon="chevron-right" :text="$t('page_sign_in.button_log_in')" />
</router-link>
</AuthContent>
</AuthContentWrapper>
</template>
<script>
import AuthContentWrapper from "../../components/Auth/AuthContentWrapper";
import AuthContent from "../../components/Auth/AuthContent";
import AuthButton from "../../components/Auth/AuthButton";
import Headline from "./Headline";
import AuthContentWrapper from '../../components/Auth/AuthContentWrapper'
import AuthContent from '../../components/Auth/AuthContent'
import AuthButton from '../../components/Auth/AuthButton'
import Headline from './Headline'
export default {
name: 'SuccessfullyEmailVerified',
components: {
AuthContentWrapper,
AuthContent,
AuthButton,
Headline,
},
}
export default {
name: 'SuccessfullyEmailVerified',
components: {
AuthContentWrapper,
AuthContent,
AuthButton,
Headline,
},
}
</script>

View File

@@ -1,13 +1,10 @@
<template>
<AuthContentWrapper class="h-screen">
<AuthContent :visible="true">
<Headline
:title="$t('page_email_successfully_send.title')"
:description="$t('page_email_successfully_send.subtitle')"
/>
<Headline :title="$t('page_email_successfully_send.title')" :description="$t('page_email_successfully_send.subtitle')" />
<span class="block">
<router-link :to="{name: 'Homepage'}" class="font-bold text-theme">
<span class="block">
<router-link :to="{ name: 'Homepage' }" class="text-theme font-bold">
{{ $t('go_home') }}
</router-link>
</span>
@@ -16,18 +13,18 @@
</template>
<script>
import AuthContentWrapper from "../../components/Auth/AuthContentWrapper";
import AuthContent from "../../components/Auth/AuthContent";
import AuthButton from "../../components/Auth/AuthButton";
import Headline from "./Headline"
import AuthContentWrapper from '../../components/Auth/AuthContentWrapper'
import AuthContent from '../../components/Auth/AuthContent'
import AuthButton from '../../components/Auth/AuthButton'
import Headline from './Headline'
export default {
name: 'SuccessfullySendEmail',
components: {
AuthContentWrapper,
AuthContent,
AuthButton,
Headline,
},
}
export default {
name: 'SuccessfullySendEmail',
components: {
AuthContentWrapper,
AuthContent,
AuthButton,
Headline,
},
}
</script>