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

Callum Anderson
seal-mask
.a{fill-rule:evenodd;}techdegree
Callum Anderson
Data Analysis Techdegree Student 10,200 Points

Can't seem to resolve issue with Bcrypter challenge

Getting an 'Assertion Error' about the function, pretty confused on how to continue from here code challenge should be linked along with my code.

Many thanks!

password_hashing.py
from flask.ext.bcrypt import generate_password_hash, check_password_hash

def set_password(User, string):
    user.password = generate_password_hash('string')
    return User

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there, Callum Anderson! First, you are meant to use the parameters user and password not User and string. Secondly, you are always hashing the string 'string' as opposed to whatever string was passed along as an argument.

def set_password(user, password):
    user.password = generate_password_hash(password) # set the user's password to the hash of whatever they entered
    return user  # return the user

Hope this helps! :sparkles: