Created base database controller and user database controller to allow for initial database control
This commit is contained in:
5
controllers/web/__init__.py
Normal file
5
controllers/web/__init__.py
Normal file
@ -0,0 +1,5 @@
|
||||
from flask import Blueprint
|
||||
|
||||
blueprint = Blueprint('endpoints', __name__)
|
||||
|
||||
from . import endpoints
|
40
controllers/web/endpoints.py
Normal file
40
controllers/web/endpoints.py
Normal file
@ -0,0 +1,40 @@
|
||||
from . import blueprint
|
||||
from flask import render_template, redirect, request
|
||||
from controllers.database.user import UserController
|
||||
from models.users.customer import Customer
|
||||
|
||||
|
||||
# Function responsible for displaying the main landing page of the site
|
||||
@blueprint.route('/')
|
||||
def welcome_page():
|
||||
return render_template('index.html', content="content.html")
|
||||
|
||||
|
||||
|
||||
### LOGIN FUNCTIONALITY
|
||||
# Function responsible for delivering the Login page for the site
|
||||
@blueprint.route('/login')
|
||||
def display_login():
|
||||
return render_template('index.html', content="login.html")
|
||||
|
||||
# Function responsible for handling logins to the site
|
||||
@blueprint.post('/login')
|
||||
def login():
|
||||
print("Tryin to login as " + request.form['username'])
|
||||
return redirect("/")
|
||||
|
||||
|
||||
### SIGNUP FUNCTIONALITY
|
||||
# Function responsible for delivering the Signup page for the site
|
||||
@blueprint.route('/signup')
|
||||
def display_signup():
|
||||
return render_template('index.html', content="signup.html")
|
||||
|
||||
# Function responsible for handling signups to the site
|
||||
@blueprint.post('/signup')
|
||||
def signup():
|
||||
database = UserController()
|
||||
database.create(Customer())
|
||||
|
||||
print("Tryin to signup as " + request.form['username'])
|
||||
return redirect("/")
|
Reference in New Issue
Block a user