I'm making a program that asks the user to login, and I'm wondering how I can make it so it checks if an instance of my Username class exists. Oh and please excuse my sloppy and disorganized coding, I'm not very good at it.
quit_login = 1
class Usernames:
def __init__(self, password):
self.password = password
testlogin = Usernames("foo")
def login_e():
a = raw_input("Please enter a username: ")
new_pass = ""
if isinstance(a, Usernames):
a = Usernames(new_pass)
print Usernames
else:
login_pass = raw_input("What is your password?\n")
if login_pass == a.password:
print "Hello", a
else:
print "Incorrect password"
while quit_login != 0:
login_e()