Signup page now populates database correctly
This commit is contained in:
@ -2,6 +2,7 @@ from . import blueprint
|
||||
from flask import render_template, redirect, request
|
||||
from controllers.database.user import UserController
|
||||
from models.users.customer import Customer
|
||||
from hashlib import sha512
|
||||
|
||||
|
||||
# Function responsible for displaying the main landing page of the site
|
||||
@ -34,7 +35,15 @@ def display_signup():
|
||||
@blueprint.post('/signup')
|
||||
def signup():
|
||||
database = UserController()
|
||||
database.create(Customer())
|
||||
database.create(Customer(
|
||||
0,
|
||||
request.form['username'],
|
||||
request.form['email'],
|
||||
request.form['firstname'],
|
||||
request.form['lastname'],
|
||||
"123",
|
||||
sha512(request.form['password'].encode()).hexdigest(), # Hashed as soon as it is recieved on the backend
|
||||
"Customer"
|
||||
))
|
||||
|
||||
print("Tryin to signup as " + request.form['username'])
|
||||
return redirect("/")
|
||||
|
Reference in New Issue
Block a user