user = request.db.User()
user.username = username
user.email = email
- user['pw_hash'] = auth_lib.bcrypt_gen_password_hash(
+ user.pw_hash = auth_lib.bcrypt_gen_password_hash(
request.POST['password'])
user.save(validate=True)
cp_form = auth_forms.ChangePassForm(formdata_vars)
if request.method == 'POST' and cp_form.validate():
- user[u'pw_hash'] = auth_lib.bcrypt_gen_password_hash(
+ user.pw_hash = auth_lib.bcrypt_gen_password_hash(
request.POST['password'])
user[u'fp_verification_key'] = None
user[u'fp_token_expire'] = None
See if a user can login with this password
"""
return auth_lib.bcrypt_check_password(
- password, self['pw_hash'])
+ password, self.pw_hash)
class MediaEntry(Document):
entry = db.User()
entry.username = unicode(args.username.lower())
entry.email = unicode(args.email)
- entry['pw_hash'] = auth_lib.bcrypt_gen_password_hash(args.password)
+ entry.pw_hash = auth_lib.bcrypt_gen_password_hash(args.password)
entry['status'] = u'active'
entry['email_verified'] = True
entry.save(validate=True)
user = db.User.one({'username': unicode(args.username.lower())})
if user:
- user['pw_hash'] = auth_lib.bcrypt_gen_password_hash(args.password)
+ user.pw_hash = auth_lib.bcrypt_gen_password_hash(args.password)
user.save()
print 'Password successfully changed'
else:
new_user = mg_globals.database.User()
new_user.username = u'lolcat'
new_user.email = u'lol@cats.example.org'
- new_user['pw_hash'] = u'pretend_this_is_a_hash'
+ new_user.pw_hash = u'pretend_this_is_a_hash'
new_user.save()
assert mg_globals.database.User.find().count() == 1