diff options
author | Marcos Zuriaga <wolfi@wolfi.es> | 2016-10-06 14:55:14 +0300 |
---|---|---|
committer | Marcos Zuriaga <wolfi@wolfi.es> | 2016-10-06 14:55:14 +0300 |
commit | c09622571c4f43774b8d1862b5cb2ea13f503f82 (patch) | |
tree | 70d9b1be412f38a71fe0a8712ce2c4bef9d495ee /js/app/services/credentialservice.js | |
parent | 218d27fcbca7ac3bbdaccbc47dd7c865dc46465f (diff) |
Some fixes and improvements, js trolling me
Diffstat (limited to 'js/app/services/credentialservice.js')
-rw-r--r-- | js/app/services/credentialservice.js | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/js/app/services/credentialservice.js b/js/app/services/credentialservice.js index 8134388d..b3aa28da 100644 --- a/js/app/services/credentialservice.js +++ b/js/app/services/credentialservice.js @@ -168,11 +168,13 @@ angular.module('passmanApp') this.calculated = current / total * 100; }; - var promise_credential_update = (function(){ + var promise_credential_update = function(){ + console.warn(this); this.getCredential(credential_id).then((function (credential) { this.plain_credential = this.decryptCredential(credential, this.old_password); - this.new_credential_cryptogram = this.encryptCredential(this.temp_data.plain_credential, this.new_password); + this.new_credential_cryptogram = this.encryptCredential(this.plain_credential, this.new_password); + console.warn(this); this.call_progress(new progress_datatype(1, 2)); // Save data @@ -181,9 +183,9 @@ angular.module('passmanApp') this.call_then(this.plain_credential); }).bind(this)); }).bind(this)); - }).bind(this); + }; - var promise_files_update = (function(){ + var promise_files_update = function(){ // Add the double of the files so we take encryption phase and upload to the server into the math this.total = this.plain_credential.files.length * 2; // Binded on credential finish upload this.current = 0; @@ -208,9 +210,9 @@ angular.module('passmanApp') }).bind(this)); }).bind(this)); } - }).bind(this); + }; - var promise_revisions_update = (function(){ + var promise_revisions_update = function(){ CredentialService.getRevisions(this.plain_credential.guid).then((function (revisions) { // Double, so we include the actual upload of the data back to the server this.total = revisions.length * 2; @@ -239,9 +241,9 @@ angular.module('passmanApp') setTimeout(revision_workload.bind(this), 1); }; }).bind(this)); - }).bind(this); + }; - var promise_workload = (function(){ + var promise_workload = function(){ this.old_password = angular.copy(old_password); this.new_password = angular.copy(new_password); this.promises = 0; @@ -264,14 +266,14 @@ angular.module('passmanApp') this.call_progress(data); }).then(function(data){ this.promises --; - if (this.prmises == 0){ + if (this.promises == 0){ this.call_then("All done"); } }) }); - }).bind(this); + }; - return new C_Promise(promise_workload); + return new C_Promise(promise_workload.bind(this)); } } }]); |