diff --git a/src/views/LoginPage.vue b/src/views/LoginPage.vue
index 50c45a2..7f4591f 100644
--- a/src/views/LoginPage.vue
+++ b/src/views/LoginPage.vue
@@ -14,10 +14,10 @@
@keyup.enter="submitLogin"
v-model="user.password" clearable
type="password">
-
- {{ error }}
-
Login
+
+ {{ error_message }}
+
@@ -34,13 +34,16 @@ export default {
email: "",
password: ""
},
- error: "",
+ show_error: false,
+ error_message: "",
error_count: 0,
logging_in: false
}
},
methods: {
submitLogin() {
+ this.error_message = ""
+ this.show_error = false
let url = this.$api_url + "/users/login"
this.logging_in = true
console.log("Logging in...")
@@ -62,28 +65,32 @@ export default {
window.location.href = '/'
}
} else {
- this.error = "Login failed. Invalid username or password."
+ this.error_message = "Login failed. Invalid username or password."
this.error_count += 1
}
})
.catch(error => {
console.log(error)
- this.error = "Login failed. Invalid username or password."
+ this.error_message = "Login failed. Invalid username or password."
this.error_count += 1
})
.finally(() => {
- console.log(this.error_count)
- this.logging_in = false
- if (this.error_count > 2) {
- let box = document.getElementById("login-box")
- box.classList.add("animate__animated")
- box.classList.add("animate__hinge")
- setTimeout(() => {
- box.classList.add("animate__fadeInUp")
- box.classList.remove("animate__hinge")
- },5000)
- this.error_count = 0
- }
+ setTimeout(() => {
+ if (this.error_message != ""){
+ this.show_error = true
+ }
+ this.logging_in = false
+ if (this.error_count > 2) {
+ let box = document.getElementById("login-box")
+ box.classList.add("animate__animated")
+ box.classList.add("animate__hinge")
+ setTimeout(() => {
+ box.classList.add("animate__fadeInUp")
+ box.classList.remove("animate__hinge")
+ },5000)
+ this.error_count = 0
+ }
+ },2000)
})
}
}