protections added

This commit is contained in:
Seligmann
2022-03-26 19:15:45 -05:00
parent 9e9564154f
commit 7c4bd7e8d2
4 changed files with 26 additions and 10 deletions

View File

@@ -1,4 +1,5 @@
from flask import Blueprint, render_template, redirect, url_for, request, flash
from flask_login import login_user, current_user, login_required, logout_user
from werkzeug.security import generate_password_hash, check_password_hash
from .models import User
from . import db
@@ -15,8 +16,7 @@ There will also be routes for handling POST requests from login and signup
@auth.route('/login')
def login():
# return render_template('login.html')
return 'Login' # placeholder
return render_template('login.html')
@auth.route('/login', methods=['POST'])
def login_post():
@@ -31,13 +31,13 @@ def login_post():
flash('Please check your login details and try again.')
return redirect(url_for('auth.login'))
login_user(user, remember=remember)
return redirect(url_for('main.profile'))
@auth.route('/signup')
def signup():
# return render_template('signup.html')
return 'Signup' # placeholder
return render_template('signup.html')
@auth.route('/signup', methods=['POST'])
@@ -63,5 +63,7 @@ def signup_post():
@auth.route('/logout')
@login_required
def logout():
return 'Logout' # placeholder
logout_user()
return redirect(url_for('main.index'))