Skip to main content

Sign In and Sign Up with Python (Back-End)

Sign up to the awesomeness of this cool project and get yourself started!


Let's begin!

The script is for developing a program through which we can get user register. We can also create any user admin with a hidden command or "cheat code".

As usual a regular user can see it's own information while an admin can see every on of them!

It's basic and many other cool stuffs can be added in it!

So, sit back and relax and let your creativity take over and create something amazing!

Happy Programming!

def password_check(a, u): # function to check password guidelines
if len(a) < 7:
print("Password should be more than 8 digits")
elif u in a:
print("password should not contain username")
else:
print("Strong Password")
def user_access(a, x, y): # function for user options
a = a.lower()
if a == "yes":
print("Your Data")
print(x)
print(y)
def admin(a, detail): # function for admin access
a = a.lower()
if a == "admin": # to access this function more like a cheat code
print("You have admin access ")
for i in detail:
i = i.split("_")
# Before '_' will be username
print("Username: " + i[0])
# After '_' will be password
print("Password: " + i[1])
register = [] # List to save username and function
operation = 3 # Initialise the loop
while operation != "0": # Termination condition i.e. 0 in our case
operation = input("To login enter 1\nTo register enter 2\nEnter 0 to Exit\n")
if operation == '1': # For Login
username = input("Enter username: ")
password = input("Enter password: ")
userid = username + '_' + password
if userid in register:
print("Welcome "+username.upper()+" !") # Salutation
operation = input("Would you like to view data: ")
admin(operation, register) # To activate function with the following parameters
user_access(operation, username, password) # To activate function with the following parameters
operation = input("Enter 1 to Log Out\n") # To exit the condition
else:
print("Wrong Username or Password")
elif operation == '2': # For registration
username = input("Enter username: ")
password = input("Enter password: ")
password_check(password, username) # To activate function with the following parameters
while len(password) < 7 or username in password: # Retake the value if the following problem occurs
password = input("Enter password: ")
password_check(password, username)
userid = username + '_' + password # To save the username and password in a single string
# Single string will be used to check whether the username and password same for each other
if userid in register: # if already registered
print("Already registered!")
else:
register.append(userid) # Save userid in our list
print("You've been successfully registered!")
else: # for any other input
print("Wrong Input")

Comments

Popular posts from this blog

Taking Input and Printing the Result in C++

  Let's begin: C++ has many datasets like char, float, int and string etc. Here provided the complete code:    

Linux Commands

Basic Commands 1. pwd — When you first open the terminal, you are in the home directory of your user. To know which directory you are in, you can use the “pwd” command. It gives us the absolute path, which means the path that starts from the root. The root is the base of the Linux file system. It is denoted by a forward slash( / ). The user directory is usually something like "/home/username". 2. ls — Use the "ls" command to know what files are in the directory you are in. You can see all the hidden files by using the command “ls -a”. 3. cd — Use the "cd" command to go to a directory. For example, if you are in the home folder, and you want to go to the downloads folder, then you can type in “cd Downloads”. Remember, this command is case sensitive, and you have to type in the name of the folder exactly as it is. But there is a problem with these commands. Imagine you have a folder named “Raspberry Pi”. In this case, when you type in “cd Raspberry Pi”, t...

Giving Output in Python

 Let's begin! To print in Python: