Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python A Social Network with Flask Making Strong Users Bcryptkeeper

check_password_hash with flask_bcrypt

def check_password(user, password): hashed_pw = generate_password_hash(password) check_password_hash(hashed_pw, password)

password_hashing.py
from flask.ext.bcrypt import generate_password_hash, check_password_hash

def set_password(user, password):
    user.password = generate_password_hash(password)
    return user

def validate_password(user, password):
    hashed_pw = generate_password_hash(password)
    check_password_hash(hashed_pw, password)

1 Answer

Megan Amendola
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree seal-36
Megan Amendola
Treehouse Teacher

Hi! In validate, you should be checking the password input versus the user's password with check_password_hash. Right now you are creating a brand new hashed password and then checking the password against this new hash. You want to confirm the user's password matches the given password.