This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'use strict'; | |
| var app = angular.module('ctLoginsApp.coova.services', ['ngResource']); | |
| app.factory('Coova', ['$resource', | |
| function($resource){ | |
| return $resource( 'http://:uamip::uamport' + '/json/:action?', | |
| { callback: 'JSON_CALLBACK' }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var doLogin = function(username, password, challenge) { | |
| var createLogin = function() { | |
| return Tony.create({username: username, password: password, challenge: challenge, request_uri: $location.host(), clientMac: $routeParams.mac}).$promise.then(function(res) { | |
| scope.username = res.username; | |
| scope.response = res.challengeResp; | |
| }, function(err) { | |
| // Fail Login | |
| }); | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var redirectUser = function() { | |
| if ( attrs.redirects !== undefined) { | |
| var redirects = JSON.parse(attrs.redirects); | |
| if (redirects.show_welcome) { | |
| $location.path('/welcome'); | |
| } else if (redirects.success_url) { | |
| $location.path(redirects.success_url); | |
| } | |
| } | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| welcome: { | |
| cache: true, | |
| method: 'GET', | |
| isArray: false, | |
| params: { | |
| v: 2, | |
| welcome: true | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| app.directive('welcome', ['$routeParams', '$location', '$window', 'Login', '$timeout', function($routeParams, $location, $window, Login, $timeout) { | |
| var link = function(scope,element,attrs) { | |
| scope.loading = true; | |
| var request_uri = $location.host(); | |
| var apMac = $routeParams.mac || $routeParams.sip; | |
| Login.welcome({request_uri: request_uri, mac: apMac}).$promise.then(function(results) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| app.factory('apInterceptor', ['$q', '$location', '$rootScope', '$routeParams', 'DEVICES', | |
| function($q, $location, $rootScope, $routeParams, DEVICES) { | |
| return { | |
| request: function(config) { | |
| var setDevice = function() { | |
| if ($routeParams.uamip !== undefined && $routeParams.uamport !== undefined) { | |
| $rootScope.deviceId = DEVICES.ct; | |
| } else if ( $routeParams.switchip !== undefined && $routeParams.cmd !== undefined ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| app.constant('DEVICES', { | |
| ct: '1', | |
| aruba: '2', | |
| meraki: '3', | |
| ruckus: '4', | |
| aerohive: '5', | |
| xirrus: '6', | |
| unknown: '999' | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Failed login | |
| <html> | |
| <head> | |
| <meta http-equiv="refresh" content="0; url=http://polkaspots.my-wifi.co:80/4215309485667105204?url=http://www.google.com&mac=xxx&ip=172.31.99.17&essid=PolkaSpots-ARB&apname=18:64:72:c6:3c:e8&apgroup=instant-C6:3C:E8&errmsg=Login error. Please retry."> | |
| </head><body></body> | |
| </html> | |
| Successful login |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| app.factory('Client', ['$routeParams', | |
| function($routeParams) { | |
| var details = function() { | |
| return $routeParams; | |
| }; | |
| return { | |
| details: details |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var app = angular.module('ctLoginsApp.tony.services', ['ngResource']); | |
| app.factory('Client', ['$routeParams', '$q', '$rootScope', '$location', | |
| function($routeParams, $q, $rootScope, $location) { | |
| var clientMac, apMac, redirectUri, loginUri, apTags, requestUri; | |
| var details = function() { | |
| var deferred = $q.defer(); |