Skip to content

Instantly share code, notes, and snippets.

@kenbellows
Created January 20, 2016 12:42
Show Gist options
  • Save kenbellows/c0f7d4f444e9aa359388 to your computer and use it in GitHub Desktop.
Save kenbellows/c0f7d4f444e9aa359388 to your computer and use it in GitHub Desktop.
def login():
print('Welcome to the eHealth program, please sign in')
with open ('users.csv') as csvfile:
database = csv.DictReader(csvfile)
loggedin = False
while loggedin != True:
Username = input('Fill in your username: ')
Password = input('Fill in your password: ')
for row in database:
Username_File = row['username']
Password_File = row['password']
Function_File = row['function']
if Username_File == Username and Password_File == Password and Function_File == 'patient':
loggedin = True
print('Succesfully logged in as a patient.')
#patientmenu() # we will add this later on
elif Username_File == Username and Password_File == Password and Function_File == 'arts':
loggedin = True
print('Succesfully logged in as a doctor.')
#artsmenu() # we will add this later on
elif Username_File != Username and Password_File == Password:
#loggedin = False
print('Failed to sign in, wrong username.')
elif Username_File == Username and Password_File != Password:
#loggedin = False
print('Failed to sign in, wrong password.')
elif Username_File != Username and Password_File != Password:
#loggedin = False
print('Failed to sign in, wrong username and password.')
else:
print('Error 404, Login Not Found')
# ---- Main ---- #
login()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment