From aba72e0ccc40b586f933d222d8f8c0f9e1962714 Mon Sep 17 00:00:00 2001 From: Dominik Seeger <dominik.seeger@gmx.net> Date: Fri, 8 Mar 2019 15:08:01 +0100 Subject: [PATCH 1/2] token lifetime information should now be available before login --- frontend/src/pages/Login.vue | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/frontend/src/pages/Login.vue b/frontend/src/pages/Login.vue index db914c5c..5ed04e8c 100644 --- a/frontend/src/pages/Login.vue +++ b/frontend/src/pages/Login.vue @@ -72,12 +72,14 @@ export default { submit () { this.loading = true Auth.getJWT(this.credentials).then(() => { - Auth.getUser().then(() => { - this.$router.push({ name: 'home' }) - }) - Auth.getJWTTimeDelta() + return Promise.all([ + Auth.getUser(), + Auth.getJWTTimeDelta() + ]) + }).then(() => { + this.$router.push({ name: 'home' }) this.loading = false - }).catch(() => { this.loading = false }) + }).catch((er) => { this.loading = false }) }, registered (credentials) { this.registerDialog = false -- GitLab From 06853395bd2cc3e5ac5705995d81af84592af95e Mon Sep 17 00:00:00 2001 From: Dominik Seeger <dominik.seeger@gmx.net> Date: Fri, 8 Mar 2019 15:41:16 +0100 Subject: [PATCH 2/2] included error message --- frontend/src/pages/Login.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frontend/src/pages/Login.vue b/frontend/src/pages/Login.vue index 5ed04e8c..c73fc809 100644 --- a/frontend/src/pages/Login.vue +++ b/frontend/src/pages/Login.vue @@ -79,7 +79,10 @@ export default { }).then(() => { this.$router.push({ name: 'home' }) this.loading = false - }).catch((er) => { this.loading = false }) + }).catch((er) => { + Auth.SET_MESSAGE("Login failed. Please try again.") + this.loading = false + }) }, registered (credentials) { this.registerDialog = false -- GitLab