2020-11-01 17:36:00 +00:00
|
|
|
<template>
|
2021-11-13 19:49:02 +00:00
|
|
|
<no-auth-wrapper>
|
|
|
|
<router-view/>
|
|
|
|
</no-auth-wrapper>
|
2020-11-01 17:36:00 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2021-11-13 19:49:02 +00:00
|
|
|
import {saveLastVisited} from '@/helpers/saveLastVisited'
|
|
|
|
import NoAuthWrapper from '@/components/misc/no-auth-wrapper'
|
2021-10-03 18:48:02 +00:00
|
|
|
|
2020-11-01 17:36:00 +00:00
|
|
|
export default {
|
|
|
|
name: 'contentNoAuth',
|
2021-11-13 19:49:02 +00:00
|
|
|
components: {NoAuthWrapper},
|
2021-10-02 21:28:37 +00:00
|
|
|
computed: {
|
|
|
|
routeName() {
|
|
|
|
return this.$route.name
|
|
|
|
},
|
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
routeName: {
|
|
|
|
handler(routeName) {
|
|
|
|
if (!routeName) return
|
|
|
|
this.redirectToHome()
|
|
|
|
},
|
|
|
|
immediate: true,
|
|
|
|
},
|
2020-11-01 17:36:00 +00:00
|
|
|
},
|
|
|
|
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' &&
|
2020-11-21 16:38:40 +00:00
|
|
|
this.$route.name !== 'link-share.auth' &&
|
2020-12-30 20:43:43 +00:00
|
|
|
this.$route.name !== 'openid.auth' &&
|
|
|
|
localStorage.getItem('passwordResetToken') === null &&
|
|
|
|
localStorage.getItem('emailConfirmToken') === null
|
2020-11-01 17:36:00 +00:00
|
|
|
) {
|
2021-10-13 19:53:39 +00:00
|
|
|
saveLastVisited(this.$route.name, this.$route.params)
|
2020-11-01 17:36:00 +00:00
|
|
|
this.$router.push({name: 'user.login'})
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
</script>
|