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 trialRoneshia Allen
5,192 PointsCan someone please help me with this task. I really don't know why its not passing.
password_hashing
from flask.ext.bcrypt import generate_password_hash, check_password_hash
from flask.ext.bcrypt import set_password
def set_password(User, string1):
User.password = generate_password_hash('string1')
return User
2 Answers
Jennifer Nordell
Treehouse TeacherHi there, Roneshia Allen! The problem here is that you are hashing the password 'string1'
instead of whatever the user sent in as their password which was then assigned to the variable string1
.
Instead of:
generate_password_hash('string1')
You need:
generate_password_hash(string1)
Hope this helps!
Jeff Muday
Treehouse Moderator 28,722 PointsRoneshia-- great work, you're very close to having it correct.
Jennifer perfectly identifies the string1
issue-- but, the Challenge automated grader is unusually specific about what the variables should be named too.
Changes to be made:
A. remove (or comment out) the import of set_password
as you are defining it explicitly in the module.
B. make sure to use user
rather than User
C. make sure to use password
rather than string1
from flask.ext.bcrypt import generate_password_hash, check_password_hash
#from flask.ext.bcrypt import set_password
def set_password(user, password):
user.password = generate_password_hash(password)
return user
Keep up the good work on Flask! I use it in my daily work and really enjoy it.
Roneshia Allen
5,192 PointsHey, it passed. Thank you so much.
Roneshia Allen
5,192 PointsRoneshia Allen
5,192 PointsIt passed!!! thank you so much.