Remove payment info again

main
Valentin Ochs 2023-01-09 20:49:51 +01:00
parent 000b481745
commit d9bfc66ac7
1 changed files with 3 additions and 8 deletions

View File

@ -37,9 +37,9 @@ class DoorControlNfc(util.Loggable):
lines =[ s.strip() for s in open(self._config.valid_tokens, "r").readlines() ]
for i, line in enumerate(lines):
l = [s.strip() for s in line.split('|')]
if len(l) == 6:
if len(l) == 5:
if not l[0].strip().startswith('#'):
token, name, organization, email, valid_thru, paid = l
token, name, organization, email, valid_thru = l
try:
if len(valid_thru.strip()) > 0:
valid_thru = datetime.date.fromisoformat(valid_thru)
@ -56,10 +56,9 @@ class DoorControlNfc(util.Loggable):
'organization': organization,
'email': email,
'valid_thru': valid_thru,
'paid': paid.strip().lower() == 'yes'
}
else:
self._logger().warning(f"Skipping line {i} ({line}) since it does not contain exactly 6 data field")
self._logger().warning(f"Skipping line {i} ({line}) since it does not contain exactly 5 data field")
except Exception as e:
valid = {}
self._logger().error(f"Error reading token file. Exception: {e}")
@ -105,10 +104,6 @@ class DoorControlNfc(util.Loggable):
authorized = datetime.date.today() <= data['valid_thru']
if not authorized:
self._logger().info(f"Expired token: {token} of {data['name']}")
elif not data['paid']:
authorized = datetime.date.today() <= datetime.date(2023, 3, 1)
if not authorized:
self._logger().info(f"Unpaid token: {token} of {data['name']}")
else:
authorized = True