diff options
Diffstat (limited to 'src/components/login_form')
| -rw-r--r-- | src/components/login_form/login_form.js | 9 | ||||
| -rw-r--r-- | src/components/login_form/login_form.vue | 20 |
2 files changed, 25 insertions, 4 deletions
diff --git a/src/components/login_form/login_form.js b/src/components/login_form/login_form.js index 013222a8..ae9322d5 100644 --- a/src/components/login_form/login_form.js +++ b/src/components/login_form/login_form.js @@ -22,6 +22,7 @@ const LoginForm = { oauth: this.$store.state.oauth, instance: this.$store.state.instance.server } + this.clearError() oauthApi.getOrCreateApp(data).then((app) => { oauthApi.getTokenWithCredentials( { @@ -30,11 +31,19 @@ const LoginForm = { username: this.user.username, password: this.user.password}) .then((result) => { + if (result.error) { + this.authError = result.error + this.user.password = '' + return + } this.$store.commit('setToken', result.access_token) this.$store.dispatch('loginUser', result.access_token) this.$router.push({name: 'friends'}) }) }) + }, + clearError () { + this.authError = false } } } diff --git a/src/components/login_form/login_form.vue b/src/components/login_form/login_form.vue index 12971882..b6a15776 100644 --- a/src/components/login_form/login_form.vue +++ b/src/components/login_form/login_form.vue @@ -33,6 +33,12 @@ </div> </div> </form> + <div v-if="authError" class='form-group'> + <div class='alert error'> + {{authError}} + <i class="button-icon icon-cancel" @click="clearError"></i> + </div> + </div> </div> </div> </template> @@ -48,10 +54,6 @@ width: 10em; } - .error { - text-align: center; - } - .register { flex: 1 1; } @@ -64,4 +66,14 @@ justify-content: space-between; } } + +.login { + .error { + text-align: center; + + animation-name: shakeError; + animation-duration: 0.4s; + animation-timing-function: ease-in-out; + } +} </style> |
