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 Build a Social Network with Flask Making Strong Users Bcryptkeeper

Need 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

utils.py
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

  if check_password_hash(User.password, 'secretpass'):

what happens when you try this?

=)

Tried that too and it didn't work. Really stuck on this one

if check_password_hash(User.password, secretpass):
# remove the (' ') from any secretpass

This will do the trick, yes?

=)

idk treehouse is acting up at the moment so nothing I try is even working currently

have you tried different web browser and updating the web browser? =)

Why use an if statement at all? check_password_hash returns True or False so return it.