Change vault password, minor fixes

This commit is contained in:
brantje 2016-10-07 15:38:23 +02:00
parent e8df9295ed
commit ca590057b5
No known key found for this signature in database
GPG key ID: 5FF1D117F918687F
9 changed files with 76 additions and 12 deletions

View file

@ -509,6 +509,9 @@
padding-left: 0px;
padding-right: 15px; }
.error {
color: #ce3702; }
.import_log {
max-height: 600px;
overflow-y: auto; }

File diff suppressed because one or more lines are too long

View file

@ -176,28 +176,28 @@ angular.module('passmanApp')
var new_credential = CredentialService.newCredential();
var enc_c = CredentialService.encryptCredential(new_credential);
SettingsService.setSetting('edit_credential', enc_c);
$location.path('/vault/' + $scope.active_vault.vault_id + '/new')
$location.path('/vault/' + $scope.active_vault.guid + '/new')
};
$scope.editCredential = function (credential) {
var _credential = angular.copy(credential);
$rootScope.$emit('app_menu', false);
SettingsService.setSetting('edit_credential', CredentialService.encryptCredential(_credential));
$location.path('/vault/' + $scope.active_vault.vault_id + '/edit/' + _credential.guid)
$location.path('/vault/' + $scope.active_vault.guid + '/edit/' + _credential.guid)
};
$scope.getRevisions = function (credential) {
var _credential = angular.copy(credential);
$rootScope.$emit('app_menu', false);
SettingsService.setSetting('revision_credential', CredentialService.encryptCredential(_credential));
$location.path('/vault/' + $scope.active_vault.vault_id + '/' + _credential.guid + '/revisions')
$location.path('/vault/' + $scope.active_vault.guid + '/' + _credential.guid + '/revisions')
};
$scope.shareCredential = function (credential) {
var _credential = angular.copy(credential);
$rootScope.$emit('app_menu', false);
SettingsService.setSetting('share_credential', CredentialService.encryptCredential(_credential));
$location.path('/vault/' + $scope.active_vault.vault_id + '/' + _credential.guid + '/share')
$location.path('/vault/' + $scope.active_vault.guid + '/' + _credential.guid + '/share')
};
var notification;

View file

