aboutsummaryrefslogtreecommitdiff
path: root/src/components/login_form
diff options
context:
space:
mode:
authorRoger Braun <roger@rogerbraun.net>2017-03-09 10:33:21 +0100
committerRoger Braun <roger@rogerbraun.net>2017-03-09 10:33:21 +0100
commit0eeccb87cef4d137710e3c7fd215b94e45aff3d1 (patch)
tree584085071af589e58f79ffb67051c49b6bd883bb /src/components/login_form
parent290180a987ecb4949fc877c512f3cff120bcbc70 (diff)
parent64d71b75cfed41d82a99e3e478fc75d5f81f84bd (diff)
Merge branch 'develop' into feature/hash-routed
Diffstat (limited to 'src/components/login_form')
-rw-r--r--src/components/login_form/login_form.js14
-rw-r--r--src/components/login_form/login_form.vue13
2 files changed, 22 insertions, 5 deletions
diff --git a/src/components/login_form/login_form.js b/src/components/login_form/login_form.js
index b55f770f..1a6f6015 100644
--- a/src/components/login_form/login_form.js
+++ b/src/components/login_form/login_form.js
@@ -1,15 +1,21 @@
const LoginForm = {
data: () => ({
- user: {}
+ user: {},
+ authError: false
}),
computed: {
loggingIn () { return this.$store.state.users.loggingIn }
},
methods: {
submit () {
- this.$store.dispatch('loginUser', this.user).then(() => {
- this.$router.push('/main/friends')
- })
+ this.$store.dispatch('loginUser', this.user).then(
+ () => {},
+ (error) => {
+ this.authError = error
+ this.user.username = ''
+ this.user.password = ''
+ }
+ )
}
}
}
diff --git a/src/components/login_form/login_form.vue b/src/components/login_form/login_form.vue
index c0ea4313..b2fa5341 100644
--- a/src/components/login_form/login_form.vue
+++ b/src/components/login_form/login_form.vue
@@ -1,7 +1,7 @@
<template>
<div class="login panel panel-default base00-background">
<!-- Default panel contents -->
- <div class="panel-heading base01-background">
+ <div class="panel-heading base01-background base04">
Log in
</div>
<div class="panel-body">
@@ -17,6 +17,9 @@
<div class='form-group'>
<button :disabled="loggingIn" type='submit' class='btn btn-default base05 base01-background'>Submit</button>
</div>
+ <div v-if="authError" class='form-group'>
+ <div class='error base05'>{{authError}}</div>
+ </div>
</form>
</div>
</div>
@@ -39,6 +42,14 @@
margin-top: 1.0em;
min-height: 28px;
}
+
+ .error {
+ border-radius: 5px;
+ text-align: center;
+ background-color: rgba(255, 48, 16, 0.65);
+ min-height: 28px;
+ line-height: 28px;
+ }
}
</style>