diff --git a/js/controllers/createProfile.js b/js/controllers/createProfile.js index 92c3569f8..87ae5ba1a 100644 --- a/js/controllers/createProfile.js +++ b/js/controllers/createProfile.js @@ -8,6 +8,9 @@ angular.module('copayApp.controllers').controller('CreateProfileController', fun identityService.goWalletHome(); $scope.isMobile = isMobile.any(); + $scope.createStep = 'storage'; + $scope.useLocalstorage = false; + pinService.makePinInput($scope, 'newpin', function(newValue) { _firstpin = newValue; $scope.askForPin = 2; @@ -47,10 +50,37 @@ angular.module('copayApp.controllers').controller('CreateProfileController', fun }); }; + + $scope.setStorage = function(useLocalstorage) { + console.log('[createProfile.js.53:useLocalstorage:]', useLocalstorage); //TODO + console.log('[createProfile.js.53:useLocalstorage:]', $scope.useLocalstorage); //TODO + //settingsService.save({...}) + $scope.createStep = 'email'; + $scope.useEmail = !useLocalstorage; + $scope.useLocalstorage = useLocalstorage; + $timeout(function() { + $scope.$digest(); + }, 1); + }; + + $scope.setEmailOrUsername = function(form) { + console.log('[createProfile.js.53:useLocalstorage:]', $scope.useLocalstorage); //TODO + + $scope.userOrEmail = $scope.useLocalstorage ? form.username.$modelValue : form.email.$modelValue; + preconditions.checkState($scope.userOrEmail); + + $scope.createStep = 'pass'; + $timeout(function() { + $scope.$digest(); + }, 1); + }; + + + $scope.createDefaultWallet = function() { $rootScope.hideNavigation = false; identityService.createDefaultWallet(function(err) { - $scope.askForPin =0 ; + $scope.askForPin = 0; $scope.loading = false; if (err) { @@ -67,7 +97,7 @@ angular.module('copayApp.controllers').controller('CreateProfileController', fun return; } $scope.loading = true; - identityService.create(form.email.$modelValue, form.password.$modelValue, function(err) { + identityService.create( $scope.userOrEmail, form.password.$modelValue, function(err) { $scope.loading = false; if (err) { @@ -76,15 +106,13 @@ angular.module('copayApp.controllers').controller('CreateProfileController', fun msg = 'This profile already exists' } $timeout(function() { - form.email.$setViewValue(''); - form.email.$render(); - form.password.$setViewValue(''); - form.password.$render(); - form.repeatpassword.$setViewValue(''); - form.repeatpassword.$render(); - form.$setPristine(); - $scope.error = msg; - },1); + form.password.$setViewValue(''); + form.password.$render(); + form.repeatpassword.$setViewValue(''); + form.repeatpassword.$render(); + form.$setPristine(); + $scope.error = msg; + }, 1); $scope.error = msg; } else { $scope.error = null; diff --git a/views/createProfile.html b/views/createProfile.html index 24bd03951..a22211557 100644 --- a/views/createProfile.html +++ b/views/createProfile.html @@ -36,109 +36,148 @@ -
- - @@ -173,15 +212,14 @@