add pw reset debug message; changed watchdog 'created' to 'modified'

Added an extra debugging message to tell the file being read for a
password reset, and changed watchdog form using 'created' events to
'modified', otherwise there may be issues where the file is read before
it is fully written.
This commit is contained in:
Harvey Tindall 2020-04-16 13:56:27 +01:00
parent 60cd54f436
commit e6eda227fa
1 changed files with 2 additions and 1 deletions

View File

@ -166,8 +166,9 @@ class Handler(FileSystemEventHandler):
def on_any_event(event):
if event.is_directory:
return None
elif (event.event_type == 'created' and
elif (event.event_type == 'modified' and
'passwordreset' in event.src_path):
log.debug(f'Password reset file: {event.src_path}')
with open(event.src_path, 'r') as f:
reset = json.load(f)
log.info(f'New password reset for {reset["UserName"]}')