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