Compare commits

..

No commits in common. "ca1de7f82dd55e0c2c95d643038abf5aa065e2d8" and "7ec0ba251dcc9cdda826f76784eaa6ff0b6339a7" have entirely different histories.

2 changed files with 8 additions and 14 deletions

View File

@ -28,7 +28,7 @@ def create_super_admins(app, user_datastore):
# afterwards
admin_data = admin_file.read_text().split('\n')
for i, line in enumerate(admin_data):
if len(line.strip()) > 0 and not line.strip().startswith('#'):
if not line.strip().startswith('#'):
try:
user, email, pw = line.split()
validate_email(email)
@ -80,8 +80,6 @@ def create_app():
)
app.config.from_envvar('APPLICATION_SETTINGS')
logging.basicConfig(filename=app.config['LOG_FILE'], level=logging.INFO)
token_file = Path(app.config.get('TOKEN_FILE'))
if not token_file.exists():
app.logger.warning(

View File

@ -30,7 +30,7 @@ class DoorHandle:
self.nfc_sock.connect(nfc_socket)
self.logger.info(f"Connected to NFC socket at {nfc_socket}.")
except Exception as e:
self.logger.error(f"Could not connect to NFC socket at {nfc_socket}. "
print(f"Could not connect to NFC socket at {nfc_socket}. "
f"Exception: {e}")
self.nfc_sock = None
#raise
@ -77,13 +77,11 @@ class DoorHandle:
email = data[3].strip() if len(data) > 3 else None
valid_thru = data[4].strip() if len(data) > 4 else None
tokens[token] = {
'name': name,
tokens[token] = {'name': name,
'organization': organization,
'email': email,
'valid_thru': valid_thru,
'inactive': inactive
}
'inactive': inactive}
return tokens
def store_tokens(self, tokens):
@ -107,14 +105,12 @@ class DoorHandle:
if self.nfc_sock is not None:
self.nfc_sock.send(b'open ' + user.encode() + b'\n')
else:
self.logger.error("No connection to NFC socket. Cannot open door!")
raise RuntimeError("No connection to NFC socket. Cannot open door!")
raise RuntimeError("No connection to NFC socket. Cannot close door!")
def close_door(self, user=''):
if self.nfc_sock is not None:
self.nfc_sock.send(b'close ' + user.encode() + b'\n')
else:
self.logger.error("No connection to NFC socket. Cannot close door!")
raise RuntimeError("No connection to NFC socket. Cannot close door!")
def get_most_recent_token(self):