fixed homepage redirection when homepage is disabled

This commit is contained in:
Čarodej
2022-05-10 09:53:13 +02:00
parent 73c84075c5
commit 209667f55e
6 changed files with 26 additions and 12 deletions

View File

@@ -131,6 +131,11 @@ export default {
this.isLoaded = true
})
}
// Go to sign in page if homepage is disabled
if (!this.$root.$data.config.allowHomepage && window.location.pathname === '/') {
this.$router.push({ name: 'SignIn' })
}
},
created() {
if (this.$isWindows()) {

View File

@@ -114,7 +114,7 @@ const actions = {
})
.catch((error) => {
events.$emit('alert:open', {
title: error.response.data.message,
title: error.response.data.message || i18n.t('popup_error.title'),
message: i18n.t('popup_error.message'),
})
})

View File

@@ -32,7 +32,7 @@ const actions = {
})
})
},
logOut: ({ commit }) => {
logOut: ({ commit, getters }) => {
let popup = setTimeout(() => {
commit('PROCESSING_POPUP', {
@@ -50,7 +50,11 @@ const actions = {
commit('DESTROY_DATA')
commit('SET_AUTHORIZED', false)
router.push({name: 'Homepage'})
// Get redirect location
let redirectLocation = getters.config.allowHomepage ? 'Homepage' : 'SignIn'
// Redirect user
router.push({name: redirectLocation})
})
},
socialiteRedirect: ({ commit }, provider) => {

View File

@@ -1,5 +1,5 @@
<template>
<AuthContentWrapper ref="auth" class="h-screen">
<AuthContentWrapper v-if="isVisible" ref="auth" class="h-screen">
<!--Log In by Email-->
<AuthContent name="log-in" :visible="true">
<Headline :title="$t('welcome_back')" :description="$t('page_login.subtitle')" />
@@ -256,6 +256,7 @@ export default {
},
data() {
return {
isVisible: false,
isLoading: false,
validSignIn: false,
checkedAccount: undefined,
@@ -443,14 +444,20 @@ export default {
}
},
},
created() {
this.$scrollTop()
this.$store.commit('PROCESSING_POPUP', undefined)
mounted() {
// Redirect if user is authenticated
if (this.$root.$data.config.isAuthenticated) {
this.$router.push({name: 'Files'})
}
},
created() {
// Show the page when user is not authenticated
if (! this.$root.$data.config.isAuthenticated) {
this.isVisible = true
}
this.$scrollTop()
this.$store.commit('PROCESSING_POPUP', undefined)
if (this.config.isDemo || this.config.isDev) {
this.loginEmail = 'howdy@hi5ve.digital'

View File

@@ -64,8 +64,6 @@ export default {
}
},
mounted() {
if (!this.config.allowHomepage) this.$router.push({ name: 'SignIn' })
// Get page content
axios
.get('/api/settings', {