From e87243e3f1cd82764574cb0acd97ce4fecb2a02d Mon Sep 17 00:00:00 2001 From: kolaente Date: Sun, 1 Nov 2020 17:55:57 +0100 Subject: [PATCH] Move redirect to home to no auth component --- src/components/home/contentNoAuth.vue | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/components/home/contentNoAuth.vue b/src/components/home/contentNoAuth.vue index a9f7d492f..4ae5dce31 100644 --- a/src/components/home/contentNoAuth.vue +++ b/src/components/home/contentNoAuth.vue @@ -18,8 +18,25 @@ import {mapState} from 'vuex' export default { name: 'contentNoAuth', + beforeCreate() { + this.redirectToHome() + }, computed: mapState({ motd: state => state.config.motd, }), + methods: { + redirectToHome() { + // Check if the user is already logged in and redirect them to the home page if not + if ( + this.$route.name !== 'user.login' && + this.$route.name !== 'user.password-reset.request' && + this.$route.name !== 'user.password-reset.reset' && + this.$route.name !== 'user.register' && + this.$route.name !== 'link-share.auth' + ) { + this.$router.push({name: 'user.login'}) + } + }, + }, }