diff options
author | Devaev Maxim <[email protected]> | 2020-08-21 01:21:38 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2020-08-21 01:21:38 +0300 |
commit | f84d83e2702915ce845b4dd73bc3452739b36c4d (patch) | |
tree | 75cee995a96506f1207769d0f183fa4537ce178f | |
parent | 5edb85975ffda273b09a21ee6c616517c03513db (diff) |
Fixed pikvm/pikvm#48
-rw-r--r-- | web/share/js/login/main.js | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/web/share/js/login/main.js b/web/share/js/login/main.js index a76456d0..9bad70dd 100644 --- a/web/share/js/login/main.js +++ b/web/share/js/login/main.js @@ -58,7 +58,15 @@ function __login() { } else if (http.status === 403) { wm.error("Invalid username or password").then(__tryAgain); } else { - wm.error("Login error:<br>", http.responseText).then(__tryAgain); + let error = ""; + if (http.status === 400) { + try { error = JSON.parse(http.responseText)["result"]["error"]; } catch (_) { /* Nah */ } + } + if (error === "ValidatorError") { + wm.error("Incorrect username characters").then(__tryAgain); + } else { + wm.error("Login error:<br>", http.responseText).then(__tryAgain); + } } } }, body, "application/x-www-form-urlencoded"); |