From f31966d959a32cb203c155fa34b60ac6cfc7df0e Mon Sep 17 00:00:00 2001 From: Arjun Roychowdhury Date: Mon, 2 Nov 2015 09:53:28 -0500 Subject: #64 - check if portal is reachable even if auth is off - to avoid confusing error message --- www/js/app.js | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'www/js/app.js') 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; } -- cgit v1.2.3