Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Login System
#1
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:
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()
Reply


Messages In This Thread
Login System - by Carbonix - Jan-28-2019, 10:29 AM
RE: Login System - by Larz60+ - Jan-28-2019, 11:22 AM
RE: Login System - by Carbonix - Jan-31-2019, 08:40 AM
RE: Login System - by Larz60+ - Feb-04-2019, 02:19 PM
Login System - by Carbonix - Feb-04-2019, 08:33 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  in a login interface when i try login with a user supposed to say test123 but nothing NullAdmin 3 2,273 Feb-20-2021, 04:43 AM
Last Post: bowlofred
  Difference between os.system("clear") and os.system("cls") chmsrohit 7 16,630 Jan-11-2021, 06:30 PM
Last Post: ykumar34
  Login and Register system finndude 1 2,396 Apr-24-2020, 10:05 PM
Last Post: deanhystad
Question Difference between Python's os.system and Perl's system command Agile741 13 6,824 Dec-02-2019, 04:41 PM
Last Post: Agile741
  Login system not working Unknown_Relic 2 2,277 Nov-05-2019, 12:07 PM
Last Post: buran
  Python login system help. calumw20 1 3,693 Mar-06-2018, 08:01 AM
Last Post: buran
  Creating a Login System Using Python- HELP tesilstudent112 0 9,557 Dec-08-2017, 07:17 PM
Last Post: tesilstudent112
  Login System ItsBlueey 1 37,103 Nov-06-2017, 05:24 PM
Last Post: heiner55

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020