Registration and activation
This commit is contained in:
@@ -1,11 +1,17 @@
|
||||
import { createRouter, createWebHistory } from 'vue-router';
|
||||
import HomeView from '../views/HomeView.vue';
|
||||
import ActivateView from '../views/auth/ActivateView.vue';
|
||||
|
||||
const routes = [
|
||||
{
|
||||
path: '/',
|
||||
name: 'Home',
|
||||
component: HomeView
|
||||
},
|
||||
{
|
||||
path: '/activate',
|
||||
name: 'Activate page',
|
||||
component: ActivateView
|
||||
}
|
||||
];
|
||||
|
||||
@@ -18,8 +24,10 @@ router.beforeEach((to, from, next) => {
|
||||
if (to.matched.some(record => record.meta.requiresAuth)) {
|
||||
if (!store.getters.isLoggedIn) {
|
||||
next('/');
|
||||
} else {
|
||||
} else if (!store.user.active) {
|
||||
next();
|
||||
} else {
|
||||
next('/activate');
|
||||
}
|
||||
} else {
|
||||
next();
|
||||
|
||||
Reference in New Issue
Block a user