Skip to content
Sign upLog in
← Back to Community

How do you create a WORKING login form?

Profile icon
patelr

How do I create a WORKING log in form, which remembers you and you are able to create an account? I have also struggled with this a lot in the past.

Answered by CosmicBear [earned 5 cycles]
View Answer
Voters
Profile icon
patelr
Comments
hotnewtop
Profile icon
CosmicBear

You need a backend server (try flask or node.js) with a database. For example:

<!--html--> <form method="POST"> <input name="username" placeholder="username"> <input name="password" placeholder="password"> </form>
#python from flask import Flask,request from replit import db app = Flask(__name__) @app.route('/login',methods=["GET","POST"]) def login(): if request.method == "POST": db[request.form["username"]] = request.form["password"] return <the html>
Profile icon
patelr

thank you so much, i am finally free from my [email protected]

Profile icon
ch1ck3n

you can't just do it with HTML

i am not going to give you code because you will learn to do it yourself

eh the hell with it

first the HTML

<form method="POST"> <input name="username" placeholder="username"> <input name="password" placeholder="password"> </form>

POST is a more secure way than GET

next I assume you are using express with nodejs

you will make a post route app.post() and in that function you will get the form values and set it to the database

Profile icon
patelr
Profile icon
BangLuon

from flask import Flask,request
from replit import db
app = Flask(name)


@app
.route('/login',methods=["GET","POST"])
def login():
if request.method == "POST":
db[request.form["username"]] = request.form["password"]
return

Profile icon
patelr

thanks


@BangLuon