diff --git a/blog/routes.py b/blog/routes.py
index 29ad5aeb022a52a660373647ac473c70d213f6e3..a05235e61cceb18af69675ef4f3adb4fc32e851a 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'))