From 87dca6f089bdabbe5346dfa830fe0caad21aad38 Mon Sep 17 00:00:00 2001 From: James Portman Date: Fri, 7 Aug 2015 12:47:59 +0100 Subject: [PATCH 1/2] moving to use cookies for angular 1.4 --- scripts/app.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/app.js b/scripts/app.js index dee37a4..55e9de2 100644 --- a/scripts/app.js +++ b/scripts/app.js @@ -27,10 +27,10 @@ angular.module('BasicHttpAuthExample', [ .otherwise({ redirectTo: '/login' }); }]) -.run(['$rootScope', '$location', '$cookieStore', '$http', - function ($rootScope, $location, $cookieStore, $http) { +.run(['$rootScope', '$location', '$cookies', '$http', + function ($rootScope, $location, $cookies, $http) { // keep user logged in after page refresh - $rootScope.globals = $cookieStore.get('globals') || {}; + $rootScope.globals = $cookies.get('globals') || {}; if ($rootScope.globals.currentUser) { $http.defaults.headers.common['Authorization'] = 'Basic ' + $rootScope.globals.currentUser.authdata; // jshint ignore:line } From 67b05326f415448442dc9179045bca421968417c Mon Sep 17 00:00:00 2001 From: James Portman Date: Fri, 7 Aug 2015 12:48:46 +0100 Subject: [PATCH 2/2] moving to use cookies for angular 1.4 --- modules/authentication/services.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/authentication/services.js b/modules/authentication/services.js index c4b3777..2406bd6 100644 --- a/modules/authentication/services.js +++ b/modules/authentication/services.js @@ -3,8 +3,8 @@ angular.module('Authentication') .factory('AuthenticationService', - ['Base64', '$http', '$cookieStore', '$rootScope', '$timeout', - function (Base64, $http, $cookieStore, $rootScope, $timeout) { + ['Base64', '$http', '$cookies', '$rootScope', '$timeout', + function (Base64, $http, $cookies, $rootScope, $timeout) { var service = {}; service.Login = function (username, password, callback) { @@ -40,12 +40,12 @@ angular.module('Authentication') }; $http.defaults.headers.common['Authorization'] = 'Basic ' + authdata; // jshint ignore:line - $cookieStore.put('globals', $rootScope.globals); + $cookies.put('globals', $rootScope.globals); }; service.ClearCredentials = function () { $rootScope.globals = {}; - $cookieStore.remove('globals'); + $cookies.remove('globals'); $http.defaults.headers.common.Authorization = 'Basic '; }; @@ -136,4 +136,4 @@ angular.module('Authentication') }; /* jshint ignore:end */ -}); \ No newline at end of file +});