Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Login Page Project #316

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions Login Page Text based/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Text Based Login Page
<img src="assests/main.png" width=40% height=40%>

## Description
This is a simple Text based login page with json library used for data storage and has following features:
- Register
- Login
- Change Password
## Language and Frameworks
This program is made with python, it do not uses any external framework/library buy uses json and time library
## How to use
You should have python installed in your computer.
You can run it using following command:
python "login page.py"
## Author
The script is by Vedant
Vedant0109--> https://github.com/Vedant0109
This is my github profile
90 changes: 90 additions & 0 deletions Login Page Text based/login page.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
import json
from time import sleep


def register() -> None:
username= input("Enter your username: ")
while len(username)<=7:
print("Your username should be atleast of 8 digits")
username=input("Re-Enter your username: ")
while username in u_p:
print("Username already taken try anthor")
username=input("Re-Enter your username: ")
print(f"Your username is {username}")
password= input("Enter your password: ")
while len(password)<=7:
print("Your password should be of atleast 8 words")
password=input("Re-Enter your password: ")
print(f"Your password is {password}")
u_p[username]=password # appends username and password to dictionary

with open("thing.json", "w") as file:
json.dump(u_p , file)
print("You successfully registered")
sleep(3)




def login() -> None:
username = input("Enter your username: ")
while username not in u_p:
print("Username not found")
username = input("Enter your username: ")
password= u_p[username]
t_password= input("Enter your password: ")
while t_password!=password:
print("Wrong password")
t_password=input("Re-Enter your password: ")
print("You Succesfully logged In.")



def change_password() -> None:
username = input("Enter your username: ")
while username not in u_p:
print("Username not found")
username = input("Enter your username: ")
password= u_p[username]
n_password= input("Enter your new password: ")
while n_password==password:
print("Your original password can't be your new password")
n_password= input("Enter your password: ")
while len(n_password)<=7:
print("Your password should be of atleast 8 words")
n_password=input("Re-Enter your password: ")
u_p[username]=n_password
print("Successfully changed your password")
with open("thing.json", "w") as file:
json.dump(u_p , file)



try:
with open('thing.json', 'r') as file:
u_p = json.load(file)
except FileNotFoundError:
u_p={}
print("Welcome , this is a login page")

sleep(3)

choice1=None

while choice1 != "q":
choice1= input("1. Regster\n2. Login\n3. Change password\nq to quit: ")
if choice1=="1":
register()

elif choice1=="2":
login()


elif choice1=="3":
change_password()

elif choice1=="q":
break

else:
print("Invalid input")