reuse password after checking for existence
This commit is contained in:
parent
0d195a0408
commit
286b3e7edd
1 changed files with 13 additions and 14 deletions
|
@ -704,7 +704,7 @@ class NextcloudHandler:
|
|||
'''Test if a passwords folder exists'''
|
||||
for folder in self.list_passwords_folders():
|
||||
if folder.get('label') == name:
|
||||
return True
|
||||
return folder
|
||||
return False
|
||||
|
||||
def create_passwords_folder(self, name):
|
||||
|
@ -799,7 +799,7 @@ class NextcloudHandler:
|
|||
"existing_password": safer_password
|
||||
}
|
||||
)
|
||||
return True
|
||||
return password
|
||||
self.debug(
|
||||
{
|
||||
"action": "test_exists_password",
|
||||
|
@ -823,7 +823,8 @@ class NextcloudHandler:
|
|||
if not 'url' in post_obj:
|
||||
post_obj['url'] = ''
|
||||
safer_obj = dict(post_obj, **{ 'password': '***' })
|
||||
if not self.exists_password(post_obj):
|
||||
exists_password = self.exists_password(post_obj)
|
||||
if not exists_password:
|
||||
try:
|
||||
self.debug(
|
||||
{ "action": "create_password", "object": safer_obj }
|
||||
|
@ -861,10 +862,8 @@ class NextcloudHandler:
|
|||
)
|
||||
else:
|
||||
if update:
|
||||
existing_password = self.get_password(post_obj['label'], details=True)
|
||||
post_obj['id'] = existing_password[0]['id']
|
||||
post_obj['id'] = exists_password['id']
|
||||
return self.update_password(post_obj)
|
||||
else:
|
||||
self.warning(
|
||||
{
|
||||
"action": "create_password",
|
||||
|
|
Loading…
Reference in a new issue