@ -10,10 +10,10 @@
angular.module('passmanApp')
.controller('RevisionCtrl', ['$scope', 'SettingsService', 'VaultService', 'CredentialService', '$location', '$routeParams', '$rootScope', 'NotificationService', '$filter', 'ShareService','EncryptService',
function ($scope, SettingsService, VaultService, CredentialService, $location, $routeParams, $rootScope, NotificationService, $filter, ShareService, EncryptService) {
$scope.active_vault = VaultService.getActiveVault();
if (!SettingsService.getSetting('defaultVault') || !SettingsService.getSetting('defaultVaultPass')) {
if (!$scope.active_vault) {
// $location.path('/')
$location.path('/')
}
} else {
if (SettingsService.getSetting('defaultVault') && SettingsService.getSetting('defaultVaultPass')) {

View file

@ -148,6 +148,55 @@ angular.module('passmanApp')
});
};
$scope.changeVaultPassword = function (oldVaultPass,newVaultPass,newVaultPass2) {
if(oldVaultPass != VaultService.getActiveVault().vaultKey){
$scope.error ='Your old password is incorrect!'
return;
}
if(newVaultPass != newVaultPass2){
$scope.error ='New passwords do not match!';
return;
}
VaultService.getVault($scope.active_vault).then(function (vault) {
var _selected_credentials = [];
for(var i =0; i < vault.credentials.length; i++){
var _credential = vault.credentials[i];
if(_credential.shared_key == null || _credential.shared_key == ''){
t = CredentialService.decryptCredential(_credential, oldVaultPass);
_selected_credentials.push(_credential);
}
}
$scope.change_pw = {
percent: 0,
done: 0,
total: _selected_credentials.length
};
var changeCredential = function(index, oldVaultPass, newVaultPass){
CredentialService.reencryptCredential(_selected_credentials[index].guid, oldVaultPass, newVaultPass).progress(function(data){
console.log(data);
}).then(function(data){
var percent = index / _selected_credentials.length * 100;
$scope.change_pw = {
percent: percent,
done: index+1,
total: _selected_credentials.length
};
if(index < _selected_credentials.length -1){
changeCredential(index+1, oldVaultPass, newVaultPass);
} else {
console.log('Update complete!');
var vault = VaultService.getActiveVault();
vault.vaultKey = newVaultPass;
VaultService.setActiveVault(vault);
}
});
};
changeCredential(0, VaultService.getActiveVault().vaultKey, newVaultPass);
})
};
$scope.cancel = function () {
$location.path('/vault/' + $routeParams.vault_id);
};

View file

@ -51,7 +51,7 @@ angular.module('views/partials/forms/settings/export.html', []).run(['$templateC
angular.module('views/partials/forms/settings/general_settings.html', []).run(['$templateCache', function($templateCache) {
'use strict';
$templateCache.put('views/partials/forms/settings/general_settings.html',
'<div class="row"><div class="col-xs-12 col-md-6"><h3>Rename vault</h3><label>New vault name</label><input type="text" ng-model="$parent.new_vault_name"> <button ng-click="saveVaultSettings()" tooltip="\'Not working :P\'">Change</button><h3>Change vault key</h3><label>Old vault password</label><input type="password" ng-model="oldVaultPass"><label>New vault password</label><password-gen ng-model="newVaultPass"></password-gen><ng-password-meter password="newVaultPass"></ng-password-meter><label>New vault password</label><input type="password" ng-model="newVaultPass2"> <button ng-click="changeVaultPassword(oldVaultPass,newVaultPass,newVaultPass2)" tooltip="\'Not working :P\'">Change</button></div><div class="col-xs-12 col-md-6"><h3>About passman</h3><p>Version: <b>{{passman_version}}</b><br>Bla bla about passman, changelog.<br><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=6YS8F97PETVU2" target="_blank" class="link">Donate to support development</a><br></p><h3>Bookmarklet</h3><div><p>Save your passwords with 1 click!<br>Drag below button to your bookmark toolbar.<br></p></div><div><p ng-bind-html="bookmarklet" style="margin-top: 5px"></p></div></div></div>');
'<div class="row"><div class="col-xs-12 col-md-6"><h3>Rename vault</h3><label>New vault name</label><input type="text" ng-model="$parent.new_vault_name"> <button ng-click="saveVaultSettings()">Change</button><h3>Change vault key</h3><label>Old vault password</label><input type="password" ng-model="oldVaultPass"><label>New vault password</label><password-gen ng-model="newVaultPass"></password-gen><ng-password-meter password="newVaultPass"></ng-password-meter><label>New vault password</label><input type="password" ng-model="newVaultPass2"><div ng-show="error" class="error"><ul><li>{{error}}</li></ul></div><button ng-click="changeVaultPassword(oldVaultPass,newVaultPass,newVaultPass2)">Change</button><div ng-show="change_pw.total > 0">Please wait you vault is being updated, do not leave this page.<br><div progress-bar="change_pw.percent" index="change_pw.done" total="change_pw.total"></div></div></div><div class="col-xs-12 col-md-6"><h3>About passman</h3><p>Version: <b>{{passman_version}}</b><br>Bla bla about passman, changelog.<br><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=6YS8F97PETVU2" target="_blank" class="link">Donate to support development</a><br></p><h3>Bookmarklet</h3><div><p>Save your passwords with 1 click!<br>Drag below button to your bookmark toolbar.<br></p></div><div><p ng-bind-html="bookmarklet" style="margin-top: 5px"></p></div></div></div>');
}]);
angular.module('views/partials/forms/settings/import.html', []).run(['$templateCache', function($templateCache) {

View file

@ -5,7 +5,9 @@
padding-right: 15px;
}
}
.error{
color: #ce3702;
}
.import_log {
max-height: 600px;
overflow-y: auto;

View file

@ -129,7 +129,7 @@ style('passman', 'app');
<div id="app-settings-content" ng-show="settingsShown">
<!-- Your settings in here -->
<div class="settings-container">
<div><a class="link" ng-href="#/vault/{{active_vault.vault_id}}/settings">Settings</a></div>
<div><a class="link" ng-href="#/vault/{{active_vault.guid}}/settings">Settings</a></div>
<div><span class="link" ng-click="logout()">Logout</span></div>
<div><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=6YS8F97PETVU2" target="_blank" class="link">Donate</a></div>
</div>

View file

@ -3,7 +3,7 @@
<h3>Rename vault</h3>
<label>New vault name</label>
<input type="text" ng-model="$parent.new_vault_name">
<button ng-click="saveVaultSettings()" tooltip="'Not working :P'">
<button ng-click="saveVaultSettings()">
Change
</button>
@ -17,9 +17,19 @@
<ng-password-meter password="newVaultPass"></ng-password-meter>
<label>New vault password</label>
<input type="password" ng-model="newVaultPass2">
<div ng-show="error" class="error">
<ul>
<li>{{error}}</li>
</ul>
</div>
<button ng-click="changeVaultPassword(oldVaultPass,newVaultPass,newVaultPass2)"
tooltip="'Not working :P'">Change
>Change
</button>
<div ng-show="change_pw.total > 0">
Please wait you vault is being updated, do not leave this page.<br />
<div progress-bar="change_pw.percent" index="change_pw.done" total="change_pw.total"></div>
</div>
</div>
<div class="col-xs-12 col-md-6">
<h3>About passman</h3>