summaryrefslogtreecommitdiff
path: root/www/js/LoginCtrl.js
diff options
context:
space:
mode:
authorpliablepixels <pliablepixels@gmail.com>2016-04-21 09:09:22 -0400
committerpliablepixels <pliablepixels@gmail.com>2016-04-21 09:09:22 -0400
commitd99c6ffb8ed5b05101dd1d89585cd4bd622262d9 (patch)
tree47c82d6974b8d47de3aa8746b1fb443dec47f9bb /www/js/LoginCtrl.js
parenta0d5234fe7c16d78c243079fae0b9a4798cdcd0b (diff)
#228 initial code
Former-commit-id: a3de04e4b05eecb335611d1ba720548c25c6e8ef
Diffstat (limited to 'www/js/LoginCtrl.js')
-rw-r--r--www/js/LoginCtrl.js57
1 files changed, 56 insertions, 1 deletions
diff --git a/www/js/LoginCtrl.js b/www/js/LoginCtrl.js
index e91c12d8..157a2546 100644
--- a/www/js/LoginCtrl.js
+++ b/www/js/LoginCtrl.js
@@ -1,6 +1,6 @@
/* jshint -W041 */
/* jslint browser: true*/
-/* global cordova,StatusBar,angular,console */
+/* global cordova,StatusBar,angular,console,alert,URI */
angular.module('zmApp.controllers').controller('zmApp.LoginCtrl', ['$scope', '$rootScope', 'zm', '$ionicModal', 'ZMDataModel', '$ionicSideMenuDelegate', '$ionicPopup', '$http', '$q', '$ionicLoading', 'zmAutoLogin', '$cordovaPinDialog', 'EventServer', '$ionicHistory', '$state', '$ionicActionSheet', 'SecuredPopups', '$localstorage', function ($scope, $rootScope, zm, $ionicModal, ZMDataModel, $ionicSideMenuDelegate, $ionicPopup, $http, $q, $ionicLoading, zmAutoLogin, $cordovaPinDialog, EventServer, $ionicHistory, $state, $ionicActionSheet, SecuredPopups, $localstorage) {
$scope.openMenu = function () {
@@ -245,7 +245,62 @@ angular.module('zmApp.controllers').controller('zmApp.LoginCtrl', ['$scope', '$r
$scope.ignoreDirty = false;
});
+ // Make a noble attempt at deciphering
+ $scope.detectCgi = function()
+ {
+ var text = "Typical values:<br/><b>ubuntu:</b> http://server/zm/cgi-bin<br/><b>centos/fedora:</b> http://server/zm/cgi-bin-zm/";
+
+ if ($scope.loginData.url.slice(-1) == '/') {
+ $scope.loginData.url = $scope.loginData.url.slice(0, -1);
+
+ }
+
+ ZMDataModel.getPathZms()
+ .then (function (data)
+ {
+ var c=URI.parse($scope.loginData.url);
+ var p1,p2,p3;
+ p1 ="";
+ p2 ="";
+
+ if (c.userinfo)
+ p1 = c.userinfo+"@";
+ if (c.port)
+ p2 = ":"+c.port;
+
+ var baseUri = c.scheme+"://"+p1+c.host+p2;
+ var dtext = baseUri + data.toLowerCase().trim();
+ dtext = dtext.substr(0, dtext.lastIndexOf("/"));
+
+ text = "Your cgi-bin path may be " + dtext + "<br/><br/>" + text;
+
+ $rootScope.zmPopup = SecuredPopups.show('show',{
+ title: 'cgi-bin settings',
+ cssClass: 'popup90',
+ template: text,
+ buttons: [{text: 'Ok'},{text:'Use suggestion', onTap:function(e) {$scope.loginData.streamingurl=dtext;}}]
+
+ });
+
+
+ },
+ function (error)
+ {
+ ZMDataModel.zmDebug ("Could not get PATH_ZMS:"+JSON.stringify(error));
+ text = "(could not detect cgi-path, try coming back here after setting up your portal url and credentials correctly)<br/><br/>"+text;
+ $rootScope.zmPopup = SecuredPopups.show('alert',{
+ title: 'cgi-bin settings',
+ cssClass: 'popup90',
+
+ template: text
+ });
+
+ });
+
+
+
+ };
//--------------------------------------------------------------------------
// When PIN is enabled, this is called to specify a PIN