diff --git a/js/app/controllers/bookmarklet.js b/js/app/controllers/bookmarklet.js index 0c2f8f3b..825d041b 100644 --- a/js/app/controllers/bookmarklet.js +++ b/js/app/controllers/bookmarklet.js @@ -89,7 +89,6 @@ $scope.sharing_keys = {}; $scope.newVault = function () { $scope.creating_vault = true; - var _vault = {}; var key_size = 1024; ShareService.generateRSAKeys(key_size).progress(function (progress) { var p = progress > 0 ? 2 : 1; @@ -121,7 +120,7 @@ VaultService.setActiveVault(_vault); try { - var c = EncryptService.decryptString(vault.challenge_password); + EncryptService.decryptString(vault.challenge_password); if ($scope.remember_vault_password) { SettingsService.setSetting('defaultVaultPass', vault_key); } @@ -149,10 +148,10 @@ test_credential.hidden = true; test_credential.vault_id = vault.vault_id; test_credential.password = 'lorum ipsum'; - CredentialService.createCredential(test_credential).then(function (result) { + CredentialService.createCredential(test_credential).then(function () { _vault.public_sharing_key = angular.copy($scope.sharing_keys.public_sharing_key); _vault.private_sharing_key = EncryptService.encryptString(angular.copy($scope.sharing_keys.private_sharing_key)); - VaultService.updateSharingKeys(_vault).then(function (result) { + VaultService.updateSharingKeys(_vault).then(function () { _loginToVault(vault, vault_key); }); }); @@ -351,7 +350,7 @@ if (!$scope.storedCredential.credential_id) { $scope.storedCredential.vault_id = $scope.active_vault.vault_id; - CredentialService.createCredential($scope.storedCredential).then(function (result) { + CredentialService.createCredential($scope.storedCredential).then(function () { NotificationService.showNotification('Credential created!', 5000); }); } diff --git a/js/app/controllers/credential.js b/js/app/controllers/credential.js index 5457d17b..1e3629f7 100644 --- a/js/app/controllers/credential.js +++ b/js/app/controllers/credential.js @@ -138,7 +138,7 @@ crypted_shared_key = private_key.decrypt(forge.util.decode64(crypted_shared_key)); crypted_shared_key = EncryptService.encryptString(crypted_shared_key); - ShareService.saveSharingRequest(share_request, crypted_shared_key).then(function (result) { + ShareService.saveSharingRequest(share_request, crypted_shared_key).then(function () { var idx = $scope.incoming_share_requests.indexOf(share_request); $scope.incoming_share_requests.splice(idx, 1); var active_share_requests = false; @@ -249,7 +249,7 @@ } NotificationService.showNotification('Credential recovered', 5000, function () { - CredentialService.updateCredential(_credential).then(function (result) { + CredentialService.updateCredential(_credential).then(function () { notification = false; }); @@ -259,7 +259,7 @@ $scope.destroyCredential = function (credential) { var _credential = angular.copy(credential); - CredentialService.destroyCredential(_credential.credential_id).then(function (result) { + CredentialService.destroyCredential(_credential.credential_id).then(function () { for (var i = 0; i < $scope.active_vault.credentials.length; i++) { if ($scope.active_vault.credentials[i].credential_id === credential.credential_id) { $scope.active_vault.credentials.splice(i, 1); diff --git a/js/app/controllers/edit_credential.js b/js/app/controllers/edit_credential.js index 18a60da4..e89b5536 100644 --- a/js/app/controllers/edit_credential.js +++ b/js/app/controllers/edit_credential.js @@ -231,7 +231,7 @@ if (!$scope.storedCredential.credential_id) { $scope.storedCredential.vault_id = $scope.active_vault.vault_id; - CredentialService.createCredential($scope.storedCredential).then(function (result) { + CredentialService.createCredential($scope.storedCredential).then(function () { $location.path('/vault/' + $routeParams.vault_id); NotificationService.showNotification('Credential created!', 5000); }); @@ -259,7 +259,7 @@ var _useKey = (key != null); var regex = /(<([^>]+)>)/ig; _credential.description = _credential.description.replace(regex, ""); - CredentialService.updateCredential(_credential, _useKey).then(function (result) { + CredentialService.updateCredential(_credential, _useKey).then(function () { SettingsService.setSetting('edit_credential', null); $location.path('/vault/' + $routeParams.vault_id); NotificationService.showNotification('Credential updated!', 5000); diff --git a/js/app/controllers/import.js b/js/app/controllers/import.js index 59edf5de..7a1a07e5 100644 --- a/js/app/controllers/import.js +++ b/js/app/controllers/import.js @@ -42,9 +42,9 @@ }; $scope.fileLoadError = function (file) { - console.error('Error loading file'); + console.error('Error loading file', file); }; - $scope.fileSelectProgress = function (progress) { + $scope.fileSelectProgress = function () { }; diff --git a/js/app/controllers/public_shared_credential.js b/js/app/controllers/public_shared_credential.js index 20e18afd..68c95146 100644 --- a/js/app/controllers/public_shared_credential.js +++ b/js/app/controllers/public_shared_credential.js @@ -31,7 +31,6 @@ $scope.downloadFile = function (credential, file) { ShareService.downloadSharedFile(credential, file).then(function (result) { - var key = null; if (!result.hasOwnProperty('file_data')) { NotificationService.showNotification('Error downloading file, you probably don\'t have enough permissions', 5000); return; diff --git a/js/app/controllers/revision.js b/js/app/controllers/revision.js index 78c601df..1d3ceafb 100644 --- a/js/app/controllers/revision.js +++ b/js/app/controllers/revision.js @@ -111,7 +111,7 @@ //Used in activity _credential.revision_created = $filter('date')(_revision.created * 1000, "dd-MM-yyyy @ HH:mm:ss"); - CredentialService.updateCredential(_credential, (key)).then(function (result) { + CredentialService.updateCredential(_credential, (key)).then(function () { SettingsService.setSetting('revision_credential', null); $rootScope.$emit('app_menu', false); $location.path('/vault/' + $routeParams.vault_id); diff --git a/js/app/controllers/share.js b/js/app/controllers/share.js index e4cb51a3..00454b16 100644 --- a/js/app/controllers/share.js +++ b/js/app/controllers/share.js @@ -10,8 +10,8 @@ * This file is part of passman, licensed under AGPLv3 */ angular.module('passmanApp') - .controller('ShareCtrl', ['$scope', 'VaultService', 'CredentialService', 'SettingsService', '$location', '$routeParams', 'ShareService', 'NotificationService', 'SharingACL', 'EncryptService', 'FileService', - function ($scope, VaultService, CredentialService, SettingsService, $location, $routeParams, ShareService, NotificationService, SharingACL, EncryptService, FileService) { + .controller('ShareCtrl', ['$scope', 'VaultService', 'CredentialService', 'SettingsService', '$location', '$routeParams', 'ShareService', 'NotificationService', 'SharingACL', 'EncryptService', + function ($scope, VaultService, CredentialService, SettingsService, $location, $routeParams, ShareService, NotificationService, SharingACL, EncryptService) { $scope.active_vault = VaultService.getActiveVault(); $scope.tabs = [{ @@ -144,7 +144,6 @@ }); $scope.inputSharedWith = []; - $scope.selectedAccessLevel = '1'; $scope.searchUsers = function ($query) { return ShareService.search($query); @@ -157,7 +156,7 @@ $scope.setPermission = function (acl, permission) { acl.togglePermission(permission); }; - $scope.shareWith = function (shareWith, selectedAccessLevel) { + $scope.shareWith = function (shareWith) { $scope.inputSharedWith = []; if (shareWith.length > 0) { for (var i = 0; i < shareWith.length; i++) { @@ -203,7 +202,7 @@ _credential = CredentialService.encryptCredential(_credential, old_key); CredentialService.updateCredential(_credential, true).then(function () { NotificationService.showNotification('Credential unshared', 4000); - CredentialService.reencryptCredential(_credential.guid, old_key, new_key).then(function (data) { + CredentialService.reencryptCredential(_credential.guid, old_key, new_key).then(function () { getAcl(); }); }); @@ -292,7 +291,7 @@ var encryptedSharedCredential = angular.copy($scope.storedCredential); var old_key = VaultService.getActiveVault().vaultKey; - CredentialService.reencryptCredential(encryptedSharedCredential.guid, old_key, key).progress(function (data) { + CredentialService.reencryptCredential(encryptedSharedCredential.guid, old_key, key).progress(function () { }).then(function (data) { var _credential = data.cryptogram; _credential.set_share_key = true; @@ -336,7 +335,7 @@ user.accessLevel = angular.copy(user.acl.getAccessLevel()); ShareService.shareWithUser(storedCredential, user) - .then(function (data) { + .then(function () { $scope.share_settings.upload_progress.done++; $scope.share_settings.upload_progress.percent = $scope.share_settings.upload_progress.done / $scope.share_settings.upload_progress.total * 100; }); diff --git a/js/app/controllers/share_settings.js b/js/app/controllers/share_settings.js index aa07ccec..71b7eada 100644 --- a/js/app/controllers/share_settings.js +++ b/js/app/controllers/share_settings.js @@ -54,7 +54,7 @@ $scope.active_vault.private_sharing_key = EncryptService.encryptString(pem.privateKey); $scope.active_vault.public_sharing_key = pem.publicKey; - VaultService.updateSharingKeys($scope.active_vault).then(function (result) { + VaultService.updateSharingKeys($scope.active_vault).then(function () { $scope.sharing_keys = ShareService.getSharingKeys(); }); }); diff --git a/js/app/controllers/vault.js b/js/app/controllers/vault.js index beb9f545..d179851c 100644 --- a/js/app/controllers/vault.js +++ b/js/app/controllers/vault.js @@ -71,7 +71,6 @@ $scope.sharing_keys = {}; $scope.newVault = function () { $scope.creating_vault = true; - var _vault = {}; var key_size = 1024; ShareService.generateRSAKeys(key_size).progress(function (progress) { var p = progress > 0 ? 2 : 1; @@ -103,7 +102,7 @@ VaultService.setActiveVault(_vault); try { - var c = EncryptService.decryptString(vault.challenge_password); + EncryptService.decryptString(vault.challenge_password); if ($scope.remember_vault_password) { SettingsService.setSetting('defaultVaultPass', vault_key); } @@ -133,10 +132,10 @@ test_credential.hidden = true; test_credential.vault_id = vault.vault_id; test_credential.password = 'lorum ipsum'; - CredentialService.createCredential(test_credential).then(function (result) { + CredentialService.createCredential(test_credential).then(function () { _vault.public_sharing_key = angular.copy($scope.sharing_keys.public_sharing_key); _vault.private_sharing_key = EncryptService.encryptString(angular.copy($scope.sharing_keys.private_sharing_key)); - VaultService.updateSharingKeys(_vault).then(function (result) { + VaultService.updateSharingKeys(_vault).then(function () { _loginToVault(vault, vault_key); }); }); diff --git a/js/app/directives/autoscroll.js b/js/app/directives/autoscroll.js index b30fd2ef..6f03b701 100644 --- a/js/app/directives/autoscroll.js +++ b/js/app/directives/autoscroll.js @@ -13,7 +13,7 @@ scope: { autoScroll: '=' }, - link: function postLink (scope, element, attrs) { + link: function postLink (scope) { scope.$watch('autoScroll', function () { $('#import_log').scrollTop($('#import_log')[0].scrollHeight); }, true); diff --git a/js/app/directives/clickselect.js b/js/app/directives/clickselect.js index 86220e00..dbd014e8 100644 --- a/js/app/directives/clickselect.js +++ b/js/app/directives/clickselect.js @@ -10,7 +10,7 @@ .directive('selectOnClick', ['$window', function ($window) { return { restrict: 'A', - link: function (scope, element, attrs) { + link: function (scope, element) { element.on('click', function () { if (!$window.getSelection().toString()) { // Required for mobile Safari diff --git a/js/app/directives/colorfromstring.js b/js/app/directives/colorfromstring.js index 62127749..ec9314f1 100644 --- a/js/app/directives/colorfromstring.js +++ b/js/app/directives/colorfromstring.js @@ -7,13 +7,13 @@ * # passwordGen */ angular.module('passmanApp') - .directive('colorFromString', ['$window', function ($window) { + .directive('colorFromString', [function () { return { restrict: 'A', scope:{ string: '=colorFromString' }, - link: function (scope, el, attr, ctrl) { + link: function (scope, el) { function genColor(str) { // java String#hashCode var hash = 0; for (var i = 0; i < str.length; i++) { diff --git a/js/app/directives/credentialfield.js b/js/app/directives/credentialfield.js index 0d040aa7..4725beae 100644 --- a/js/app/directives/credentialfield.js +++ b/js/app/directives/credentialfield.js @@ -27,7 +27,7 @@ '
' + '
' + '', - link: function (scope, elem, attrs, modelCtrl) { + link: function (scope) { var expression = /(https?:\/\/(?:www\.|(?!www))[^\s\.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})/gi; var regex = new RegExp(expression); diff --git a/js/app/directives/fileselect.js b/js/app/directives/fileselect.js index 60b3e25a..8f258042 100644 --- a/js/app/directives/fileselect.js +++ b/js/app/directives/fileselect.js @@ -17,7 +17,7 @@ progress: '&progress' }, - link: function (scope, el, attr, ctrl) { + link: function (scope, el) { scope.success = scope.success(); scope.error = scope.error(); scope.progress = scope.progress(); @@ -44,7 +44,6 @@ el.bind('change', function (e) { var _queueTotalFileSize = 0; - var _queueProgressBytes = 0; var i; //Calcutate total size for (i = 0; i < e.target.files.length; i++) { diff --git a/js/app/directives/otp.js b/js/app/directives/otp.js index b03610d0..2765c3b6 100644 --- a/js/app/directives/otp.js +++ b/js/app/directives/otp.js @@ -54,7 +54,7 @@ secret: '=' }, replace: true, - link: function (scope, element) { + link: function (scope) { scope.otp = null; scope.timeleft = null; scope.timer = null; @@ -93,7 +93,7 @@ }, true); scope.$on( "$destroy", - function (event) { + function () { $timeout.cancel(scope.timer); } ); diff --git a/js/app/directives/passwordgen.js b/js/app/directives/passwordgen.js index 42511aea..56367368 100644 --- a/js/app/directives/passwordgen.js +++ b/js/app/directives/passwordgen.js @@ -9,7 +9,7 @@ */ angular.module('passmanApp') - .directive('passwordGen', function ($timeout, $window) { + .directive('passwordGen', function ($timeout) { /* jshint ignore:start */ function Arcfour () { this.j = this.i = 0, this.S = [] @@ -136,7 +136,7 @@ "" + "" + "", - link: function (scope, elem, attrs, modelCtrl) { + link: function (scope) { scope.callback = scope.callback(); scope.$watch("model", function () { scope.password = scope.model; diff --git a/js/app/directives/progressbar.js b/js/app/directives/progressbar.js index 0b4d9e11..fd966763 100644 --- a/js/app/directives/progressbar.js +++ b/js/app/directives/progressbar.js @@ -7,7 +7,7 @@ * # passwordGen */ angular.module('passmanApp') - .directive('progressBar', ['$window', function ($window) { + .directive('progressBar', [function () { return { restrict: 'A', template: '' + @@ -24,7 +24,7 @@ total: '=total' }, - link: function (scope, el, attr, ctrl) { + link: function () { } }; diff --git a/js/app/directives/qrreader.js b/js/app/directives/qrreader.js index 824e99a6..8e735880 100644 --- a/js/app/directives/qrreader.js +++ b/js/app/directives/qrreader.js @@ -7,12 +7,11 @@ * @description * # passwordGen */ - angular.module('passmanApp').directive("qrread", ['$parse', '$compile', - function ($parse, $compile) { + angular.module('passmanApp').directive("qrread", ['$parse', + function ($parse) { return { scope: true, link: function (scope, element, attributes) { - var gCtx = null, gCanvas = null, c = 0, stype = 0, gUM = false, webkit = false, moz = false; var invoker = $parse(attributes.onRead); scope.imageData = null; @@ -29,7 +28,7 @@ element.bind("change", function (changeEvent) { var reader = new FileReader(), file = changeEvent.target.files[0]; reader.readAsDataURL(file); - reader.onload = (function (theFile) { + reader.onload = (function () { return function (e) { //gCtx.clearRect(0, 0, gCanvas.width, gCanvas.height); scope.imageData = e.target.result; diff --git a/js/app/directives/tooltip.js b/js/app/directives/tooltip.js index 78c3257f..9aae59dd 100644 --- a/js/app/directives/tooltip.js +++ b/js/app/directives/tooltip.js @@ -7,15 +7,15 @@ * # passwordGen */ angular.module('passmanApp') - .directive('tooltip', ['$window', function ($window) { + .directive('tooltip', [function () { return { restrict: 'A', scope: { tooltip: '=tooltip' }, - link: function (scope, el, attr, ctrl) { - scope.$watch('tooltip', function (newVal, old) { + link: function (scope, el) { + scope.$watch('tooltip', function () { if (scope.tooltip) { jQuery(el).attr('title', scope.tooltip); jQuery(el).tooltip(); diff --git a/js/app/directives/use-theme.js b/js/app/directives/use-theme.js index d981d158..62b0f0d0 100644 --- a/js/app/directives/use-theme.js +++ b/js/app/directives/use-theme.js @@ -7,7 +7,7 @@ * # passwordGen */ angular.module('passmanApp') - .directive('useTheme', ['$window', function ($window) { + .directive('useTheme', [function () { function invertColor (hexTripletColor) { var color = hexTripletColor; @@ -27,7 +27,7 @@ color: '=', negative: '=' }, - link: function (scope, el, attr, ctrl) { + link: function (scope, el) { var _color = jQuery('#header').css('background-color'); var _bg = _color; if (scope.negative) { diff --git a/js/app/services/credentialservice.js b/js/app/services/credentialservice.js index 517b5162..28e09c90 100644 --- a/js/app/services/credentialservice.js +++ b/js/app/services/credentialservice.js @@ -181,7 +181,7 @@ // Save data this.parent.new_credential_cryptogram.skip_revision = true; - service.updateCredential(this.parent.new_credential_cryptogram, true).then((function (data) { + service.updateCredential(this.parent.new_credential_cryptogram, true).then((function () { this.call_progress(new progress_datatype(2, 2, 'credential')); this.call_then({ plain_text: this.parent.plain_credential, @@ -208,7 +208,7 @@ this.call_progress(new progress_datatype(this.current, this.total, 'files')); - FileService.updateFile(fileData, this.parent.new_password).then((function (data) { + FileService.updateFile(fileData, this.parent.new_password).then((function () { this.current++; this.call_progress(new progress_datatype(this.current, this.total, 'files')); if (this.current === this.total) { @@ -246,7 +246,7 @@ this.call_progress(new progress_datatype(this.current + this.upload, this.total, 'revisions')); - service.updateRevision(_revision).then((function (data) { + service.updateRevision(_revision).then((function () { this.upload++; this.call_progress(new progress_datatype(this.upload + this.current, this.total, 'revisions')); if (this.current + this.upload === this.total) { @@ -298,7 +298,7 @@ master_promise.promises++; (new C_Promise(promise_revisions_update, new password_data())).progress(function (data) { master_promise.call_progress(data); - }).then(function (data) { + }).then(function () { console.warn("End revisions update"); master_promise.promises--; if (master_promise.promises === 0) { diff --git a/js/app/services/fileservice.js b/js/app/services/fileservice.js index 655f5442..495869ef 100644 --- a/js/app/services/fileservice.js +++ b/js/app/services/fileservice.js @@ -77,9 +77,6 @@ // doesn't handle URLEncoded DataURIs - see SO answer #6850276 for code that does this byteString = atob(dataURI.split(',')[1]); - // separate out the mime component - mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0]; - // write the bytes of the string to an ArrayBuffer ab = new ArrayBuffer(byteString.length); ia = new Uint8Array(ab); diff --git a/js/app/services/settingsservice.js b/js/app/services/settingsservice.js index b6095c9a..3424c3a7 100644 --- a/js/app/services/settingsservice.js +++ b/js/app/services/settingsservice.js @@ -15,7 +15,7 @@ defaultVault: null, defaultVaultPass: null }; - var neverSend = ['defaultVault', 'defaultVaultPass']; + var cookie = localStorageService.get('settings'); settings = angular.merge(settings, cookie); diff --git a/js/app/services/shareservice.js b/js/app/services/shareservice.js index 268ef34a..7a4fce37 100644 --- a/js/app/services/shareservice.js +++ b/js/app/services/shareservice.js @@ -178,7 +178,7 @@ return _credential; }, - generateRSAKeys: function (key_length, progress, callback) { + generateRSAKeys: function (key_length) { var p = new C_Promise(function () { var state = forge.pki.rsa.createKeyPairGenerationState(key_length, 0x10001); var step = function () { diff --git a/js/app/services/tagservice.js b/js/app/services/tagservice.js index 0d5a4850..9275d606 100644 --- a/js/app/services/tagservice.js +++ b/js/app/services/tagservice.js @@ -27,7 +27,8 @@ } }, removeTag: function (tag) { - + var idx = _tags.indexOf(tag); + _tags.splice(idx, 1); } }; }]); diff --git a/js/importers/import-main.js b/js/importers/import-main.js index 9d7625d4..5f5944bb 100644 --- a/js/importers/import-main.js +++ b/js/importers/import-main.js @@ -3,7 +3,7 @@ if(!window['PassmanImporter']){ var PassmanImporter = {} } -PassmanImporter.parseRow_ = function(row, isHeading) { +PassmanImporter.parseRow_ = function(row) { // Strip leading quote. row = row.trim(); var isQuoted = false; diff --git a/js/importers/importer-clipperz.js b/js/importers/importer-clipperz.js index 1b7666e3..e9194bcc 100644 --- a/js/importers/importer-clipperz.js +++ b/js/importers/importer-clipperz.js @@ -11,7 +11,7 @@ PassmanImporter.clippers = { } }; -PassmanImporter.clippers.readFile = function (file_data, callback) { +PassmanImporter.clippers.readFile = function (file_data) { return new C_Promise(function() { var credential_list = []; var re = /