don't show passwords

This commit is contained in:
Antonio J. Delgado 2024-11-11 23:23:50 +02:00
parent 9a9be54689
commit f935afd1c2

View file

@ -662,8 +662,9 @@ class NextcloudHandler:
def exists_password(self, obj):
'''Test if a password exist with the same name'''
safer_obj = dict(obj, **{ 'password': '***' })
self.debug(
{ "action": "check_exists_password", "object": obj }
{ "action": "check_exists_password", "object": safer_obj }
)
all_passwords = self.list_passwords()
if all_passwords:
@ -799,13 +800,15 @@ class NextcloudHandler:
def is_same_password(self, obj1, obj2):
'''Test if two password objects are the same or similar'''
if obj1 == obj2:
safer_obj1 = dict(obj1, **{ 'password': '***' })
safer_obj2 = dict(obj2, **{ 'password': '***' })
self.debug(
{"action": "notify_exact_match", "object": { "obj1": obj1, "obj2": obj2 } }
{"action": "notify_exact_match", "object": { "obj1": safer_obj1, "obj2": safer_obj2 } }
)
return True
if obj1['label'] == obj2['label']:
self.debug(
{ "action": "notify_name_match", "object": { "obj1": obj1, "obj2": obj2 } }
{ "action": "notify_name_match", "object": { "obj1": safer_obj1, "obj2": safer_obj2 } }
)
if (
self.is_same_key('username', obj1, obj2) and
@ -814,7 +817,7 @@ class NextcloudHandler:
self.is_same_key('folder', obj1, obj2)
):
self.debug(
{ "action": "notify_match", "object": { "obj1": obj1, "obj2": obj2 } }
{ "action": "notify_match", "object": { "obj1": safer_obj1, "obj2": safer_obj2 } }
)
return True
return False
@ -897,8 +900,9 @@ class NcPasswordClient:
def create_password(self, obj):
'''Create a password with an object'''
safer_obj = dict(obj, **{ 'password': '***' })
self.debug(
{ "action": "create_password", "object": obj }
{ "action": "create_password", "object": safer_obj }
)
self.debug(
{
@ -911,8 +915,9 @@ class NcPasswordClient:
'''Delete a password'''
for password in self.nc.list_passwords():
if password['label'] == name:
safer_obj = dict(password, **{ 'password': '***' })
self.debug(
{ "action": "delete_password", "object": password }
{ "action": "delete_password", "object": safer_obj }
)
self.debug(
{ "action": "deleted_password", "object": self.nc.delete_password(password)}
@ -980,8 +985,9 @@ class NcPasswordClient:
)
return False
for item in self.nc.list_passwords():
safer_obj = dict(item, **{ 'password': '***' })
self.debug(
{ "action": "delete_all_passwords", "message": "Deleting password", "object": item }
{ "action": "delete_all_passwords", "message": "Deleting password", "object": safer_obj }
)
self.nc.delete_password(item)