mirror of
https://github.com/nextcloud/passman.git
synced 2025-09-16 09:55:00 +08:00
Partialfix for #486 THIS DOES NOT CLOSE IT! v2
This commit is contained in:
parent
ea01990672
commit
7694c291b7
1 changed files with 20 additions and 8 deletions
|
@ -32,8 +32,8 @@
|
|||
* Controller of the passmanApp
|
||||
*/
|
||||
angular.module('passmanApp')
|
||||
.controller('CredentialEditCtrl', ['$scope', 'VaultService', 'CredentialService', 'SettingsService', '$location', '$routeParams', 'FileService', 'EncryptService', 'TagService', 'NotificationService', 'ShareService', '$translate',
|
||||
function ($scope, VaultService, CredentialService, SettingsService, $location, $routeParams, FileService, EncryptService, TagService, NotificationService, ShareService, $translate) {
|
||||
.controller('CredentialEditCtrl', ['$scope', 'VaultService', 'CredentialService', 'SettingsService', '$location', '$routeParams', 'FileService', 'EncryptService', 'TagService', 'NotificationService', 'ShareService', '$translate', '$rootScope',
|
||||
function ($scope, VaultService, CredentialService, SettingsService, $location, $routeParams, FileService, EncryptService, TagService, NotificationService, ShareService, $translate, $rootScope) {
|
||||
$scope.active_vault = VaultService.getActiveVault();
|
||||
if (!SettingsService.getSetting('defaultVault') || !SettingsService.getSetting('defaultVaultPass')) {
|
||||
if (!$scope.active_vault) {
|
||||
|
@ -292,7 +292,7 @@
|
|||
};
|
||||
$scope.saving = false;
|
||||
$scope.saveCredential = function () {
|
||||
$scope.saving = true;
|
||||
$scope.saving = true;
|
||||
|
||||
|
||||
if ($scope.new_custom_field.label && $scope.new_custom_field.value) {
|
||||
|
@ -301,8 +301,8 @@
|
|||
|
||||
|
||||
if ($scope.storedCredential.password !== $scope.storedCredential.password_repeat){
|
||||
$scope.saving = false;
|
||||
NotificationService.showNotification($translate.instant('password.do.not.match'), 5000);
|
||||
$scope.saving = false;
|
||||
NotificationService.showNotification($translate.instant('password.do.not.match'), 5000);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -313,7 +313,7 @@
|
|||
if (!$scope.storedCredential.credential_id) {
|
||||
$scope.storedCredential.vault_id = $scope.active_vault.vault_id;
|
||||
CredentialService.createCredential($scope.storedCredential).then(function () {
|
||||
$scope.saving = false;
|
||||
$scope.saving = false;
|
||||
$location.path('/vault/' + $routeParams.vault_id);
|
||||
NotificationService.showNotification($translate.instant('credential.created'), 5000);
|
||||
|
||||
|
@ -345,14 +345,26 @@
|
|||
_credential.description = _credential.description.replace(regex, "");
|
||||
}
|
||||
CredentialService.updateCredential(_credential, _useKey).then(function () {
|
||||
$scope.saving = false;
|
||||
$scope.saving = false;
|
||||
SettingsService.setSetting('edit_credential', null);
|
||||
$location.path('/vault/' + $routeParams.vault_id);
|
||||
NotificationService.showNotification($translate.instant('credential.updated'), 5000);
|
||||
});
|
||||
}
|
||||
$scope.refreshListWithSaved();
|
||||
};
|
||||
|
||||
};
|
||||
$scope.refreshListWithSaved = function () {
|
||||
var current_vault = $rootScope.vaultCache[$scope.active_vault.guid];
|
||||
var cv_credentials = current_vault.credentials;
|
||||
for (var i = 0; i < cv_credentials.length; i++) {
|
||||
if (cv_credentials[i].credential_id === $scope.storedCredential.credential_id) {
|
||||
cv_credentials[i] = $scope.storedCredential;
|
||||
}
|
||||
}
|
||||
current_vault.credentials=cv_credentials;
|
||||
$rootScope.vaultCache[$scope.active_vault.guid] = current_vault;
|
||||
};
|
||||
|
||||
$scope.cancel = function () {
|
||||
$location.path('/vault/' + $routeParams.vault_id);
|
||||
|
|
Loading…
Add table
Reference in a new issue