Browse Source

Enable to show login error message

pull/341/head
Hironsan 5 years ago
parent
commit
c2aad87011
2 changed files with 17 additions and 4 deletions
  1. 20
      frontend/components/organisms/auth/LoginForm.vue
  2. 1
      frontend/store/auth.js

20
frontend/components/organisms/auth/LoginForm.vue

@ -10,14 +10,23 @@
ref="form" ref="form"
v-model="valid" v-model="valid"
> >
<v-alert
v-show="showError"
v-model="showError"
type="error"
dismissible
>
Incorrect username or password.
</v-alert>
<v-text-field <v-text-field
v-model="username" v-model="username"
:rules="userNameRules" :rules="userNameRules"
label="Login"
name="login"
label="Username"
name="username"
prepend-icon="person" prepend-icon="person"
type="text" type="text"
autofocus autofocus
@keyup.enter="tryLogin"
/> />
<v-text-field <v-text-field
id="password" id="password"
@ -27,6 +36,7 @@
name="password" name="password"
prepend-icon="lock" prepend-icon="lock"
type="password" type="password"
@keyup.enter="tryLogin"
/> />
</v-form> </v-form>
</template> </template>
@ -54,7 +64,8 @@ export default {
username: '', username: '',
password: '', password: '',
userNameRules, userNameRules,
passwordRules
passwordRules,
showError: false
} }
}, },
@ -71,6 +82,9 @@ export default {
.then((result) => { .then((result) => {
this.$router.push('/projects') this.$router.push('/projects')
}) })
.catch(() => {
this.showError = true
})
} }
} }
} }

1
frontend/store/auth.js

@ -30,7 +30,6 @@ export const actions = {
Cookie.set('jwt', result.data.token) Cookie.set('jwt', result.data.token)
ApiService.setHeader(result.data.token) ApiService.setHeader(result.data.token)
}) })
.catch(e => alert(e))
}, },
initAuth({ commit, dispatch }, req) { initAuth({ commit, dispatch }, req) {
let token let token

Loading…
Cancel
Save