2020-08-21 08:39:59 +01:00
|
|
|
from flask import request, render_template, session, redirect, url_for
|
2020-08-25 20:48:50 +01:00
|
|
|
from wowstash.blueprints.authentication import authentication_bp
|
|
|
|
from wowstash.forms import Register
|
|
|
|
from wowstash.models import User
|
2020-08-21 08:39:59 +01:00
|
|
|
|
|
|
|
|
2020-08-25 20:48:50 +01:00
|
|
|
@authentication_bp.route("/register", methods=["GET", "POST"])
|
|
|
|
def register():
|
|
|
|
form = Register()
|
|
|
|
if form.validate_on_submit():
|
|
|
|
print(dir(User))
|
|
|
|
# user = User.query
|
|
|
|
user = User.objects.filter(email=form.email.data)
|
|
|
|
print(user)
|
|
|
|
return "ok"
|
|
|
|
else:
|
|
|
|
print(form)
|
|
|
|
return render_template("authentication/register.html", form=form)
|
2020-08-21 08:39:59 +01:00
|
|
|
|
2020-08-25 20:48:50 +01:00
|
|
|
@authentication_bp.route("/login", methods=["GET", "POST"])
|
|
|
|
def login():
|
|
|
|
return render_template("authentication/login.html")
|
2020-08-21 08:39:59 +01:00
|
|
|
|
|
|
|
@authentication_bp.route("/logout")
|
|
|
|
def logout():
|
|
|
|
session.clear()
|
|
|
|
return redirect(url_for('index'))
|