Skip to content

Instantly share code, notes, and snippets.

View simonmorley's full-sized avatar

Simon Morley simonmorley

  • London
View GitHub Profile
@simonmorley
simonmorley / gist:cf064be0f806af754046
Last active August 29, 2015 14:13
medium, creating a login, integrating meraki, creating a cllient.details service controller integration
var init = function(client) {
var head = angular.element('head')
var template;
Login.initialise({request_uri: client.requestUri, mac: client.apMac}).$promise.then(function(results) {
if (results.archived === true) {
archivedLocation();
}
@simonmorley
simonmorley / gist:07c349c79fbaea694b66
Created January 22, 2015 13:03
medium, creating a login page, meraki logins. logins directive refactored
scope.submit = function() {
scope.loggingIn = true;
scope.error = undefined;
checkClientStatus().then(function(resp) {
Client.details().then(function(client) {
scope.client = client;
doLogin(resp);
});
});
};
@simonmorley
simonmorley / gist:c1723e2a4f46744e8ec6
Created January 22, 2015 13:10
medium, creating a login page, meraki logins. logins directive refactored
{
"message": "",
"clientState": 1,
"error": false
}
@simonmorley
simonmorley / gist:00a59bb9922dbebd1a0c
Last active August 29, 2015 14:13
medium, creating a login page, meraki logins. logins directive refactored part 2
var doLogin = function(resp) {
createLogin(resp).then(function(clientState) {
if (clientState !== undefined) {
merakiLogin(clientState);
} else {
login();
}
});
};
@simonmorley
simonmorley / gist:a162d0ee798c66ac3e80
Created January 22, 2015 14:00
Medium, creating a splash page, aruba service part 1
'use strict';
var app = angular.module('ctLoginsApp.aruba.services', ['ngResource']);
app.factory('Aruba', ['$http', '$q',
function($http, $q){
var login = function(params) {
@simonmorley
simonmorley / gist:c6be75ee9755091013fa
Created January 22, 2015 15:52
Medium, creating a login screen, xirrus params
if ($routeParams.uamip !== undefined && $routeParams.uamport !== undefined && $routeParams.apmac !== undefined) {
$rootScope.deviceId = DEVICES.xirrus;
}
@simonmorley
simonmorley / gist:88372afdb848c015f4ee
Created January 22, 2015 17:24
medium, creating a splash page, ruckus interceptor
if ( $routeParams.sip !== undefined && $routeParams.uip !== undefined) { $rootScope.deviceId = DEVICES.ruckus;
}
@simonmorley
simonmorley / gist:269a3c8c6f66e3087d2f
Created January 22, 2015 19:13
Medium, creating a splash page, xirrus service
'use strict';
var app = angular.module('ctLoginsApp.xirrus.services', ['ngResource']);
app.factory('Xirrus', ['$http', '$q',
function($http, $q){
var login = function(params) {
@simonmorley
simonmorley / gist:f5507abaac124b9b676c
Created January 22, 2015 19:14
Medium, creating a splash page, xirrus directive
var xirrusLogin = function() {
var deferred = $q.defer();
Xirrus.login({uamip: $routeParams.uamip, uamport: $routeParams.uamport, username: scope.username, response: scope.response}).then(function(res) {
deferred.resolve(res);
}, function(err) {
deferred.reject(err);
});
return deferred.promise;
};
@simonmorley
simonmorley / gist:347e8378ab68f668a211
Created January 23, 2015 00:51
Medium, creating a facebook login, facebook directive v. basic
'use strict';
var app = angular.module('ctLoginsApp.facebook.directives', ['ngResource']);
app.directive('facebook', ['$window', '$compile', '$q', function($window, $compile, $q) {
var link = function(scope,element,attrs) {
function statusChangeCallback(response) {
console.log('statusChangeCallback');