Last active
September 19, 2021 08:31
-
-
Save lorenzobn/e748b510c1858d0683738579bb74e8f9 to your computer and use it in GitHub Desktop.
Snippet of code containing the login route for 2FA
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@app.route("/login", methods=['GET', 'POST']) | |
def login(): | |
form_user = request.form.get("username") | |
form_pass = request.form.get("password") | |
if request.method == 'POST': | |
if form_user == app.config["USER"] and form_pass == app.config["PASS"]: | |
session['username'] = form_user | |
return redirect(url_for("OTP_auth")) | |
else: | |
flash("Invalid credentials. Please try again.") | |
return redirect(url_for("index")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment