diff options
| author | Arjun Roychowdhury <pliablepixels@gmail.com> | 2015-11-02 09:53:28 -0500 |
|---|---|---|
| committer | Arjun Roychowdhury <pliablepixels@gmail.com> | 2015-11-02 09:53:28 -0500 |
| commit | f31966d959a32cb203c155fa34b60ac6cfc7df0e (patch) | |
| tree | 6587d5b8623a0dcbbc7753b4400a4d9497650f23 | |
| parent | e405659e006e59fc00b801be9c67986ae405e5da (diff) | |
#64 - check if portal is reachable even if auth is off - to avoid confusing error message
| -rw-r--r-- | www/js/app.js | 19 |
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; } |
