-
Notifications
You must be signed in to change notification settings - Fork 0
/
wsgi.py
51 lines (42 loc) · 1.62 KB
/
wsgi.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env python3
from flask import Flask, render_template, request, redirect, flash
from config import Config
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
from werkzeug.security import generate_password_hash, check_password_hash
from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, BooleanField, SubmitField
from wtforms.validators import DataRequired
from time import sleep
app = Flask(__name__)
app.config.from_object(Config)
class LoginForm(FlaskForm):
username = StringField('Username', validators=[DataRequired()])
password = PasswordField('Password', validators=[DataRequired()])
remember_me = BooleanField('Remember Me')
submit = SubmitField('Sign In')
@app.route("/")
def root():
return redirect("/login")
@app.route("/login", methods=['GET', 'POST'])
def login():
form = LoginForm()
# if form.validate_on_submit():
flash('Login requested for user {}, remember_me={}'.format(form.username.data, form.remember_me.data))
return redirect('/login-results')
#elif not form.validate_on_submit():
# return redirect('/login')
# pass
return render_template("login.html", form=form)
@app.route("/login-results")
def login_results():
return render_template("login-results.html")
@app.route("/register")
def register():
return render_template("registration.html")
@app.route("/registration-error")
def regerror():
return render_template("registration-failure.html")
@app.route("/registration-success")
def regsuccess():
return render_template("registration-success.html")