diff --git a/dashboard/src/auth.ts b/dashboard/src/auth.ts index 4b934970..6795f4b4 100644 --- a/dashboard/src/auth.ts +++ b/dashboard/src/auth.ts @@ -15,8 +15,17 @@ export const authGuard: NavigationGuard = async (to, from, next) => { }; export const loginCallbackGuard: NavigationGuard = async (to, from, next) => { - await RootStore.dispatch("auth/setApiKey", to.query.apiKey); - next("/dashboard"); + if (to.query.apiKey) { + await RootStore.dispatch("auth/setApiKey", to.query.apiKey); + next("/dashboard"); + } else { + next({ + path: "/", + query: { + error: "noaccess", + }, + }); + } }; export const authRedirectGuard: NavigationGuard = async (to, form, next) => { diff --git a/dashboard/src/components/Dashboard.vue b/dashboard/src/components/Dashboard.vue index e610668c..084c135b 100644 --- a/dashboard/src/components/Dashboard.vue +++ b/dashboard/src/components/Dashboard.vue @@ -13,7 +13,7 @@ @@ -41,6 +41,12 @@ export default { async mounted() { await import("../style/dashboard.scss"); - } + }, + methods: { + async logout() { + await this.$store.dispatch("auth/logout"); + this.$router.push('/'); + } + }, }; diff --git a/dashboard/src/components/Splash.vue b/dashboard/src/components/Splash.vue index 51a07a78..165e2e27 100644 --- a/dashboard/src/components/Splash.vue +++ b/dashboard/src/components/Splash.vue @@ -1,14 +1,22 @@