mirror of
https://github.com/nextcloud/passman.git
synced 2024-12-27 01:52:56 +08:00
Merge branch 'vaultSettings'
This commit is contained in:
commit
101f137db5
5 changed files with 11 additions and 7 deletions
|
@ -22,6 +22,7 @@ angular.module('passmanApp')
|
|||
_vault.vaultKey = angular.copy(SettingsService.getSetting('defaultVaultPass'));
|
||||
VaultService.setActiveVault(_vault);
|
||||
$scope.active_vault = _vault;
|
||||
|
||||
//@TODO check if vault exists
|
||||
}
|
||||
|
||||
|
@ -30,7 +31,6 @@ angular.module('passmanApp')
|
|||
|
||||
$scope.show_spinner = true;
|
||||
|
||||
|
||||
var fetchCredentials = function () {
|
||||
VaultService.getVault($scope.active_vault).then(function (vault) {
|
||||
$scope.active_vault = angular.merge($scope.active_vault, vault);
|
||||
|
@ -58,7 +58,7 @@ angular.module('passmanApp')
|
|||
|
||||
if ($scope.active_vault) {
|
||||
$scope.$parent.selectedVault = true;
|
||||
fetchCredentials();
|
||||
fetchCredentials()
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
angular.module('passmanApp')
|
||||
.controller('CredentialEditCtrl', ['$scope', 'VaultService', 'CredentialService', 'SettingsService', '$location', '$routeParams', 'FileService', 'EncryptService', 'TagService', 'NotificationService',
|
||||
function ($scope, VaultService, CredentialService, SettingsService, $location, $routeParams, FileService, EncryptService, TagService, NotificationService) {
|
||||
$scope.active_vault = VaultService.getActiveVault();
|
||||
if (!SettingsService.getSetting('defaultVault') || !SettingsService.getSetting('defaultVaultPass')) {
|
||||
if (!$scope.active_vault) {
|
||||
$location.path('/')
|
||||
|
@ -18,7 +19,6 @@ angular.module('passmanApp')
|
|||
if (SettingsService.getSetting('defaultVault') && SettingsService.getSetting('defaultVaultPass')) {
|
||||
var _vault = angular.copy(SettingsService.getSetting('defaultVault'));
|
||||
VaultService.getVault(_vault).then(function (vault) {
|
||||
vault.vaultKey = SettingsService.getSetting('defaultVaultPass');
|
||||
VaultService.setActiveVault(vault);
|
||||
$scope.active_vault = vault;
|
||||
|
||||
|
@ -61,6 +61,7 @@ angular.module('passmanApp')
|
|||
}];
|
||||
|
||||
|
||||
|
||||
if (!SettingsService.getSetting('defaultVault') || !SettingsService.getSetting('defaultVaultPass')) {
|
||||
if (!$scope.active_vault) {
|
||||
$location.path('/')
|
||||
|
@ -80,7 +81,7 @@ angular.module('passmanApp')
|
|||
var storedCredential = SettingsService.getSetting('edit_credential');
|
||||
|
||||
if (!storedCredential) {
|
||||
CredentialService.getCredential($routeParams.credential_id).then(function (result) {
|
||||
CredentialService.getCredential($routeParams.credential_id).then(function(result){
|
||||
$scope.storedCredential = CredentialService.decryptCredential(angular.copy(result));
|
||||
});
|
||||
} else {
|
||||
|
@ -186,10 +187,10 @@ angular.module('passmanApp')
|
|||
$scope.renewIntervalValue = 0;
|
||||
$scope.renewIntervalModifier = '0';
|
||||
|
||||
$scope.updateInterval = function (renewIntervalValue, renewIntervalModifier) {
|
||||
$scope.updateInterval = function(renewIntervalValue, renewIntervalModifier){
|
||||
var value = parseInt(renewIntervalValue);
|
||||
var modifier = parseInt(renewIntervalModifier);
|
||||
if (value && modifier) {
|
||||
if( value && modifier) {
|
||||
$scope.storedCredential.renew_interval = value * modifier;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -11,6 +11,7 @@ angular.module('passmanApp')
|
|||
.controller('SettingsCtrl', ['$scope', '$rootScope', 'SettingsService', 'VaultService', 'CredentialService', '$location', '$routeParams', '$http', 'EncryptService',
|
||||
function ($scope, $rootScope, SettingsService, VaultService, CredentialService, $location, $routeParams, $http, EncryptService) {
|
||||
$scope.vault_settings = {};
|
||||
$scope.active_vault = VaultService.getActiveVault();
|
||||
if (!SettingsService.getSetting('defaultVault') || !SettingsService.getSetting('defaultVaultPass')) {
|
||||
if (!$scope.active_vault) {
|
||||
$location.path('/')
|
||||
|
|
|
@ -89,6 +89,7 @@ angular.module('passmanApp')
|
|||
var _loginToVault = function (vault, vault_key) {
|
||||
var _vault = angular.copy(vault);
|
||||
_vault.vaultKey = angular.copy(vault_key);
|
||||
delete _vault.credentials;
|
||||
VaultService.setActiveVault(_vault);
|
||||
$location.path('/vault/' + vault.vault_id);
|
||||
};
|
||||
|
@ -98,6 +99,7 @@ angular.module('passmanApp')
|
|||
$scope.error = false;
|
||||
var _vault = angular.copy(vault);
|
||||
_vault.vaultKey = angular.copy(vault_key);
|
||||
|
||||
VaultService.setActiveVault(_vault);
|
||||
VaultService.getVault(vault).then(function (vault) {
|
||||
var credential = vault.credentials[0];
|
||||
|
|
|
@ -26,7 +26,7 @@ angular.module('passmanApp')
|
|||
setActiveVault: function(vault){
|
||||
_activeVault = angular.copy(vault);
|
||||
},
|
||||
getActiveVault: function(vault){
|
||||
getActiveVault: function(){
|
||||
return _activeVault;
|
||||
},
|
||||
getVaultSetting: function(key, default_value){
|
||||
|
|
Loading…
Reference in a new issue