add more debug
This commit is contained in:
parent
c502773ab9
commit
7c1fb5c9c8
1 changed files with 40 additions and 12 deletions
|
@ -16,7 +16,6 @@ import sys
|
|||
import os
|
||||
import time
|
||||
import logging
|
||||
from logging.handlers import SysLogHandler
|
||||
from xml.dom import minidom
|
||||
import binascii
|
||||
import click
|
||||
|
@ -659,7 +658,23 @@ class NextcloudHandler:
|
|||
if all_passwords:
|
||||
for password in all_passwords:
|
||||
if self.is_same_password(obj, password):
|
||||
safer_password = dict(password, **{ 'password': '***' })
|
||||
self._log.debug(
|
||||
{
|
||||
"action": "test_exists_password",
|
||||
"message": "Same password already exists",
|
||||
"object": safer_obj,
|
||||
"existing_password": safer_password
|
||||
}
|
||||
)
|
||||
return True
|
||||
self._log.debug(
|
||||
{
|
||||
"action": "test_exists_password",
|
||||
"message": "No password match found",
|
||||
"object": safer_obj
|
||||
}
|
||||
)
|
||||
return False
|
||||
|
||||
def create_password(self, post_obj):
|
||||
|
@ -804,16 +819,16 @@ class NextcloudHandler:
|
|||
}
|
||||
)
|
||||
return True
|
||||
if obj1['label'] == obj2['label']:
|
||||
self.debug(
|
||||
{
|
||||
"action": "notify_name_match",
|
||||
"object": {
|
||||
"obj1": safer_obj1,
|
||||
"obj2": safer_obj2
|
||||
}
|
||||
}
|
||||
)
|
||||
# if obj1['label'] == obj2['label']:
|
||||
# self.debug(
|
||||
# {
|
||||
# "action": "notify_name_match",
|
||||
# "object": {
|
||||
# "obj1": safer_obj1,
|
||||
# "obj2": safer_obj2
|
||||
# }
|
||||
# }
|
||||
# )
|
||||
if (
|
||||
self.is_same_key('username', obj1, obj2) and
|
||||
self.is_same_key('password', obj1, obj2) and
|
||||
|
@ -960,6 +975,7 @@ class NcPasswordClient:
|
|||
obj['password'] = raw_values[0]
|
||||
raw_values.pop(0)
|
||||
for line in raw_values:
|
||||
custom_fields = {}
|
||||
if ': ' in line:
|
||||
split_line = line.split(': ')
|
||||
field = split_line[0]
|
||||
|
@ -967,10 +983,22 @@ class NcPasswordClient:
|
|||
else:
|
||||
field = line
|
||||
value = ''
|
||||
if field != '' and value != '':
|
||||
if value != '':
|
||||
if field == '':
|
||||
field = 'notes'
|
||||
if field == 'login':
|
||||
field = 'username'
|
||||
if field == 'uri':
|
||||
field = 'url'
|
||||
if field not in custom_fields:
|
||||
custom_fields[field] = value
|
||||
else:
|
||||
if isinstance(custom_fields[field], str):
|
||||
custom_fields[field] = [ custom_fields[field], value]
|
||||
else:
|
||||
custom_fields[field].append(value)
|
||||
obj[field] = value
|
||||
obj['customFields'] = json.dumps(custom_fields)
|
||||
new_password = self.nc.create_password(obj)
|
||||
if new_password:
|
||||
self.debug(
|
||||
|
|
Loading…
Reference in a new issue