Skip to content
This repository has been archived by the owner on Oct 8, 2019. It is now read-only.

Commit

Permalink
refactor(Cookies): replace references to deprecated with
Browse files Browse the repository at this point in the history
  • Loading branch information
jtormey committed Dec 18, 2015
1 parent 6824de4 commit d78716f
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion assets/js/controllers/app.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ angular
.module('walletApp')
.controller("AppCtrl", AppCtrl);

function AppCtrl($scope, Wallet, Alerts, $state, $rootScope, $location, $cookieStore, $timeout, $uibModal, $window, $translate) {
function AppCtrl($scope, Wallet, Alerts, $state, $rootScope, $location, $timeout, $uibModal, $window, $translate) {
$scope.status = Wallet.status;
$scope.settings = Wallet.settings;
$rootScope.isMock = Wallet.isMock;
Expand Down
16 changes: 8 additions & 8 deletions assets/js/controllers/login.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ angular
.module('walletApp')
.controller("LoginCtrl", LoginCtrl);

function LoginCtrl($scope, $rootScope, $log, $http, Wallet, Alerts, $cookieStore, $uibModal, $state, $stateParams, $timeout, $translate, filterFilter) {
function LoginCtrl($scope, $rootScope, $log, $http, Wallet, Alerts, $cookies, $uibModal, $state, $stateParams, $timeout, $translate, filterFilter) {
$scope.status = Wallet.status;
$scope.settings = Wallet.settings;
$scope.disableLogin = null;
$scope.status.enterkey = false;
$scope.key = $cookieStore.get("key");
$scope.key = $cookies.get("key");
$scope.errors = {
uid: null,
password: null,
twoFactor: null
};
$scope.uidAvailable = $cookieStore.get('uid') != null || $stateParams.uid;
$scope.uidAvailable = $cookies.get('uid') != null || $stateParams.uid;
$scope.user = Wallet.user;

// Browser compatibility warnings:
Expand Down Expand Up @@ -88,16 +88,16 @@ function LoginCtrl($scope, $rootScope, $log, $http, Wallet, Alerts, $cookieStore
if (Wallet.guid != null) {
$scope.uid = Wallet.guid;
} else {
$scope.uid = $stateParams.uid || $cookieStore.get("uid");
$scope.uid = $stateParams.uid || $cookies.get("uid");
}
if ($scope.key != null) {
$scope.status.enterkey = true;
}
$scope.twoFactorCode = "";
$scope.busy = false;
$scope.isValid = false;
if (!!$cookieStore.get("password")) {
$scope.password = $cookieStore.get("password");
if (!!$cookies.get("password")) {
$scope.password = $cookies.get("password");
}
$scope.login = () => {
if ($scope.busy) return;
Expand Down Expand Up @@ -126,10 +126,10 @@ function LoginCtrl($scope, $rootScope, $log, $http, Wallet, Alerts, $cookieStore
Wallet.login($scope.uid, $scope.password, null, needs2FA, success, error);
}
if ($scope.uid != null && $scope.uid !== "") {
$cookieStore.put("uid", $scope.uid);
$cookies.put("uid", $scope.uid);
}
if ($scope.savePassword && $scope.password != null && $scope.password !== "") {
$cookieStore.put("password", $scope.password);
$cookies.put("password", $scope.password);
}
};

Expand Down
6 changes: 3 additions & 3 deletions assets/js/controllers/navigation.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ angular
.module('walletApp')
.controller("NavigationCtrl", NavigationCtrl);

function NavigationCtrl($scope, Wallet, currency, SecurityCenter, $translate, $cookieStore, $state, filterFilter, $interval) {
function NavigationCtrl($scope, Wallet, currency, SecurityCenter, $translate, $cookies, $state, filterFilter, $interval) {
$scope.status = Wallet.status;
$scope.security = SecurityCenter.security;
$scope.settings = Wallet.settings;
Expand Down Expand Up @@ -36,8 +36,8 @@ function NavigationCtrl($scope, Wallet, currency, SecurityCenter, $translate, $c
if (confirm(translation)) {
$scope.uid = null;
$scope.password = null;
$cookieStore.remove("password");
// $cookieStore.remove("uid") // Pending a "Forget Me feature"
$cookies.remove("password");
// $cookies.remove("uid") // Pending a "Forget Me feature"

$state.go("wallet.common.transactions", {
accountIndex: ""
Expand Down
2 changes: 1 addition & 1 deletion assets/js/controllers/settings/settings.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ angular
.module('walletApp')
.controller("SettingsCtrl", SettingsCtrl);

function SettingsCtrl($scope, Wallet, Alerts, $cookieStore, $state) {
function SettingsCtrl($scope, Wallet, Alerts, $state) {
if ($state.current.name === "wallet.common.settings") {
$state.go("wallet.common.settings.info");
}
Expand Down
2 changes: 1 addition & 1 deletion assets/js/controllers/transaction.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ angular
.module('walletApp')
.controller('TransactionCtrl', TransactionCtrl);

function TransactionCtrl($scope, Wallet, $log, $state, $stateParams, $filter, $cookieStore, $sce) {
function TransactionCtrl($scope, Wallet, $log, $state, $stateParams, $filter, $sce) {
$scope.addressBook = Wallet.addressBook;
$scope.status = Wallet.status;
$scope.settings = Wallet.settings;
Expand Down
16 changes: 8 additions & 8 deletions assets/js/services/wallet.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ angular
.module('walletServices', [])
.factory('Wallet', Wallet);

Wallet.$inject = ['$http', '$window', '$timeout', 'Alerts', 'MyWallet', 'MyBlockchainApi', 'MyBlockchainSettings', 'MyWalletStore', 'MyWalletPayment', 'MyWalletTokenEndpoints', '$rootScope', 'ngAudio', '$cookieStore', '$translate', '$filter', '$state', '$q', 'bcPhoneNumber', 'languages', 'currency'];
Wallet.$inject = ['$http', '$window', '$timeout', 'Alerts', 'MyWallet', 'MyBlockchainApi', 'MyBlockchainSettings', 'MyWalletStore', 'MyWalletPayment', 'MyWalletTokenEndpoints', '$rootScope', 'ngAudio', '$cookies', '$translate', '$filter', '$state', '$q', 'bcPhoneNumber', 'languages', 'currency'];

function Wallet($http, $window, $timeout, Alerts, MyWallet, MyBlockchainApi, MyBlockchainSettings, MyWalletStore, MyWalletPayment, MyWalletTokenEndpoints, $rootScope, ngAudio, $cookieStore, $translate, $filter, $state, $q, bcPhoneNumber, languages, currency) {
function Wallet($http, $window, $timeout, Alerts, MyWallet, MyBlockchainApi, MyBlockchainSettings, MyWalletStore, MyWalletPayment, MyWalletTokenEndpoints, $rootScope, ngAudio, $cookies, $translate, $filter, $state, $q, bcPhoneNumber, languages, currency) {
const wallet = {
goal: {
auth: false
Expand Down Expand Up @@ -814,11 +814,11 @@ function Wallet($http, $window, $timeout, Alerts, MyWallet, MyBlockchainApi, MyB
} else if (event === 'logging_out') {
if (wallet.didLogoutByChoice) {
$translate('LOGGED_OUT').then((translation) => {
$cookieStore.put('alert-success', translation);
$cookies.put('alert-success', translation);
});
} else {
$translate('LOGGED_OUT_AUTOMATICALLY').then((translation) => {
$cookieStore.put('alert-warning', translation);
$cookies.put('alert-warning', translation);
wallet.applyIfNeeded();
});
}
Expand Down Expand Up @@ -852,15 +852,15 @@ function Wallet($http, $window, $timeout, Alerts, MyWallet, MyBlockchainApi, MyB
wallet.monitor(event, data);
});

let message = $cookieStore.get('alert-warning');
let message = $cookies.get('alert-warning');
if (message !== void 0 && message !== null) {
Alerts.displayWarning(message, true);
$cookieStore.remove('alert-warning');
$cookies.remove('alert-warning');
}
message = $cookieStore.get('alert-success');
message = $cookies.get('alert-success');
if (message !== void 0 && message !== null) {
Alerts.displaySuccess(message);
$cookieStore.remove('alert-success');
$cookies.remove('alert-success');
}

wallet.setNote = (tx, text) => {
Expand Down
2 changes: 1 addition & 1 deletion tests/mocks/my_wallet/my_wallet_mock.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
angular
.module('walletApp.core')
.factory 'MyWallet', ($window, $timeout, $log, $cookieStore, MyWalletStore) ->
.factory 'MyWallet', ($window, $timeout, $log, MyWalletStore) ->
return {}

0 comments on commit d78716f

Please sign in to comment.