import linecache
print("Welcome to the online safety quiz!")
registereduser = input("Are you a registered user? Enter Y or N: ")
registereduser = registereduser.upper()
if registereduser == "Y":
username = input("What is your school username? ")
stored_username = linecache.getline("{0}.csv".format(username), 4)
print (stored_username)
if username == stored_username:
stored_password = linecache.getline("{0}.csv".format(username), 5)
stored_fullname = linecache.getline("{0}.csv".format(username), 1)
print("Hello {0} ").format(stored_fullname)
password = input("What is your password? ")
import hashlib, uuid
salt = "87e6781077c7420cbc160853b62693f3"
hashed_password = hashlib.sha512(password.encode('utf-8') + salt.encode('utf-8')).hexdigest()
if stored_password == hashed_password:
print("You have logged in successfully")
else:
print("ERROR Your details do not match the one in our database please retry or register again ")
This is the error i get when i run the code. Traceback (most recent call last): File "C:\Users\joel\python", line 25, in if stored_password == hashed_password: NameError: name 'stored_password' is not defined
Please bear in mind i already have data files stored in the same folder which the program retrieves data from...