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