diff --git a/scripts/js/login.js b/scripts/js/login.js index 46ec2dd41f..51e6867517 100644 --- a/scripts/js/login.js +++ b/scripts/js/login.js @@ -34,7 +34,12 @@ function wrongPassword(isError = false, isSuccess = false, data = null) { $("#error-message").text(""); $("#error-hint").hide(); $("#error-hint").text(""); - if (data !== null && "error" in data.responseJSON && "message" in data.responseJSON.error) { + if ( + data && + data.responseJSON && + "error" in data.responseJSON && + "message" in data.responseJSON.error + ) { // This is an error, highlight both the password and the TOTP field isErrorResponse = true; // Check if the error is caused by an invalid TOTP token