Added encryptíon to folderpath

Signed-off-by: fnuesse <felix.nuesse@t-online.de>
This commit is contained in:
fnuesse 2018-12-30 22:58:55 +01:00
parent b6103785b3
commit c948506887
No known key found for this signature in database
GPG key ID: 2089A3431243E819
2 changed files with 23 additions and 20 deletions

View file

@ -70,30 +70,15 @@
for (var i = 0; i < _credentials.length; i++) {
var _credential = _credentials[i];
if(_credential.folderpath === null){
_credential.folderpath='/';
}
if(_credential.folderpath.startsWith($scope.currentFolder)){
if($scope.FolderList.indexOf(_credential.folderpath) <= -1){
$scope.FolderList.push(_credential.folderpath);
}
}else{
_credential.folderpath="/";
}
try {
if (!_credential.shared_key) {
_credential = CredentialService.decryptCredential(angular.copy(_credential));
} else {
var enc_key = EncryptService.decryptString(_credential.shared_key);
_credential = ShareService.decryptSharedCredential(angular.copy(_credential), enc_key);
}
_credential.tags_raw = _credential.tags;
} catch (e) {
NotificationService.showNotification($translate.instant('error.decrypt'), 5000);
//$rootScope.$broadcast('logout');
//SettingsService.setSetting('defaultVaultPass', null);
@ -101,6 +86,19 @@
//$location.path('/')
}
if(_credential.folderpath !== null){
if(_credential.folderpath.startsWith($scope.currentFolder)){
if($scope.FolderList.indexOf(_credential.folderpath) <= -1){
$scope.FolderList.push(_credential.folderpath);
}
}else{
_credential.folderpath="/";
}
}else{
_credential.folderpath="/";
}
_credentials[i] = _credential;
}

View file

@ -55,9 +55,10 @@
'files': [],
'custom_fields': [],
'otp': {},
'hidden': false
'hidden': false,
'folderpath': [],
};
var _encryptedFields = ['description', 'username', 'password', 'files', 'custom_fields', 'otp', 'email', 'tags', 'url'];
var _encryptedFields = ['description', 'username', 'password', 'files', 'custom_fields', 'otp', 'email', 'tags', 'url', 'folderpath'];
return {
@ -140,7 +141,13 @@
var fieldValue = angular.copy(credential[field]);
var field_decrypted_value;
try {
field_decrypted_value = EncryptService.decryptString(fieldValue, key);
if(fieldValue!==null){
field_decrypted_value = EncryptService.decryptString(fieldValue, key);
}else{
field_decrypted_value="";
}
//field_decrypted_value = EncryptService.decryptString(fieldValue, key);
} catch (e) {
throw e;
}
@ -148,9 +155,7 @@
credential[field] = JSON.parse(field_decrypted_value);
} catch (e) {
console.warn('Field' + field + ' in ' + credential.label + ' could not be parsed! Value:' + fieldValue);
}
}
return credential;
},