improve url checker

This commit is contained in:
Gustavo Maximiliano Cortez 2014-08-06 18:41:37 -03:00
parent ee031849b2
commit 53bc610bbc
7 changed files with 16 additions and 19 deletions

View File

@ -1,10 +1,9 @@
'use strict';
angular.module('copayApp.controllers').controller('HomeController',
function($scope, $rootScope, $location, walletFactory, notification) {
if ($rootScope.wallet) {
$location.path('/addresses');
}
function($scope, $rootScope, $location, walletFactory, notification, controllerUtils) {
controllerUtils.redirIfLogged();
$scope.loading = false;
if ($rootScope.pendingPayment) {

View File

@ -2,9 +2,8 @@
angular.module('copayApp.controllers').controller('ImportController',
function($scope, $rootScope, $location, walletFactory, controllerUtils, Passphrase, notification) {
if ($rootScope.wallet) {
$location.path('/addresses');
}
controllerUtils.redirIfLogged();
$scope.title = 'Import a backup';
$scope.importStatus = 'Importing wallet - Reading backup...';

View File

@ -2,10 +2,8 @@
angular.module('copayApp.controllers').controller('JoinController',
function($scope, $rootScope, $timeout, $location, walletFactory, controllerUtils, Passphrase, notification) {
if ($rootScope.wallet) {
$location.path('/addresses');
}
controllerUtils.redirIfLogged();
$scope.loading = false;
// QR code Scanner

View File

@ -2,9 +2,7 @@
angular.module('copayApp.controllers').controller('OpenController',
function($scope, $rootScope, $location, walletFactory, controllerUtils, Passphrase, notification) {
if ($rootScope.wallet) {
$location.path('/addresses');
}
controllerUtils.redirIfLogged();
var cmp = function(o1, o2) {
var v1 = o1.show.toLowerCase(),

View File

@ -2,10 +2,8 @@
angular.module('copayApp.controllers').controller('SettingsController',
function($scope, $rootScope, $window, $location) {
if ($rootScope.wallet) {
$location.path('/addresses');
}
controllerUtils.redirIfLogged();
$scope.title = 'Settings';
$scope.networkName = config.networkName;
$scope.insightHost = config.blockchain.host;

View File

@ -34,9 +34,7 @@ var valid_pairs = {
angular.module('copayApp.controllers').controller('SetupController',
function($scope, $rootScope, $location, $timeout, walletFactory, controllerUtils, Passphrase, backupService, notification) {
if ($rootScope.wallet) {
$location.path('/addresses');
}
controllerUtils.redirIfLogged();
$rootScope.videoInfo = {};
$scope.loading = false;

View File

@ -14,6 +14,13 @@ angular.module('copayApp.services')
return vi.muted;
};
root.redirIfLogged = function() {
var w = $rootScope.wallet;
if (w) {
$location.path('addresses');
}
};
root.logout = function() {
Socket.removeAllListeners();