From 561c590666fd15501e83924f5e4e75a367884e15 Mon Sep 17 00:00:00 2001
From: Dominik Seeger <dominik.seeger@gmx.net>
Date: Tue, 18 Jun 2019 19:53:57 +0200
Subject: [PATCH] removed student greeting, fixed login issue

---
 frontend/src/components/BaseLayout.vue |  9 +++++++--
 frontend/src/pages/Login.vue           | 15 ++++++++++-----
 2 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/frontend/src/components/BaseLayout.vue b/frontend/src/components/BaseLayout.vue
index b5407e46..05b3054e 100644
--- a/frontend/src/components/BaseLayout.vue
+++ b/frontend/src/components/BaseLayout.vue
@@ -69,7 +69,7 @@
       <span class="pl-2 grady-speak">{{ gradySpeak }}</span>
       <v-spacer/>
       <slot name="toolbar-center"/>
-      <div class="toolbar-content">
+      <div class="toolbar-content" v-if="getDropdownShow">
         <v-menu bottom offset-y>
           <v-btn slot="activator" color="cyan" style="text-transform: none">
             {{ userRole }} | {{ username }} <v-icon>arrow_drop_down</v-icon>
@@ -90,6 +90,7 @@ import { mapStateToComputedGetterSetter } from '@/util/helpers'
 import UserOptions from '@/components/UserOptions'
 import { Authentication } from '@/store/modules/authentication'
 import { actions } from '@/store/actions'
+import { UserAccount } from '../models';
 
 export default {
   name: 'base-layout',
@@ -121,7 +122,11 @@ export default {
     },
     productionBrandUrl () {
       return `https://${window.location.host}/static/img/brand.png`
-    }
+    },
+    getDropdownShow () {
+      return this.userRole == UserAccount.RoleEnum.Tutor ||
+             this.userRole == UserAccount.RoleEnum.Reviewer;
+    },
   },
   methods: {
     logout () {
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