Merge pull request #1930 from cmgustavo/feature/pin-01

PIN for mobile devices
This commit is contained in:
Matias Alejo Garcia 2014-12-03 23:56:10 -03:00
commit 6f1342ea27
21 changed files with 589 additions and 130 deletions

View file

@ -24,6 +24,7 @@
"angular-load": "0.2.0",
"lodash": "~2.4.1",
"angular-gravatar": "*",
"fastclick": "*",
"angular-touch": "~1.3.0"
},
"resolutions": {

View file

@ -548,6 +548,7 @@ a.button-setup {
}
.dn {display: none;}
.dni {display: none !important;}
.pr {position: relative;}
.pa {position: absolute;}
.m0 {margin: 0;}

View file

@ -34,7 +34,6 @@
<div class="contener_mixte"><div class="ballcolor ball_3">&nbsp;</div></div>
<div class="contener_mixte"><div class="ballcolor ball_4">&nbsp;</div></div>
</div>
<span class="text-gray size-12" translate>Logging Out</span>
</div>
</div>
@ -57,7 +56,7 @@
</span>
</span>
<nav class="tab-bar" ng-if="$root.iden" >
<nav class="tab-bar" ng-if="$root.iden && !$root.hideNavigation" >
<section class="left-small">
<a class="left-off-canvas-toggle menu-icon" ><span></span></a>
</section>
@ -66,7 +65,7 @@
<i class="fi-bitcoin-circle icon-rotate spinner"></i>
</span>
<span class="size-14" ng-if="!$root.updatingBalance">
{{totalBalance || 0|noFractionNumber}} {{$root.wallet.settings.unitName}}
{{$root.wallet.balanceInfo.totalBalance || 0}} {{$root.wallet.settings.unitName}}
</span>
</section>
@ -93,7 +92,9 @@
ng-controller="HeadController"
class="head show-for-large-up"
ng-include="'views/includes/head.html'"
ng-if="$root.iden"></div>
ng-if="$root.iden"
ng-class="{'dni':$root.hideNavigation}"
></div>
<section ng-class="{'main':$root.iden && !$root.starting}" ng-view></section>

View file

@ -1,23 +1,80 @@
'use strict';
angular.module('copayApp.controllers').controller('CreateProfileController', function($scope, $rootScope, $location, $timeout, notification, pluginManager, identityService) {
identityService.goWalletHome();
angular.module('copayApp.controllers').controller('CreateProfileController', function($scope, $rootScope, $location, $timeout, notification, pluginManager, identityService, pinService) {
var _credentials, _firstpin;
$scope.init = function() {
identityService.goWalletHome();
pinService.makePinInput($scope, 'newpin', function(newValue) {
_firstpin = newValue;
$scope.askForPin = 2;
});
pinService.makePinInput($scope, 'repeatpin', function(newValue) {
if (newValue === _firstpin) {
_firstpin = null;
$scope.createPin(newValue);
} else {
$scope.askForPin = 1;
_firstpin = null;
$scope.setPinForm.newpin.$setViewValue('');
$scope.setPinForm.newpin.$render();
$scope.setPinForm.repeatpin.$setViewValue('');
$scope.setPinForm.repeatpin.$render();
$scope.setPinForm.$setPristine();
$scope.error = 'Entered PINs were not equal. Try again';
}
});
};
$scope.createPin = function(pin) {
preconditions.checkArgument(pin);
preconditions.checkState($rootScope.iden);
preconditions.checkState(_credentials && _credentials.email);
pinService.save(pin, _credentials.email, _credentials.password, function(err) {
_credentials.password = '';
_credentials = null;
$scope.askForPin = 0;
$rootScope.hasPin = true;
$scope.createDefaultWallet();
});
};
$scope.createDefaultWallet = function() {
$rootScope.hideNavigation = false;
identityService.createDefaultWallet(function(err) {
$scope.askForPin =0 ;
$scope.loading = false;
if (err) {
var msg = err.toString();
$scope.error = msg;
}
});
};
$scope.createProfile = function(form) {
$rootScope.hideNavigation = false;
if (form && form.$invalid) {
$scope.error('Error', 'Please enter the required fields');
$scope.error = 'Please enter the required fields';
return;
}
$rootScope.starting = true;
identityService.create(
form.email.$modelValue, form.password.$modelValue, function(err) {
$rootScope.starting = false;
if (err) {
var msg = err.toString();
if (msg.indexOf('EEXIST')>=0 || msg.indexOf('BADC')>=0 ) {
msg = 'This profile already exists'
}
$timeout(function() {
$scope.loading = true;
identityService.create(form.email.$modelValue, form.password.$modelValue, function(err) {
$scope.loading = false;
if (err) {
var msg = err.toString();
if (msg.indexOf('EEXIST') >= 0 || msg.indexOf('BADC') >= 0) {
msg = 'This profile already exists'
}
$timeout(function() {
form.email.$setViewValue('');
form.email.$render();
form.password.$setViewValue('');
@ -27,7 +84,26 @@ angular.module('copayApp.controllers').controller('CreateProfileController', fun
form.$setPristine();
$scope.error = msg;
},1);
}
$scope.error = msg;
} else {
$scope.error = null;
// mobile
if (isMobile.any()) {
_credentials = {
email: form.email.$modelValue,
password: form.password.$modelValue,
};
$scope.askForPin = 1;
$rootScope.hideNavigation = true;
$timeout(function() {
$rootScope.$digest();
}, 1);
return;
} else {
$scope.createDefaultWallet();
}
}
});
}
});

View file

@ -39,9 +39,10 @@ angular.module('copayApp.controllers').controller('HeadController', function($sc
window.onbeforeunload = undefined;
});
if ($rootScope.wallet) {
$scope.$on('$idleStart', function() {
});
$scope.init = function() {
if (!$rootScope.wallet) return;
$scope.$on('$idleStart', function() {});
$scope.$on('$idleWarn', function(a, countdown) {
$rootScope.countdown = countdown;
$rootScope.sessionExpired = true;
@ -64,8 +65,5 @@ angular.module('copayApp.controllers').controller('HeadController', function($sc
$rootScope.$watch('title', function(newTitle, oldTitle) {
$scope.title = newTitle;
});
$rootScope.$on('signout', function() {
$scope.signout();
});
}
};
});

View file

@ -1,20 +1,57 @@
'use strict';
angular.module('copayApp.controllers').controller('HomeController', function($scope, $rootScope, $location, $timeout, notification, identityService, Compatibility) {
// This is only for backwards compat, insight api should link to #!/confirmed directly
if (getParam('confirmed')) {
var hashIndex = window.location.href.indexOf('/?');
window.location = window.location.href.substr(0, hashIndex) + '#!/confirmed';
return;
}
angular.module('copayApp.controllers').controller('HomeController', function($scope, $rootScope, $location, $timeout, notification, identityService, Compatibility, pinService, applicationService, isMobile) {
if ($rootScope.fromEmailConfirmation) {
$scope.confirmedEmail = true;
$rootScope.fromEmailConfirmation = false;
}
var _credentials, _firstpin;
Compatibility.check($scope);
$scope.init = function() {
// This is only for backwards compat, insight api should link to #!/confirmed directly
if (getParam('confirmed')) {
var hashIndex = window.location.href.indexOf('/?');
window.location = window.location.href.substr(0, hashIndex) + '#!/confirmed';
return;
}
if ($rootScope.fromEmailConfirmation) {
$scope.confirmedEmail = true;
$rootScope.fromEmailConfirmation = false;
}
if ($rootScope.iden) {
identityService.goWalletHome();
}
Compatibility.check($scope);
pinService.check(function(err, value) {
$rootScope.hasPin = value;
});
};
pinService.makePinInput($scope, 'pin', function(newValue) {
$scope.openWithPin(newValue);
});
pinService.makePinInput($scope, 'newpin', function(newValue) {
_firstpin = newValue;
$scope.askForPin = 2;
});
pinService.makePinInput($scope, 'repeatpin', function(newValue) {
if (newValue === _firstpin) {
_firstpin = null;
$scope.createPin(newValue);
} else {
$scope.$$childTail.setPinForm.newpin.$setViewValue('');
$scope.$$childTail.setPinForm.newpin.$render();
$scope.$$childTail.setPinForm.repeatpin.$setViewValue('');
$scope.$$childTail.setPinForm.repeatpin.$render();
_firstpin = null;
$scope.askForPin = 1;
$scope.error = 'Entered PINs were not equal. Try again';
}
});
$scope.done = function() {
$rootScope.starting = false;
@ -22,28 +59,87 @@ angular.module('copayApp.controllers').controller('HomeController', function($sc
};
$scope.$on("$destroy", function(){
$scope.$on("$destroy", function() {
var iden = $rootScope.iden;
if (iden) {
iden.removeListener('newWallet', $scope.done );
iden.removeListener('noWallets', $scope.done );
iden.removeListener('newWallet', $scope.done);
iden.removeListener('noWallets', $scope.done);
}
});
$scope.openProfile = function(form) {
$scope.confirmedEmail = false;
$scope.openWithPin = function(pin) {
if (!pin) {
$scope.error = 'Please enter the required fields';
return;
}
var credentials = pinService.get(pin, function(err, credentials) {
if (err || !credentials) {
$scope.error = 'Wrong PIN';
return;
}
$rootScope.starting = true;
$scope.open(credentials.email, credentials.password);
});
};
$scope.openWallets = function() {
preconditions.checkState($rootScope.iden);
var iden = $rootScope.iden;
$rootScope.hideNavigation = false;
$rootScope.starting = true;
iden.on('newWallet', $scope.done);
iden.on('noWallets', $scope.done);
iden.openWallets();
};
$scope.createPin = function(pin) {
preconditions.checkArgument(pin);
preconditions.checkState($rootScope.iden);
preconditions.checkState(_credentials && _credentials.email);
pinService.save(pin, _credentials.email, _credentials.password, function(err) {
_credentials.password = '';
_credentials = null;
$scope.askForPin = 0;
$rootScope.hasPin = true;
$scope.openWallets();
});
};
$scope.openWithCredentials = function(form) {
if (form && form.$invalid) {
$scope.error = 'Please enter the required fields';
return;
}
$scope.open(form.email.$modelValue, form.password.$modelValue);
};
$scope.pinLogout = function() {
pinService.clear(function() {
copay.logger.debug('PIN erased');
delete $rootScope['hasPin'];
applicationService.reload();
});
};
$scope.open = function(email, password) {
$rootScope.starting = true;
identityService.open(form.email.$modelValue, form.password.$modelValue, function(err, iden) {
if (err) {
identityService.open(email, password, function(err, iden) {
if (err) {
$rootScope.starting = false;
copay.logger.warn(err);
if ((err.toString() || '').match('PNOTFOUND')) {
$scope.error = 'Invalid email or password';
pinService.clear(function() {
copay.logger.debug('PIN erased');
});
} else if ((err.toString() || '').match('Connection')) {
$scope.error = 'Could not connect to Insight Server';
} else if ((err.toString() || '').match('Unable')) {
@ -51,13 +147,33 @@ angular.module('copayApp.controllers').controller('HomeController', function($sc
} else {
$scope.error = 'Unknown error';
}
return $scope.done();
$rootScope.starting = false;
$rootScope.$digest();
return;
}
// Open successfully?
if (iden) {
iden.on('newWallet', $scope.done);
iden.on('noWallets', $scope.done);
iden.openWallets();
$scope.error = null;
$scope.confirmedEmail = false;
// mobile
if (isMobile.any() && !$rootScope.hasPin) {
$scope.done();
_credentials = {
email: email,
password: password,
};
$scope.askForPin = 1;
$rootScope.starting = false;
$rootScope.hideNavigation = true;
$rootScope.$digest();
return;
}
// no mobile
else {
$scope.openWallets();
}
}
});
}

View file

@ -24,8 +24,13 @@ angular.module('copayApp.controllers').controller('SidebarController', function(
'link': 'more'
}];
$scope.go = function (path) {
$location.path(path);
};
$scope.signout = function() {
$scope.$emit('signout');
$rootScope.signingOut = true;
identityService.signout();
};
$scope.isActive = function(item) {
@ -47,7 +52,7 @@ angular.module('copayApp.controllers').controller('SidebarController', function(
$scope.init = function() {
// This should be called only once.
// focused wallet change
if ($rootScope.wallet) {
$rootScope.$watch('wallet', function() {
@ -72,16 +77,14 @@ angular.module('copayApp.controllers').controller('SidebarController', function(
if (newWid && $rootScope.iden.getWalletById(newWid)) {
identityService.setFocusedWallet(newWid);
} else {
copay.logger.debug('No wallets');
copay.logger.debug('No wallets');
identityService.noFocusedWallet(newWid);
}
}
$scope.walletSelection = false;
$scope.setWallets();
});
}
};
$scope.setWallets = function() {

View file

@ -286,10 +286,20 @@ angular.module('copayApp.directives')
link: function(_scope, _element) {
$timeout(function() {
_element[0].focus();
}, 0);
});
}
};
})
.directive('showFocus', function($timeout) {
return function(scope, element, attrs) {
scope.$watch(attrs.showFocus,
function (newValue) {
$timeout(function() {
newValue && element[0].focus();
});
},true);
};
})
.directive('match', function() {
return {
require: 'ngModel',

View file

@ -355,17 +355,17 @@ Identity.prototype.remove = function(opts, cb) {
};
Identity.prototype._cleanUp = function() {
// NOP
_.each(this.wallets, function(w){
w.close();
});
};
/**
* @desc Closes the wallet and disconnects all services
*/
Identity.prototype.close = function() {
var self = this;
self.store({}, function(err) {
self.emitAndKeepAlive('closed');
});
this._cleanUp();
this.emitAndKeepAlive('closed');
};

View file

@ -3,6 +3,11 @@ angular.module('copayApp.services')
.factory('identityService', function($rootScope, $location, $timeout, $filter, pluginManager, notification, pendingTxsService, balanceService, applicationService) {
notification.enableHtml5Mode(); // for chrome: if support, enable it
// TODO:
// * remove iden from rootScope
// * remove wallet from rootScope
// * create walletService
var root = {};
root.check = function(scope) {
copay.Identity.checkIfExistsAny({
@ -22,6 +27,7 @@ angular.module('copayApp.services')
});
};
// TODO should be on 'walletService'
root.goWalletHome = function() {
var w = $rootScope.wallet;
if (w) {
@ -53,19 +59,24 @@ angular.module('copayApp.services')
preconditions.checkState(iden);
root.bind(iden);
var walletOptions = {
nickname: iden.fullName,
networkName: config.networkName,
requiredCopayers: 1,
totalCopayers: 1,
password: iden.password,
name: 'My wallet',
};
iden.createWallet(walletOptions, function(err, wallet) {
return cb(err);
});
return cb(null);
});
};
root.createDefaultWallet = function(cb) {
var iden = $rootScope.iden;
var walletOptions = {
nickname: iden.fullName,
networkName: config.networkName,
requiredCopayers: 1,
totalCopayers: 1,
password: iden.password,
name: 'My wallet',
};
iden.createWallet(walletOptions, function(err, wallet) {
return cb(err);
});
};
root.setServerStatus = function(headers) {

71
js/services/pinService.js Normal file
View file

@ -0,0 +1,71 @@
'use strict';
angular.module('copayApp.services')
.factory('pinService', function($rootScope, localstorageService) {
var KEY = 'pinDATA';
var SALT = '4gllotIKguqi0EkIslC0';
var ITER = 2000;
var ls = localstorageService;
var root = {};
root.check = function(cb) {
ls.getItem(KEY, function(err, value) {
return cb(err, value ? true : false);
});
};
root.get = function(pin, cb) {
ls.getItem(KEY, function(err, value) {
if (!value) return cb(null);
var enc = value;
var data = copay.crypto.decrypt('' + parseInt(pin), enc);
var err = new Error('Could not decrypt');
if (data) {
var obj;
try {
obj = JSON.parse(data);
err = null;
} catch (e) {};
}
return cb(err, obj);
});
};
root.save = function(pin, email, password, cb) {
var credentials = {
email: email,
password: password,
};
var enc = copay.crypto.encrypt('' + parseInt(pin), credentials, SALT, ITER);
ls.setItem(KEY, enc, function(err) {
return cb(err);
});
};
root.clear = function(cb) {
ls.removeItem(KEY, cb);
};
root.makePinInput = function(scope, name, cb) {
Object.defineProperty(scope, name, {
get: function() {
return this['_' + name];
},
set: function(newValue) {
this['_' + name] = newValue;
scope.error = null;
if (newValue && newValue.length == 4) {
return cb(newValue);
}
},
enumerable: true,
configurable: true
});
};
return root;
});

View file

@ -59,22 +59,22 @@ module.exports = {
/**
* Encrypts symmetrically using a passphrase
*/
encrypt: function(key, message) {
encrypt: function(key, message, salt, iter) {
if (!_.isString(message)) {
message = JSON.stringify(message);
}
sjcl.json.defaults.salt = defaultSalt;
sjcl.json.defaults.iter = defaultIterations;
sjcl.json.defaults.salt = salt || defaultSalt;
sjcl.json.defaults.iter = iter || defaultIterations;
return sjcl.encrypt(key, message);
},
/**
* Decrypts symmetrically using a passphrase
*/
decrypt: function(key, cyphertext) {
decrypt: function(key, sjclEncryptedJson) {
var output = {};
try {
return sjcl.decrypt(key, cyphertext);
return sjcl.decrypt(key, sjclEncryptedJson);
} catch (e) {
log.info('Decryption failed due to error: ' + e.message);
return null;

View file

@ -102,6 +102,48 @@ describe("Angular services", function() {
}));
});
describe("Unit: identityService Service", function() {
it('should contain a identityService service', inject(function(identityService) {
expect(identityService).not.to.equal(null);
}));
});
describe("Unit: pinService", function() {
it('should contain a pinService service', inject(function(pinService) {
expect(pinService).not.to.equal(null);
}));
it('should be able to check -> save -> get -> clear -> check', function(done) {
inject(function(pinService) {
pinService.save('123', 'user', 'pass', function(err) {
pinService.check(function(err, value) {
should.not.exist(err);
value.should.equal(true);
pinService.get('123', function(err, data) {
should.not.exist(err);
data.email.should.be.equal('user');
data.password.should.be.equal('pass');
pinService.clear(function(err) {
should.not.exist(err);
pinService.check(function(err, value) {
should.not.exist(err);
value.should.equal(false);
done();
});
});
});
});
})
})
});
});
describe("Unit: localstorageService", function() {
it('should contain a localstorageService service', inject(function(localstorageService) {
expect(localstorageService).not.to.equal(null);
}));
});
describe("Unit: Backup Service", function() {
it('should contain a backup service', inject(function(backupService) {
expect(backupService).not.to.equal(null);

View file

@ -1,28 +1,36 @@
<div class="createProfile" ng-controller="CreateProfileController">
<div class="createProfile" ng-controller="CreateProfileController" ng-init="init()">
<div data-alert class="loading-screen" ng-show="loading">
<div class="spinner">
<div class="contener_general">
<div class="contener_mixte"><div class="ballcolor ball_1">&nbsp;</div></div>
<div class="contener_mixte"><div class="ballcolor ball_2">&nbsp;</div></div>
<div class="contener_mixte"><div class="ballcolor ball_3">&nbsp;</div></div>
<div class="contener_mixte"><div class="ballcolor ball_4">&nbsp;</div></div>
<div class="contener_mixte">
<div class="ballcolor ball_1">&nbsp;</div>
</div>
<div class="contener_mixte">
<div class="ballcolor ball_2">&nbsp;</div>
</div>
<div class="contener_mixte">
<div class="ballcolor ball_3">&nbsp;</div>
</div>
<div class="contener_mixte">
<div class="ballcolor ball_4">&nbsp;</div>
</div>
</div>
<span class="text-gray size-12" translate>Creating profile...</span>
</div>
</div>
<div class="large-4 large-centered medium-6 medium-centered columns" ng-show="!loading">
<div class="large-4 large-centered medium-6 medium-centered columns" ng-show="!loading && !askForPin">
<div class="logo-setup">
<img src="img/logo-negative-beta.svg" alt="Copay" width="146" height="59">
<div ng-include="'views/includes/version.html'"></div>
</div>
</div>
<div class="box-setup">
<h1>Create Profile</h1>
<div class="box-notification" ng-show="error">
<div class="box-icon error">
<i class="fi-x size-24"></i>
</div>
</div>
<span class="text-warning size-14">
{{error|translate}}
</span>
@ -32,19 +40,18 @@
<span translate class="has-error size-12" ng-show="profileForm.email.$invalid &&
!profileForm.email.$pristine">
<span class="icon-input"><i class="fi-x"></i></span>
Not valid
Not valid
</span>
<span class="icon-input" ng-show="!profileForm.email.$invalid &&
!profileForm.email.$pristine"><i class="fi-check"></i></span>
</div>
<div class="input">
<input type="email" ng-model="email" class="form-control fi-email"
name="email" placeholder="Email" required auto-focus>
<input type="email" ng-model="email" class="form-control fi-email" name="email" placeholder="Email" required auto-focus>
<i class="icon-email"></i>
</div>
<div class="input">
<input id="password" type="password" ng-model="$parent.password"
<input id="password" type="password" ng-model="$parent.password"
class="form-control" name="password" placeholder="{{'Choose a password'|translate}}" check-strength="passwordStrength"
tooltip-html-unsafe="Password strength: <b>{{passwordStrength}}</b><br/><span class='size-12'>Tip: Use lower and uppercase, numbers and symbols</span>" tooltip-trigger="focus" required tooltip-placement="top">
<i class="icon-locked"></i>
@ -54,23 +61,19 @@
<span translate class="has-error size-12" ng-show="profileForm.repeatpassword.$dirty &&
profileForm.repeatpassword.$invalid">
<span class="icon-input"><i class="fi-x"></i></span>
{{'Passwords must match'|translate}}
{{'Passwords must match'|translate}}
</span>
<span class="icon-input" ng-show="profileForm.repeatpassword.$dirty &&
!profileForm.repeatpassword.$invalid"><i class="fi-check"></i></span>
!profileForm.repeatpassword.$invalid"><i class="fi-check"></i></span>
</div>
<div class="input">
<input type="password" ng-model="repeatpassword"
class="input form-control" name="repeatpassword"
placeholder="{{'Repeat password'|translate}}"
match="password" required>
<input type="password" ng-model="repeatpassword" class="input form-control" name="repeatpassword" placeholder="{{'Repeat password'|translate}}" match="password" required>
<i class="icon-locked"></i>
</div>
<button translate type="submit" class="button primary radius expand m0"
ng-disabled="profileForm.$invalid || loading">
Create
<button translate type="submit" class="button primary radius expand m0" ng-disabled="profileForm.$invalid || loading">
Create
</button>
</form>
<div class="box-setup-footer">
@ -89,6 +92,49 @@
</div>
</div>
</div>
<div class="large-4 large-centered medium-6 medium-centered columns" ng-show="!loading && askForPin">
<div class="box-setup">
<h1><span translate>Set up a </span> <b> PIN </b>?</h1>
<p class="size-14">Enter a 4-digit number for easier access from this device</p>
<div class="box-notification" ng-show="error">
<div class="box-icon error">
<i class="fi-x size-24"></i>
</div>
<span class="text-warning size-14">
{{error|translate}}
</span>
</div>
<form name="setPinForm" ng-submit="createPin(setPinForm)" novalidate>
<div class="input" ng-show="askForPin == 1">
<input id="newpin" type="tel" ng-model="newpin" class="form-control" ng-maxlength="4" ng-minlength="4" maxlength="4" ng-pattern="/^[0-9]{1,4}$/" placeholder="PIN" name="newpin" required show-focus="askForPin == 1">
<i class="icon-locked"></i>
</div>
<div class="input" ng-show="askForPin == 2">
<input id="repeatpin" type="tel" ng-model="repeatpin" class="form-control" ng-maxlength="4" ng-minlength="4" maxlength="4" ng-pattern="/^[0-9]{1,4}$/" placeholder="Confirm your PIN" name="repeatpin" required show-focus="askForPin == 2">
<i class="icon-locked"></i>
</div>
<div class="box-setup-footer row collapse">
<div class="large-6 medium-6 small-6 columns">
<a class="button secondary radius m0" ng-click="createDefaultWallet()">
<span translate>Skip</span>
</a>
</div>
<div class="large-6 medium-6 small-6 columns text-right">
<button translate type="submit" class="button primary radius expand m0"
ng-disabled="setPinForm.$invalid || error">
OK
</button>
</div>
</div>
</form>
</div>
</div>
</div>

View file

@ -1,4 +1,4 @@
<div class="home" ng-controller="HomeController">
<div class="home" ng-controller="HomeController" ng-init="init()">
<div class="loading-screen" ng-show="$root.starting">
<div class="spinner">
@ -13,7 +13,7 @@
</div>
<div class="large-4 large-centered medium-7 medium-centered columns" ng-show="!$root.starting">
<div class="logo-setup">
<div class="logo-setup" ng-show="!$root.iden">
<img src="img/logo-negative-beta.svg" alt="Copay" width="146" height="59">
<div ng-include="'views/includes/version.html'"></div>
</div>
@ -47,9 +47,94 @@
<a class="text-white" href="#!/createProfile">creating your profile</a>
</div>
<div class="box-setup">
<div class="box-setup" ng-if="askForPin">
<h1><span translate>Set up a </span> <b> PIN </b>?</h1>
<p class="size-14"> Enter a 4-digit number for easier access from this device</p>
<div class="box-notification" ng-show="error">
<div class="box-icon error">
<i class="fi-x size-24"></i>
</div>
<span class="text-warning size-14">
{{error|translate}}
</span>
</div>
<form name="setPinForm" ng-model="setPinForm" ng-submit="createPin(setPinForm)" novalidate>
<div class="input" ng-show="askForPin == 1">
<input id="newpin" type="tel" ng-model="newpin" class="form-control"
ng-maxlength="4" ng-minlength="4" maxlength="4"
ng-pattern="/^[0-9]{1,4}$/"
placeholder="PIN" name="newpin" required show-focus="askForPin == 1">
<i class="icon-locked"></i>
</div>
<div class="input" ng-show="askForPin == 2">
<input id="repeatpin" type="tel" ng-model="repeatpin" class="form-control"
ng-maxlength="4" ng-minlength="4" maxlength="4"
ng-pattern="/^[0-9]{1,4}$/"
placeholder="Confirm your PIN" name="repeatpin" required show-focus="askForPin == 2">
<i class="icon-locked"></i>
</div>
<div class="box-setup-footer row collapse">
<div class="large-6 medium-6 small-6 columns">
<a class="button secondary radius m0" ng-click="openWallets()">
<span translate>Skip</span>
</a>
</div>
<div class="large-6 medium-6 small-6 columns text-right">
<button translate type="submit" class="button primary radius expand m0"
ng-disabled="setPinForm.$invalid || error">
OK
</button>
</div>
</div>
</form>
</div>
<div class="box-setup" ng-if='$root.hasPin'>
<h1><span translate>Enter your </span> <b> PIN</b></h1>
<form name="pinForm" novalidate>
<div class="box-notification" ng-show="error">
<div class="box-icon error">
<i class="fi-x size-24"></i>
</div>
<span class="text-warning size-14">
{{error|translate}}
</span>
</div>
<div class="input">
<input id="pin" type="tel" ng-model="pin" class="form-control"
ng-maxlength="4" ng-minlength="4" maxlength="4"
ng-pattern="/^[0-9]{1,4}$/"
placeholder="Pin number" name="pin" required auto-focus>
<i class="icon-locked"></i>
</div>
<div class="box-setup-footer row collapse">
<div class="large-6 medium-6 small-6 columns">
<a class="button warning radius m0" ng-click="pinLogout()">
<i class="icon-power"></i>
<span translate>Logout</span>
</a>
</div>
<div class="large-6 medium-6 small-6 columns text-right">
<button translate type="submit" class="button primary radius expand m0"
ng-disabled="pinForm.$invalid || error">
Sign in
</button>
</div>
</div>
</form>
</div>
<div class="box-setup" ng-if='!$root.hasPin && !askForPin'>
<h1><span translate>Sign in to</span> <b>Copay</b></h1>
<form name="loginForm" ng-submit="openProfile(loginForm)" novalidate>
<form name="loginForm" ng-submit="openWithCredentials(loginForm)" novalidate>
<p class="text-warning size-12"
ng-show="error">
<i class="fi-x"></i>
@ -71,6 +156,7 @@
Sign in
</button>
</form>
<div class="box-setup-footer">
<div class="left m10r">
<a class="button-setup text-gray" href="#!/createProfile">

View file

@ -1,6 +1,6 @@
<div class="row collapse" ng-controller="SidebarController">
<div class="medium-3 small-3 columns text-center bottombar-item" data-ng-repeat="item in menu" ui-route="{{item.link}}" ng-if="item.link!='more'">
<a href="#!/{{item.link}}" ng-class="{active: isActive(item)}">
<div class="medium-3 small-3 columns text-center bottombar-item" ng-repeat="item in menu" ui-route="{{item.link}}" ng-if="item.link!='more'">
<a ng-click="go(item.link)" ng-class="{active: isActive(item)}">
<i class="size-36 {{item.icon}} db"></i>
<div class="size-10 tu">
{{item.title}}

View file

@ -1,7 +1,7 @@
<div class="title">
<h1>
{{$root.title}}
<small>
<small ng-if="$root.wallet">
<a class="text-gray" ng-click="refresh()" ng-if="!$root.updatingBalance">
<i class="fi-refresh"></i>
</a>
@ -14,8 +14,7 @@
<div class="menu" ng-mouseover="hoverIn()" ng-mouseleave="hoverOut()"
ng-click="hoverMenu = !hoverMenu">
<div class="menu" ng-mouseover="hoverIn()" ng-mouseleave="hoverOut()" ng-init="init()" ng-click="hoverMenu = !hoverMenu">
<a class="dropdown ellipsis text-gray pr" ng-class="{'hover': hoverMenu}">
<div class="photo-container">
<img gravatar-src="'{{username}}'" gravatar-size="35">
@ -39,7 +38,10 @@
<i class="icon-person size-18 m10r"></i> {{'Profile'|translate}}<span class="size-10 text-warning" ng-if="!$root.needsEmailConfirmation && $root.iden.backupNeeded"> [ Needs Backup ]</span></a>
</li>
<li><a href="#!/" title="Close" ng-click="signout()">
<i class="icon-power size-18 m10r"></i> {{'Close'|translate}}</a></li>
<span ng-if="!$root.hasPin"><i class="icon-power size-18 m10r"></i> {{'Close'|translate}}</span>
<span ng-if="$root.hasPin"><i class="fi-lock size-18 m10r"></i> {{'Lock'|translate}}</span>
</a></li>
</ul>
</div>

View file

@ -1,6 +1,6 @@
<div ng-controller="SidebarController" ng-init="getWallets()">
<div ng-controller="SidebarController" ng-init="init()">
<header>
<div ng-click="toggleWalletSelection()">
<div ng-click="toggleWalletSelection()" ng-if="$root.wallet">
<div class="col1">
<div class="avatar-wallet">{{$root.wallet.getName() | limitTo: 1}}</div>
</div>
@ -40,16 +40,16 @@
<a href="#!/create" class="db button secondary tiny" title="Create new wallet">
<i class="m10r fi-plus"></i> {{'Create new wallet' | translate }} </a>
</div>
<ul class="side-nav wallets off-canvas-list" ng-show="wallets[0]"
ng-click="toggleWalletSelection()">
<ul class="side-nav wallets off-canvas-list" ng-show="wallets[0]">
<li data-ng-repeat="item in wallets track by $index"
class="nav-item"
ng-if="item.id != $root.wallet.id">
ng-if="item.id != $root.wallet.id"
ng-click="toggleWalletSelection(); switchWallet(item.id)">
<div class="col1">
<div class="avatar-wallet">{{(item.name || item.id) | limitTo: 1}}</div>
</div>
<div class="col2">
<a class="size-12 wallet-item" ng-click="switchWallet(item.id)">
<a class="size-12 wallet-item">
<div class="oh">
<div class="right size-10 type-wallet">
[ {{item.requiredCopayers}} of {{item.totalCopayers}} ]</div>
@ -95,13 +95,16 @@
<a href="#!/import" class="db p20h nav-item" title="Import wallet">
<i class="size-24 m20r fi-download"></i> {{'Import a wallet' | translate }} </a>
</li>
<li>
<a href="#!/more" class="db p20h nav-item" title="Settings">
<i class="size-24 m20r fi-widget"></i> {{'Settings' | translate }} </a>
<li ng-if="$root.wallet">
<a href="#!/more" class="db p20h nav-item" title="Settings" >
<i class="size-24 m20r fi-widget"></i> {{'Wallet Settings' | translate }} </a>
</li>
<li>
<a href="#!/" class="db p20h nav-item" title="Close"
ng-click="signout()"><i class="size-24 m20r fi-power"></i> {{'Close'|translate}}</a>
ng-click="signout()">
<span ng-if="!$root.hasPin"><i class="size-24 m20r fi-power"></i> {{'Close'|translate}}</span>
<span ng-if="$root.hasPin"><i class="size-24 m20r fi-lock"></i> {{'Lock'|translate}}</span>
</a>
</li>
</ul>
<div class="text-gray size-12 text-center columns">

View file

@ -8,14 +8,6 @@
<b class="db m5t" ng-show="label">
({{label}})
</b>
<p class="m10t size-18">
<span ng-show="$root.updatingBalance">
<i class="fi-bitcoin-circle icon-rotate spinner"></i>
</span>
<span ng-show="!$root.updatingBalance">
{{address.balance || 0}} {{$root.wallet.settings.unitName}}
</span>
</p>
</div>
</div>
<a class="close-reveal-modal" ng-click="cancel()">&#215;</a>

View file

@ -14,8 +14,8 @@
<div class="row show-for-large-up">
<div class="large-7 medium-9 columns">
<div class="list-addr">
<contact address="{{addr.address}}" tooltip-popup-delay="500" tooltip tooltip-placement="right">
<small translate class="label" ng-if="addr.isChange">change</small>
<contact address="{{::addr.address}}" tooltip-popup-delay="500" tooltip tooltip-placement="right">
<small translate class="label" ng-if="::addr.isChange">change</small>
</div>
</div>
<div class="large-3 medium-3 columns text-right">
@ -34,8 +34,8 @@
<div class="small-12 columns">
<div class="list-addr">
<div class="ellipsis">
<span><contact address="{{addr.address}}"></span>
<small translate class="label" ng-if="addr.isChange">change</small>
<span><contact address="{{::addr.address}}"></span>
<small translate class="label" ng-if="::addr.isChange">change</small>
</div>
<div class="text-right m10t">
<span class="size-14" ng-show="$root.updatingBalance">

View file

@ -217,9 +217,9 @@
ng-repeat="(addr, info) in $root.wallet.addressBook"
ng-class="{'addressbook-disabled': info.hidden}">
<td><a ng-click="copyAddress(addr)" title="Copy address">{{info.label}}</a></td>
<td class="size-12">{{addr}}</td>
<td class="size-12">{{::addr}}</td>
<td ng-show="$root.wallet.isShared()" ng-class="{'hide-for-small-only' : $root.wallet.isShared()}">{{$root.wallet.publicKeyRing.nicknameForCopayer(info.copayerId)}}</td>
<td class="hide-for-small-only"><time>{{info.createdTs | amCalendar}}</time></td>
<td class="hide-for-small-only"><time>{{::info.createdTs | amCalendar}}</time></td>
<td class="hide-for-small-only">
<a ng-click="toggleAddressBookEntry(addr)" title="{{ info.hidden ? 'Enable' : 'Disable'}} address">
<i class="fi-checkbox"