From 80b7c26a5b2be1190bc9e3263d92d1234b6c38d7 Mon Sep 17 00:00:00 2001
From: "dominik.seeger" <dominik.seeger@stud.uni-goettingen.de>
Date: Fri, 8 Mar 2019 16:08:30 +0100
Subject: [PATCH] Resolve "Logout shortly after logging in"

---
 frontend/src/pages/Login.vue | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/frontend/src/pages/Login.vue b/frontend/src/pages/Login.vue
index db914c5c..c73fc809 100644
--- a/frontend/src/pages/Login.vue
+++ b/frontend/src/pages/Login.vue
@@ -72,12 +72,17 @@ 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) => {
+        Auth.SET_MESSAGE("Login failed. Please try again.")
+        this.loading = false
+      })
     },
     registered (credentials) {
       this.registerDialog = false
-- 
GitLab