From 8794741878aabc3ca357ed097c2a35eef4ac2e0b Mon Sep 17 00:00:00 2001
From: Nicolas Pennec
+
+ {{ $t('login.login_server_failed') }} +
+{{ $t('login.too_many_failed_login_attemps') }}
{
@@ -159,6 +164,8 @@ export default {
this.isMissingOTP = true
this.preferredTwoFA = err.preferred_two_factor_authentication
this.TwoFAsEnabled = err.two_factor_authentication_enabled
+ } else if (err.server_error) {
+ this.isServerError = true
} else {
console.error(err)
}
@@ -236,6 +243,10 @@ export default {
padding: 0.25em;
}
+.error {
+ text-align: center;
+}
+
@media (max-width: 1600px) {
.box {
margin-top: 4em;
diff --git a/src/lib/auth.js b/src/lib/auth.js
index dedc602478..220ac519d2 100644
--- a/src/lib/auth.js
+++ b/src/lib/auth.js
@@ -15,22 +15,27 @@ const auth = {
.send(payload)
.end((err, res) => {
if (err) {
- if (res.body.default_password) {
- err.default_password = res.body.default_password
- err.token = res.body.token
+ if (res?.body) {
+ if (res.body.default_password) {
+ err.default_password = res.body.default_password
+ err.token = res.body.token
+ }
+ if (res.body.too_many_failed_login_attemps) {
+ err.too_many_failed_login_attemps = true
+ }
+ if (res.body.wrong_OTP) {
+ err.wrong_OTP = true
+ }
+ if (res.body.missing_OTP) {
+ err.missing_OTP = true
+ err.preferred_two_factor_authentication =
+ res.body.preferred_two_factor_authentication
+ err.two_factor_authentication_enabled =
+ res.body.two_factor_authentication_enabled
+ }
}
- if (res.body.too_many_failed_login_attemps) {
- err.too_many_failed_login_attemps = true
- }
- if (res.body.wrong_OTP) {
- err.wrong_OTP = true
- }
- if (res.body.missing_OTP) {
- err.missing_OTP = true
- err.preferred_two_factor_authentication =
- res.body.preferred_two_factor_authentication
- err.two_factor_authentication_enabled =
- res.body.two_factor_authentication_enabled
+ if (!res || err.status >= 500) {
+ err.server_error = true
}
callback(err)
} else {
diff --git a/src/locales/en.js b/src/locales/en.js
index 1c22b5afeb..8c27c08568 100644
--- a/src/locales/en.js
+++ b/src/locales/en.js
@@ -323,6 +323,7 @@ export default {
information_recovery_code: 'If you are unable to use any other two-factor authentication, enter one of your recovery codes to verify your identity.',
login: 'Log in',
login_failed: 'Login failed, please verify your credentials.',
+ login_server_failed: 'A server error occurred while logging in.',
login_page: 'Cancel',
redirecting: 'Redirecting in {secondsLeft} seconds...',
reset_change_password: 'Change password',
From 8c4f5a35c8b348d91473dc48810ab07d0614b383 Mon Sep 17 00:00:00 2001
From: Nicolas Pennec