summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--www/js/app.js19
1 files changed, 17 insertions, 2 deletions
diff --git a/www/js/app.js b/www/js/app.js
index a5e0d07c..2dba17dd 100644
--- a/www/js/app.js
+++ b/www/js/app.js
@@ -318,10 +318,25 @@ angular.module('zmApp', [
function doLogin(str) {
var d = $q.defer();
var ld = ZMDataModel.getLogin();
- if (ld.isUseAuth == "0") {
+ if (ld.isUseAuth != "1") {
$ionicLoading.hide();
ZMDataModel.zmLog("Authentication is disabled. Skipping login");
- d.resolve("Login success - no auth");
+ ZMDataModel.zmLog ("However, still doing a reachability check...");
+
+ $http.get(ld.url)
+ .then (function(success) {
+ ZMDataModel.zmLog(ld.url + " is reachable.");
+ d.resolve("Login success - no auth");
+ return d.promise;
+
+ },
+ function (error) {
+ ZMDataModel.zmLog(ld.url + " is NOT reachable.");
+ d.reject("Login Error - not reachable");
+ $rootScope.$emit('auth-error', "not reachable");
+ return d.promise;
+ });
+
return d.promise;
}