Python Forum
Creating a Login System Using Python- HELP
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Creating a Login System Using Python- HELP
#1
Hey everyone. I am trying to create a login system for a user in python- this is my code so far(bare in mind i'm basically a beginner so if you could give me some helpful tips that'd be great).

What I struggle to do is:
1) Assuming that the user has already signed up before, how do I get my program to remember their details from last time allowing them to log in?
2) I need some validation help, e.g. whether their password is valid, their age and name etc
I'm sure that there are many other problems, like making my code as efficient as possible. Also, I'm learning about functions and I already know how to do loops although they are not needed here? If anyone can help ASAP or maybe even become my teacher or something, i'd love you forever. Thank you in advance.

users = {"username, ": "password"}

user_choice = raw_input("Do you want to: \n a. Sign in \n b. Sign up?\n c. Quit \n")


if user_choice == "b" or "r":
print("Please enter the following details: \n")
name = raw_input("Name : ")
age = raw_input("Age: ")
yearGroup = raw_input("Year Group: ")
username= name[0:3] + age
if username in users:
print("This username already exists! ")
else:
print("Welcome {} ! Your username is {} - now press enter to create your password").format(name, username)
password = raw_input("Password: ")
password_confirmation = raw_input("Confirm password: ")
users = username + password
if password != password_confirmation:
print("please try again")
else:
print("Sign up complete. \n")
print(users)
user_choice = raw_input("Press 'a' to sign in or 'c' to quit: ")

if user_choice == "a":
print("Press enter to write your details: ")
user_login =raw_input("Username: ")
if user_login not in users:
print("Invalid login. ")
user_choice == raw_input("\nPlease press 'r' to register or 'c' to quit. ")
else:
user_password = raw_input("Password: ")
if user_password in users:
print("\nYou have succesfully logged in!")
else:
print("Incorrect password.")
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Difference between os.system("clear") and os.system("cls") chmsrohit 7 5,266 Jan-11-2021, 06:30 PM
Last Post: ykumar34
  Login and Register system finndude 1 576 Apr-24-2020, 10:05 PM
Last Post: deanhystad
Question Difference between Python's os.system and Perl's system command Agile741 13 1,602 Dec-02-2019, 04:41 PM
Last Post: Agile741
  Login system not working Unknown_Relic 2 629 Nov-05-2019, 12:07 PM
Last Post: buran
  Login System Carbonix 4 1,768 Feb-04-2019, 02:19 PM
Last Post: Larz60+
  Python login system help. calumw20 1 1,646 Mar-06-2018, 08:01 AM
Last Post: buran
  Login a Python Web Crawler on a ASP NET (.aspx) website p4t3x 1 4,030 Dec-01-2017, 11:09 AM
Last Post: hshivaraj
  Login System ItsBlueey 1 25,431 Nov-06-2017, 05:24 PM
Last Post: heiner55
  how to determine the minimum system requirment for the game i am creating? hsunteik 1 1,617 Mar-25-2017, 12:36 PM
Last Post: metulburr

Forum Jump:

User Panel Messages

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