Wallet/src/js/controllers/password.js
2015-04-29 19:19:10 -03:00

41 lines
925 B
JavaScript

'use strict';
angular.module('copayApp.controllers').controller('passwordController',
function($rootScope, $scope, $timeout, profileService, notification, go, gettext) {
var self = this;
var pass1;
self.isVerification = false;
self.close = function(cb){
return cb('No password given');
};
self.set = function(isSetup, cb){
self.error = false;
if (isSetup && !self.isVerification) {
self.isVerification = true;
pass1= self.password;
self.password = null;
$timeout(function(){
$rootScope.$apply();
})
return;
}
if (isSetup) {
if (pass1 != self.password) {
self.error = gettext('Passwords do not match');
self.isVerification = false;
self.password = null;
pass1 =null;
return;
}
}
return cb(null, self.password);
};
});