diff --git a/src/components/LoginSystem.vue b/src/components/LoginSystem.vue index 1301375ba6514013a3d9b2f8d999d0eb09c615d4..d6c0ed2e3dccb796c846b34f7faed223b25245c7 100644 --- a/src/components/LoginSystem.vue +++ b/src/components/LoginSystem.vue @@ -77,7 +77,7 @@ {{ $t("login.forgotpassword.success.msg")}} </div> - <div v-if="submitFailed" class="form-group alert alert-danger mt-4"> + <div v-if="submitFailed && errorMessage" class="form-group alert alert-danger mt-4"> {{ errorMessage }} </div> </form> @@ -152,10 +152,9 @@ headers: jsonHeader, }).then((response) => { if (response.status != 200 && response.status != 201) { - this.createError(response.status) this.$root.sharedState.uuid = ''; } else { - this.removeError(); + this.getUserFromStorage(); /** Sync Operation for valid timestamp */ this.$refs.Sync.syncOneWayDifferentTimeStamp(this.appUser); @@ -173,7 +172,7 @@ }, /** Login process . sending user credential */ handleLogin() { - this.showForgottenPasswordSubmitSuccessMsg = false; + this.showForgottenPasswordSubmitSuccessMsg = false; this.removeError(); let This = this; @@ -182,7 +181,7 @@ // Validate input if (!this.username || !this.password) { - this.createError(-1, this.$i18n.t("login.systems.user.password.required")) + this.createLoginError(-1, this.$i18n.t("login.systems.user.password.required")) return } let jsonBody = JSON.stringify({"username": this.username, "password": this.password}); @@ -203,7 +202,7 @@ return response.json(); } else { - This.createError(response.status); + This.createLoginError(response.status); return false; } }) @@ -287,7 +286,7 @@ this.removeError(); if(!this.email || this.email.indexOf("@") < 0) { - this.createError(-1, this.$i18n.t("login.systems.invalid.email")); + this.createLoginError(-1, this.$i18n.t("login.systems.invalid.email")); return; } const formData = new URLSearchParams(); @@ -341,12 +340,14 @@ this.submitFailed = false; this.errorMessage = undefined; }, - createError(status, message) { + createLoginError(status, message) { this.submitFailed = true; if(message) { this.errorMessage = message; } else if (status === 500 || status === 503) { this.errorMessage = this.$i18n.t("login.systems.server.error"); + } else if(status === 404) { + this.errorMessage = this.$i18n.t("login.systems.wrong.credential"); } else { this.errorMessage = "Error " + status; }