[Login] Fehlermeldung bei falschen Credentials

This commit is contained in:
Tim Gröger 2020-11-14 14:41:46 +01:00
parent 60417f6585
commit 306ae7648d
3 changed files with 15 additions and 1 deletions

View File

@ -7,6 +7,10 @@ export default boot<Store<StateInterface>>(({ router, store }) => {
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
const session = store.state.session.currentSession; const session = store.state.session.currentSession;
if (to.path == from.path) {
return;
}
if (to.path.startsWith('/main')) { if (to.path.startsWith('/main')) {
// Secured area (LOGIN REQUIRED) // Secured area (LOGIN REQUIRED)
// Check login is ok // Check login is ok

View File

@ -60,7 +60,7 @@ export default defineComponent({
}) })
.then(() => { .then(() => {
const x = root.$route.query['redirect']; const x = root.$route.query['redirect'];
void root.$router.replace( void root.$router.push(
typeof x === 'string' ? { path: x } : mainRoute typeof x === 'string' ? { path: x } : mainRoute
); );
}) })

View File

@ -5,6 +5,7 @@ import { axios } from 'src/boot/axios';
import { AxiosError, AxiosResponse } from 'axios'; import { AxiosError, AxiosResponse } from 'axios';
import { Router } from 'src/router'; import { Router } from 'src/router';
import { LocalStorage } from 'quasar'; import { LocalStorage } from 'quasar';
import { Notify } from 'quasar';
export interface SessionInterface { export interface SessionInterface {
currentSession?: FG.Session; currentSession?: FG.Session;
@ -66,6 +67,15 @@ const actions: ActionTree<SessionInterface, StateInterface> = {
commit('user/setCurrentPermissions', response.data.permissions, { commit('user/setCurrentPermissions', response.data.permissions, {
root: true root: true
}); });
})
.catch(() => {
Notify.create({
type: 'negative',
message: 'Benutzername oder Passwort sind falsch.',
timeout: 10000,
progress: true,
actions: [{ icon: 'mdi-close', color: 'white' }]
});
}); });
}, },
/** /**