Continuing to add correct documentation to components within the application
This commit is contained in:
@ -1,3 +1,6 @@
|
||||
""" The user controller to manage all of the user related endpoints
|
||||
in the web app
|
||||
"""
|
||||
from flask import Blueprint
|
||||
|
||||
from flask import render_template, redirect, request, session, flash
|
||||
@ -10,19 +13,17 @@ from hashlib import sha512
|
||||
# Blueprint to append user endpoints to
|
||||
blueprint = Blueprint("users", __name__)
|
||||
|
||||
|
||||
# LOGIN FUNCTIONALITY
|
||||
# Function responsible for delivering the Login page for the site
|
||||
|
||||
|
||||
@blueprint.route('/login')
|
||||
def display_login():
|
||||
""" Function responsible for delivering the Login page for the site """
|
||||
return render_template('index.html', content="login.html")
|
||||
|
||||
# Function responsible for handling logins to the site
|
||||
|
||||
|
||||
@blueprint.post('/login')
|
||||
def login():
|
||||
""" Function to handle the backend processing of a login request """
|
||||
database = UserController()
|
||||
user = database.read(request.form['username'])
|
||||
error = None
|
||||
@ -44,16 +45,15 @@ def login():
|
||||
|
||||
|
||||
# SIGNUP FUNCTIONALITY
|
||||
# Function responsible for delivering the Signup page for the site
|
||||
@blueprint.route('/signup')
|
||||
def display_signup():
|
||||
""" Function responsible for delivering the Signup page for the site """
|
||||
return render_template('index.html', content="signup.html")
|
||||
|
||||
# Function responsible for handling signups to the site
|
||||
|
||||
|
||||
@blueprint.post('/signup')
|
||||
def signup():
|
||||
""" Function to handle the backend processing of a signup request """
|
||||
database = UserController()
|
||||
|
||||
# User already exists
|
||||
@ -91,9 +91,9 @@ def signup():
|
||||
|
||||
|
||||
# SIGN OUT FUNCTIONALITY
|
||||
# Function responsible for handling logouts from the site
|
||||
@blueprint.route('/logout')
|
||||
def logout():
|
||||
""" Function responsible for handling logouts from the site """
|
||||
# Clear the current user from the session if they are logged in
|
||||
session.pop('user_id', None)
|
||||
return redirect("/")
|
||||
|
Reference in New Issue
Block a user