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

Commit

Permalink
refactor(.com): move .com redirect code to public parent route
Browse files Browse the repository at this point in the history
  • Loading branch information
Thore3 committed Jun 18, 2018
1 parent db323ca commit 5280349
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
4 changes: 0 additions & 4 deletions assets/js/controllers/login.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,4 @@ function LoginCtrl ($scope, $rootScope, $window, localStorageService, $state, $s
let guid = localStorageService.get('guid')
if (guid != null) $scope.uid = guid
})

ComMigration.whenRedirectsEnabled(() => {
ComMigration.redirectFromDotInfoTo('https://login.blockchain.com/#/login')
})
}
8 changes: 2 additions & 6 deletions assets/js/controllers/signup.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ angular
.module('walletApp')
.controller('SignupCtrl', SignupCtrl);

SignupCtrl.$inject = ['$scope', '$state', 'localStorageService', '$filter', '$timeout', '$translate', 'Wallet', 'currency', 'languages', 'MyWallet', '$http', 'Env', 'Ethereum', 'ComMigration'];
SignupCtrl.$inject = ['$scope', '$state', 'localStorageService', '$filter', '$timeout', '$translate', 'Wallet', 'currency', 'languages', 'MyWallet', '$http', 'Env', 'Ethereum'];

function SignupCtrl ($scope, $state, localStorageService, $filter, $timeout, $translate, Wallet, currency, languages, MyWallet, $http, Env, Ethereum, ComMigration) {
function SignupCtrl ($scope, $state, localStorageService, $filter, $timeout, $translate, Wallet, currency, languages, MyWallet, $http, Env, Ethereum) {
$scope.working = false;
$scope.browser = {disabled: true};

Expand Down Expand Up @@ -195,8 +195,4 @@ function SignupCtrl ($scope, $state, localStorageService, $filter, $timeout, $tr
$scope.fields.acceptedAgreement = true;
$scope.fields.email = `${$scope.autoCreate}+${Date.now()}@blockchain.com`;
}

ComMigration.whenRedirectsEnabled(() => {
ComMigration.redirectFromDotInfoTo('https://login.blockchain.com/#/signup')
})
}
12 changes: 10 additions & 2 deletions assets/js/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,23 +98,31 @@ function AppRouter ($stateProvider, $urlRouterProvider) {
views: {
body: {
templateUrl: 'partials/public.pug',
controller: function ($scope, $state, languages, Env) {
controller: function ($scope, $state, $location, languages, Env, ComMigration) {
Env.then(env => {
$scope.network = env.network;
$scope.rootURL = env.rootURL;
$scope.versionMyWallet = env.versionMyWallet;
$scope.versionFrontend = env.versionFrontend;
});

let overflows = ['/reset-2fa'];
$scope.state = $state;
$scope.path = $state.current.url;
$scope.languages = languages.languages;

$scope.$watch(languages.get, (code) => {
$scope.language = languages.mapCodeToName(code);
});

$scope.$watch('state.current.url', (newVal) => {
$scope.isUIOverflow = overflows.indexOf(newVal) > -1;
});

ComMigration.whenRedirectsEnabled(() => {
let url = $location.url()
ComMigration.redirectFromDotInfoTo(`https://login.blockchain.com/#${url}`)
})
}
}
},
Expand Down Expand Up @@ -264,7 +272,7 @@ function AppRouter ($stateProvider, $urlRouterProvider) {
accounts ($injector, $q) {
let MyWallet = $injector.has('MyWallet') && $injector.get('MyWallet');
let sfox = MyWallet.wallet && MyWallet.wallet.external && MyWallet.wallet.external.sfox;

return sfox && sfox.hasAccount
? $q.resolve([])
.then(() => sfox.getBuyMethods()).catch(console.log)
Expand Down

0 comments on commit 5280349

Please sign in to comment.