Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
I passed the first 2 task of the challenge. I was struggling with the second task and now the 3rd one is not passing.
need some help
from flask.ext.bcrypt import generate_password_hash from flask.ext.bcrypt import check_password_hash #from flask.ext.bcrypt import set_password #from flask.ext.bcrypt import validate_password def set_password(user, password): generate_password_hash(password) user.password = generate_password_hash(password) return user def validate_password(user.password, password): if user.password == check_password_hash(user.password, password): return True else: return False
Megan AmendolaTreehouse Teacher
Hi! In your validate function, what you have right now will always return False.
check_password_hash(user.password, password) already returns either True or False because it is checking the user's password against the input password to make sure they match.
if user.password == check_password_hash(user.password, password): Next, you are checking the password (which is a string) against the result of the function (which is a boolean). This will always result to False.
check_password_hash(user.password, password) already returns either True or False, you can just return that value.
def validate_password(user.password, password): return check_password_hash(user.password, password)