Forem

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

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more

👋 Kindness is contagious

Explore a sea of insights with this enlightening post, highly esteemed within the nurturing DEV Community. Coders of all stripes are invited to participate and contribute to our shared knowledge.

Expressing gratitude with a simple "thank you" can make a big impact. Leave your thanks in the comments!

On DEV, exchanging ideas smooths our way and strengthens our community bonds. Found this useful? A quick note of thanks to the author can mean a lot.

Okay