Fixed naming error
This commit is contained in:
parent
9e8e03ac25
commit
685aaf0bdd
12
validate.py
12
validate.py
|
@ -67,22 +67,22 @@ def read_loop():
|
||||||
# Begin the loop
|
# Begin the loop
|
||||||
while True:
|
while True:
|
||||||
# Read in the ID
|
# Read in the ID
|
||||||
scanned_id = socket.recv()
|
code = socket.recv()
|
||||||
# Determine ID authorization
|
# Determine ID authorization
|
||||||
authorized = id in access and "authorized" in access[id] and access[id]["authorized"]
|
authorized = code in access and "authorized" in access[code] and access[code]["authorized"]
|
||||||
user = access[id]["user"] if id in access and "user" in access[id] else "unknown id"
|
user = access[code]["user"] if code in access and "user" in access[code] else "unknown barcode"
|
||||||
# If the user is not authorized, deny access
|
# If the user is not authorized, deny access
|
||||||
if not authorized:
|
if not authorized:
|
||||||
s = timestamped("Denied {} ({})\n".format(id, user))
|
s = timestamped("Denied {} ({})\n".format(code, user))
|
||||||
log_file.write(s)
|
log_file.write(s)
|
||||||
print s,
|
print s,
|
||||||
# If the user is authorized, perform the unlock procedure
|
# If the user is authorized, perform the unlock procedure
|
||||||
else:
|
else:
|
||||||
s = timestamped("Validated {} {}\n".format(id, user))
|
s = timestamped("Validated {} {}\n".format(code, user))
|
||||||
log_file.write(s)
|
log_file.write(s)
|
||||||
print s,
|
print s,
|
||||||
# TODO: Play open tone
|
# TODO: Play open tone
|
||||||
if "sound" in access[id]:
|
if "sound" in access[code]:
|
||||||
pass
|
pass
|
||||||
# Run unlock procedure
|
# Run unlock procedure
|
||||||
unlock_door(pwm_pin)
|
unlock_door(pwm_pin)
|
||||||
|
|
Loading…
Reference in New Issue