From 763d8d37df34d2f4cb6f4f7e4e47e29c2bb36a78 Mon Sep 17 00:00:00 2001 From: Siddharth Ramesh Date: Sat, 20 Mar 2021 17:44:58 +0530 Subject: [PATCH] Fix error messages during login for non-verified users (#1945) --- app/javascript/dashboard/routes/login/Login.vue | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/javascript/dashboard/routes/login/Login.vue b/app/javascript/dashboard/routes/login/Login.vue index 24541da90..a56a02ad6 100644 --- a/app/javascript/dashboard/routes/login/Login.vue +++ b/app/javascript/dashboard/routes/login/Login.vue @@ -149,7 +149,13 @@ export default { } if (response && response.status === 401) { - this.showAlert(this.$t('LOGIN.API.UNAUTH')); + const { errors } = response.data; + const hasAuthErrorMsg = errors && errors.length && errors[0] && typeof errors[0] === 'string'; + if (hasAuthErrorMsg) { + this.showAlert(errors[0]); + } else { + this.showAlert(this.$t('LOGIN.API.UNAUTH')); + } return; } this.showAlert(this.$t('LOGIN.API.ERROR_MESSAGE'));