test
This commit is contained in:
parent
5edd9f1041
commit
203dde10ae
16
main.py
16
main.py
@ -50,12 +50,16 @@ GPIO.setmode(GPIO.BCM)
|
||||
greenLed = 14
|
||||
redLed = 4
|
||||
|
||||
bad = False
|
||||
|
||||
# badCredentials = False
|
||||
GPIO.setup(greenLed, GPIO.OUT)
|
||||
GPIO.output(greenLed, GPIO.LOW)
|
||||
GPIO.setup(redLed, GPIO.OUT)
|
||||
GPIO.output(redLed, GPIO.LOW)
|
||||
def badCred():
|
||||
print("Bad credential!")
|
||||
# badCredentials = True
|
||||
# time.sleep(2)
|
||||
class CliInteraction(UserInteraction):
|
||||
def prompt_up(self):
|
||||
print("\nTouch your authenticator device now...\n")
|
||||
@ -67,14 +71,10 @@ class CliInteraction(UserInteraction):
|
||||
print("User Verification required.")
|
||||
return True
|
||||
|
||||
def badCred():
|
||||
print("Bad credential!")
|
||||
bad = True
|
||||
# time.sleep(2)
|
||||
while True:
|
||||
# GPIO.output(14, GPIO.LOW)
|
||||
print("Waiting for device...")
|
||||
bad = False
|
||||
badCredentials = False
|
||||
while True:
|
||||
try:
|
||||
# GPIO.output(14, GPIO.LOW)
|
||||
@ -146,12 +146,14 @@ while True:
|
||||
else:
|
||||
print("No data found for AAGUID:", aaguid)
|
||||
badCred()
|
||||
raise Exception
|
||||
return None
|
||||
|
||||
# Close communication with the database
|
||||
cur.close()
|
||||
except (Exception, psycopg2.DatabaseError) as error:
|
||||
print(error)
|
||||
raise Exception
|
||||
finally:
|
||||
if conn is not None:
|
||||
conn.close()
|
||||
@ -173,7 +175,7 @@ while True:
|
||||
pk_neg3 = aaguid_data["pk_neg3"]
|
||||
pickled = aaguid_data["pickled"]
|
||||
|
||||
if bad:
|
||||
if badCredentials:
|
||||
raise Exception
|
||||
|
||||
credentials = pickle.loads(pickled)
|
||||
|
Loading…
Reference in New Issue
Block a user