From 306ae7648d5c34d71e24df371a075638c0a89e8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Gr=C3=B6ger?= Date: Sat, 14 Nov 2020 14:41:46 +0100 Subject: [PATCH] [Login] Fehlermeldung bei falschen Credentials --- src/boot/login.ts | 4 ++++ src/pages/Login.vue | 2 +- src/plugins/user/store/session.ts | 10 ++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/boot/login.ts b/src/boot/login.ts index 06582ac..06e718a 100644 --- a/src/boot/login.ts +++ b/src/boot/login.ts @@ -7,6 +7,10 @@ export default boot>(({ router, store }) => { router.beforeEach((to, from, next) => { const session = store.state.session.currentSession; + if (to.path == from.path) { + return; + } + if (to.path.startsWith('/main')) { // Secured area (LOGIN REQUIRED) // Check login is ok diff --git a/src/pages/Login.vue b/src/pages/Login.vue index 323cdad..e117fa9 100644 --- a/src/pages/Login.vue +++ b/src/pages/Login.vue @@ -60,7 +60,7 @@ export default defineComponent({ }) .then(() => { const x = root.$route.query['redirect']; - void root.$router.replace( + void root.$router.push( typeof x === 'string' ? { path: x } : mainRoute ); }) diff --git a/src/plugins/user/store/session.ts b/src/plugins/user/store/session.ts index cb2e1a4..d605f65 100644 --- a/src/plugins/user/store/session.ts +++ b/src/plugins/user/store/session.ts @@ -5,6 +5,7 @@ import { axios } from 'src/boot/axios'; import { AxiosError, AxiosResponse } from 'axios'; import { Router } from 'src/router'; import { LocalStorage } from 'quasar'; +import { Notify } from 'quasar'; export interface SessionInterface { currentSession?: FG.Session; @@ -66,6 +67,15 @@ const actions: ActionTree = { commit('user/setCurrentPermissions', response.data.permissions, { root: true }); + }) + .catch(() => { + Notify.create({ + type: 'negative', + message: 'Benutzername oder Passwort sind falsch.', + timeout: 10000, + progress: true, + actions: [{ icon: 'mdi-close', color: 'white' }] + }); }); }, /**