Skip to content

Instantly share code, notes, and snippets.

@Kd-Here

Kd-Here/auth.py Secret

Created March 4, 2023 17:37
Show Gist options
  • Save Kd-Here/350a1e34177edb7f12a371b6e451649d to your computer and use it in GitHub Desktop.
Save Kd-Here/350a1e34177edb7f12a371b6e451649d to your computer and use it in GitHub Desktop.
from flask import Blueprint,render_template,request,flash
auth = Blueprint('auth',__name__)
@auth.route('/login',methods=['GET','POST'])
def login():
data = request.form
print(data.get('password'))
return render_template('login.html',data_from_backend='testing data from backend')
@auth.route('/sign-up',methods=['GET','POST'])
def singin():
if request.method == "POST":
email = request.form.get('email')
firstName = request.form.get('firstName')
password1 = request.form.get('password1')
password2 = request.form.get('password2')
print(email,firstName,password1,password2)
if len(email) < 9:
flash("Email must be greater than 3 characters.",category='error')
#flash is a built in function from flask
elif len(firstName) < 2:
flash("Firstname must be greater than 1 characters.",category='error')
elif password1 != password2:
flash("Password don't match.",category='error')
elif len(password1) < 7:
flash("Password must be at least 7 characters.",category='error')
else:
flash("Account created!",category='success')
return render_template('sign_up.html')
@auth.route('/logout')
def logout():
return "<h2>Logout</h2>"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment