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 trialabou93
14,319 PointsNeed some help in challenge task 3 of 3, checking password hashes
For some reason with my code I keep getting a "bummer returned False with correct password and True for incorrect one" I'm not seeing what I'm doing wrong. tried everything, even using != vs == and reversing the True and False booleans
from flask.ext.bcrypt import generate_password_hash, check_password_hash
def set_password(User, password):
User.password = generate_password_hash('secretpass')
return User
def validate_password(User, password):
if User.password == check_password_hash(User.password, 'secretpass'):
return True
else:
return False
4 Answers
michaelangelo owildeberry
18,173 Points if check_password_hash(User.password, 'secretpass'):
what happens when you try this?
=)
michaelangelo owildeberry
18,173 Pointsif check_password_hash(User.password, secretpass):
# remove the (' ') from any secretpass
This will do the trick, yes?
=)
abou93
14,319 Pointsidk treehouse is acting up at the moment so nothing I try is even working currently
michaelangelo owildeberry
18,173 Pointshave you tried different web browser and updating the web browser? =)
stuartholland
10,773 PointsWhy use an if statement at all? check_password_hash returns True or False so return it.
abou93
14,319 Pointsabou93
14,319 PointsTried that too and it didn't work. Really stuck on this one