[Kimchi-devel] [PATCH][Wok] Warn user when server is not reachable at login page

Ramon Medeiros ramonn at linux.vnet.ibm.com
Fri Jun 3 15:39:27 UTC 2016


Signed-off-by: Ramon Medeiros <ramonn at linux.vnet.ibm.com>
---
 ui/js/src/wok.login.js   | 10 ++++++++--
 ui/pages/login.html.tmpl |  1 +
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/ui/js/src/wok.login.js b/ui/js/src/wok.login.js
index 7423f81..0b09508 100644
--- a/ui/js/src/wok.login.js
+++ b/ui/js/src/wok.login.js
@@ -74,8 +74,14 @@ wok.login_main = function() {
             }
             wok.cookie.set('roles',JSON.stringify(data.roles));
             window.location.replace(window.location.pathname.replace(/\/+login.html/, '') + next_url);
-        }, function() {
-            $("#messUserPass").show();
+        }, function(jqXHR, textStatus, errorThrown) {
+            if (jqXHR.responseText == "") {
+                $("#messUserPass").hide();
+                $("#missServer").show();
+            } else {
+                $("#missServer").hide();
+                $("#messUserPass").show();
+            }
             $("#messSession").hide();
             $("#logging").hide();
             $("#login").show();
diff --git a/ui/pages/login.html.tmpl b/ui/pages/login.html.tmpl
index 0357d64..d6daeb7 100644
--- a/ui/pages/login.html.tmpl
+++ b/ui/pages/login.html.tmpl
@@ -101,6 +101,7 @@
                 <div class="err-area">
                     <div id="messUserPass" class="alert alert-danger" style="display: none;">$_("The username or password you entered is incorrect. Please try again.")</div>
                     <div id="messSession" class="alert alert-danger" style="display: none;">$_("Session timeout, please re-login.")</div>
+                    <div id="missServer" class="alert alert-danger" style="display: none;">$_("Server unreachable")</div>
                 </div>
                 <form id="form-login" class="form-horizontal" method="post">
                     <div class="form-group">
-- 
2.5.5




More information about the Kimchi-devel mailing list