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 trialTafadzwa Timothy Gakaka
10,978 PointsBuild social network with flask
Now create a function named set_password that takes a user and a password that is a string. Hash the password, set the user.password attribute to the hashed password, and return the user.
im so stuck help
from flask.ext.bcrypt import check_password_hash
from flask.ext.bcrypt import generate_password_hash
def set_password(User, string):
User.password = generate_password_hash(string) return User
def validate_password(user, password):
if check_password_hash(user.password, password):
return True else: return False
2 Answers
Chris Freeman
Treehouse Moderator 68,457 PointsApparently, the challenge checker is specifically looking for user
(lowercased) and password
as the function parameters.
Also the if
and else
block code should be on their own lines. Same with the return
statements.
Post back if you need more help. Good luck!!!
Tafadzwa Timothy Gakaka
10,978 Pointsthank you sir
Tafadzwa Timothy Gakaka
10,978 PointsTafadzwa Timothy Gakaka
10,978 PointsMr Freeman can you sent me your code im just failing to crack this one
Chris Freeman
Treehouse Moderator 68,457 PointsChris Freeman
Treehouse Moderator 68,457 Points