diff --git a/src/front/src/components/UI/Auth-form.vue b/src/front/src/components/UI/Auth-form.vue
index b38753585..79f625aef 100644
--- a/src/front/src/components/UI/Auth-form.vue
+++ b/src/front/src/components/UI/Auth-form.vue
@@ -109,6 +109,7 @@ import {useAppStore} from '@/store/app'
import { useVuelidate } from '@vuelidate/core'
import { required, helpers } from '@vuelidate/validators'
import { ref, reactive, computed, onMounted } from 'vue'
+import { useRouter } from 'vue-router';
const req= helpers.withMessage('Обязательное поле', required)
@@ -122,7 +123,7 @@ export default {
const err = ref('')
const alert = ref(false)
const eyeshow = ref(false)
-
+ const router = useRouter()
const anon=reactive({
username:"9966-00-",
@@ -158,7 +159,9 @@ export default {
}
-
+ finally {
+ router.push('/')
+ }
}
}
diff --git a/src/front/src/layouts/default/AppHeader.vue b/src/front/src/layouts/default/AppHeader.vue
index 866e0a7fe..d673cd4a4 100644
--- a/src/front/src/layouts/default/AppHeader.vue
+++ b/src/front/src/layouts/default/AppHeader.vue
@@ -1,5 +1,5 @@
-
+
@@ -13,14 +13,14 @@
-
+
\ No newline at end of file
diff --git a/src/front/src/router/index.js b/src/front/src/router/index.js
index 2b5408c86..4afedced2 100644
--- a/src/front/src/router/index.js
+++ b/src/front/src/router/index.js
@@ -1,15 +1,18 @@
-// Composables
import { createRouter, createWebHistory } from "vue-router";
import { useAccountStore } from "@/store/AccountStore";
const routes = [
+ {
+ path: "/auth",
+ component: () => import('@/pages/AuthorizePage.vue'),
+ name: "Auth",
+ },
{
path: "/",
component: () => import("@/layouts/default/DefaultPortal.vue"),
meta: {
- title: "Вход",
+ requiresAuth: true,
},
-
children: [
{
path: "/",
@@ -208,23 +211,12 @@ const router = createRouter({
routes,
});
-
-function isSuperuser() {
- const accountStore = useAccountStore();
-
- if (accountStore.user.is_superuser === false) {
- return true;
- } else {
- return false;
- }
-}
-
router.beforeEach((to, from, next) => {
- if (to.meta.requiresAuth && isSuperuser()) {
+ const accountStore = useAccountStore();
+ if (to.meta.requiresAuth && !accountStore.cod2user) {
document.title = to.meta.title;
- next("/");
+ next("/auth");
} else {
- document.title = to.meta.title;
next();
}
});
diff --git a/src/front/src/store/AccountStore.js b/src/front/src/store/AccountStore.js
index 9e96c19ac..39cdd0352 100644
--- a/src/front/src/store/AccountStore.js
+++ b/src/front/src/store/AccountStore.js
@@ -5,11 +5,12 @@ import { clearAxios, spravURL } from "@/utils/axios-api";
import VueJwtDecode from "vue-jwt-decode";
import { checkremote } from "@/utils/universal_functions";
import { useAppStore } from "@/store/app.js";
+import { useRouter } from "vue-router";
export const useAccountStore = defineStore("AccountStore", () => {
const AppStore = useAppStore();
const user = ref(getuserFromStorage());
-
+ const router = useRouter();
@@ -62,7 +63,7 @@ export const useAccountStore = defineStore("AccountStore", () => {
if (settingsStorage.value === null) {
settingsUp(defaultSettings)
}
-
+ console.log(user.value);
AppStore.loading = false;
};
@@ -72,7 +73,7 @@ export const useAccountStore = defineStore("AccountStore", () => {
user.value = {};
localStorage.removeItem("access");
localStorage.removeItem("refresh");
-
+ router.push('/auth')
};
watch(
user,
diff --git a/src/front/src/store/MainmenuStore.js b/src/front/src/store/MainmenuStore.js
index 2803ac238..e38d37806 100644
--- a/src/front/src/store/MainmenuStore.js
+++ b/src/front/src/store/MainmenuStore.js
@@ -1,5 +1,5 @@
import { defineStore } from 'pinia'
-import {ref, watch} from 'vue'
+import { ref } from 'vue'
import { clearAxios } from '@/utils/axios-api'
export const useMainmenuStore = defineStore('MainmenuStore', () => {
diff --git a/src/front/src/views/NewsPage.vue b/src/front/src/views/NewsPage.vue
index 94f7440a0..7f717e18a 100644
--- a/src/front/src/views/NewsPage.vue
+++ b/src/front/src/views/NewsPage.vue
@@ -1,14 +1,7 @@
-
+
-
-
-
-
-
-
-