Full Stack
@app.route('/register', methods=["POST", "GET"])
def register():
if request.method == 'POST':
username = request.form['username']
password = request.form['password']
if check_user(username, password):
return "user already exist"
else:
register_user(username, password)
return redirect('/')
@app.route('/login', methods=["POST", "GET"])
def login():
if request.method == 'POST':
username = request.form['username']
password = request.form['password']
print(check_user(username, password))
if check_user(username, password):
session['username']=username
return redirect('/home')
else:
return "Wrong Username or Password"
@app.route('/home', methods=["POST","GET"])
def home():
if 'username' in session:
return render_template("index.html", username=session['username'])
else:
return "Wrong Credentials"