From dc6fba810f2970f1462d0abc5d35677453f82c02 Mon Sep 17 00:00:00 2001
From: Harry Hughes <hugheshi@cardiff.ac.uk>
Date: Sun, 29 Jan 2023 14:55:55 +0000
Subject: [PATCH] Replace routes.py

---
 blog/routes.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/blog/routes.py b/blog/routes.py
index 29ad5ae..a05235e 100644
--- a/blog/routes.py
+++ b/blog/routes.py
@@ -87,7 +87,7 @@ def account():
 def register():
   form = RegistrationForm()
   if form.validate_on_submit():
-    user = User(username=form.username.data, email=form.email.data, password=form.password.data)
+    user = User(username=form.username.data, email=form.email.data, password=form.password_hash.data)
     db.session.add(user)
     db.session.commit()
     flash('Registration successful!')
@@ -103,7 +103,7 @@ def login():
   form = LoginForm()
   if form.validate_on_submit():
     user = User.query.filter_by(username=form.username.data).first()
-    if user and (user.password, form.password.data):
+    if user and (user.password_hash, form.password_hash.data):
       login_user(user)
       flash('You\'ve successfully logged in,'+' '+ current_user.username +'!')
       return redirect(url_for('home'))
-- 
GitLab