2015-03-06 12:00:10 -03:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
|
|
angular.module('copayApp.controllers').controller('passwordController',
|
2015-09-29 15:48:55 -03:00
|
|
|
function($rootScope, $scope, $timeout, profileService, notification, go, gettext) {
|
2015-03-06 12:00:10 -03:00
|
|
|
|
|
|
|
|
var pass1;
|
|
|
|
|
|
2016-02-11 16:44:06 -05:00
|
|
|
this.isVerification = false;
|
2015-03-06 12:00:10 -03:00
|
|
|
|
2015-09-29 15:48:55 -03:00
|
|
|
document.getElementById("passwordInput").focus();
|
|
|
|
|
|
2016-02-11 16:44:06 -05:00
|
|
|
this.close = function(cb) {
|
2016-05-09 20:23:20 +02:00
|
|
|
return cb('No spending password given');
|
2015-03-06 12:00:10 -03:00
|
|
|
};
|
|
|
|
|
|
2016-02-11 16:44:06 -05:00
|
|
|
this.set = function(isSetup, cb) {
|
|
|
|
|
this.loading = true;
|
|
|
|
|
this.error = false;
|
|
|
|
|
|
|
|
|
|
var self = this;
|
|
|
|
|
|
|
|
|
|
$timeout(function() {
|
|
|
|
|
if (isSetup && !self.isVerification) {
|
|
|
|
|
self.loading = false;
|
|
|
|
|
document.getElementById("passwordInput").focus();
|
|
|
|
|
self.isVerification = true;
|
|
|
|
|
pass1 = $scope.password;
|
|
|
|
|
$scope.password = null;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (isSetup && pass1 != $scope.password) {
|
|
|
|
|
self.loading = false;
|
2016-05-09 20:23:20 +02:00
|
|
|
self.error = gettext('Spending Passwords do not match');
|
2015-03-06 12:00:10 -03:00
|
|
|
self.isVerification = false;
|
2016-02-11 16:44:06 -05:00
|
|
|
$scope.password = null;
|
2015-09-29 15:48:55 -03:00
|
|
|
pass1 = null;
|
2015-03-06 12:00:10 -03:00
|
|
|
return;
|
|
|
|
|
}
|
2016-02-11 16:44:06 -05:00
|
|
|
return cb(null, $scope.password);
|
|
|
|
|
}, 100);
|
2015-03-06 12:00:10 -03:00
|
|
|
};
|
|
|
|
|
|
2016-02-11 16:44:06 -05:00
|
|
|
});
|