Skip to content
Snippets Groups Projects
Commit dc6fba81 authored by Harry Hughes's avatar Harry Hughes
Browse files

Replace routes.py

parent 03bcc43a
No related branches found
No related tags found
No related merge requests found
...@@ -87,7 +87,7 @@ def account(): ...@@ -87,7 +87,7 @@ def account():
def register(): def register():
form = RegistrationForm() form = RegistrationForm()
if form.validate_on_submit(): 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.add(user)
db.session.commit() db.session.commit()
flash('Registration successful!') flash('Registration successful!')
...@@ -103,7 +103,7 @@ def login(): ...@@ -103,7 +103,7 @@ def login():
form = LoginForm() form = LoginForm()
if form.validate_on_submit(): if form.validate_on_submit():
user = User.query.filter_by(username=form.username.data).first() 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) login_user(user)
flash('You\'ve successfully logged in,'+' '+ current_user.username +'!') flash('You\'ve successfully logged in,'+' '+ current_user.username +'!')
return redirect(url_for('home')) return redirect(url_for('home'))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment