DEV Community

IEATCODE
IEATCODE

Posted on

How to make a login and sign up form in python

First start by installing the kittyscript library

pip install kittyscript
Enter fullscreen mode Exit fullscreen mode

then import these libraries

from kittyscript import *
import hashlib
Enter fullscreen mode Exit fullscreen mode

here I'm using hashlib to hash the passwords and kittyscript to verify emails.

then make two if statements

from kittyscript import *
import hashlib

S = input("Sign up or log in\n:")

if S == "Sign up":
    password = input("New Password\n:")
    NewUseremail = input("Your E-mail\n:")
    checkemail(NewUseremail)
    hashed_password = hashlib.sha256(password.encode('utf-8')).hexdigest()
    data = ["\n",NewUseremail, ",", hashed_password] 
    with open('index.csv', 'a', encoding='UTF8') as f:
        f.writelines(data)

if S == "Log In":
    Username = input("Your Username\n:")
    if Username in open('index.csv').read():
        Password = input("Your Password\n:")
        hashpass = hashlib.sha256(Password.encode('utf-8')).hexdigest()
        if hashpass in open('index.csv').read():
            print("Logged in")
        else:
            print("Invalid Username")
            exit()
    else:
        print("Invalid Username")
        exit()
Enter fullscreen mode Exit fullscreen mode

and done

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay