Hello,
I have made myself a little log in code but i have an issue,
When the account exists i get the error that the username or password is incorrect, i have looked through my code and just can not understand what i have done.
Here is the code:
I have made myself a little log in code but i have an issue,
When the account exists i get the error that the username or password is incorrect, i have looked through my code and just can not understand what i have done.
Here is the code:
def loginReg(): welcome = input("Do you have an acount? y/n:\n>> ") if welcome == "n": while True: username = input("Enter a username:\n>> ") password = input("Enter a password:\n>> ") password1 = input("Confirm password:\n>> ") try: if username in open(username+".txt").read(): print ("Error: Username already exists") loginReg() except OSError as e: if password == password1: file = open(username+".txt", "w") file.write(username+":"+password) file.close() welcome = "y" break print("Passwords do NOT match!") loginReg()