Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- logins = {
- "admin": "admin",
- "mitchsaad": "mitchpass",
- "jeratan": "zeuszeus",
- "scorpio": "reddragon10",
- "chrissaad": "chrispass",
- "simone": "mybabyisawesome"
- }
- def username_check(user): #Checks if the username exists in the logins dictionary
- check = 0
- for key in logins:
- if user == key:
- check = check + 1
- if check == 1:
- return True
- else:
- return False
- def password_check(user, userpass): #Checks if the username is correct and then checks the password against the value of that username
- if logins.get(user) == userpass:
- return True
- else:
- return False
- def initialize(): #starts the login
- username = str(raw_input("Username: ").lower())
- if len(username) > 0:
- password = str(raw_input("Pasword: ").lower())
- else:
- print "Please enter your username."
- initialize()
- if len(password) > 0:
- ucheck = username_check(username)
- pcheck = password_check(username, password)
- if ucheck == True and pcheck == True:
- print "Login Successful"
- else:
- print "Your Username or Password may be incorrect"
- initialize()
- initialize() #run the login
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement