No matter what I try I keep ending up with two different passwords.
The strange thing is that when I replace this:
password=generate_password(name,now)
with this:
password='6#TestValue'
The function works, '6#TestValue' is both inserted into the auth_user
table's password field
and sent to the user by mail.
It's this call that messes up the function:
password=generate_password(name,now)
I stripped the function to get a minimal function that reproduces the
problem given the auth_user table in the post above:
def mock_register_form():
name='vermeer'
now=str(request.now.day)+str(request.now.month)
username='verm8613'
password=generate_password(name,now)
warning='After generate password: ' + password
form=SQLFORM.factory(db.auth_user,ignore_rw=True,submit_button='Registreer',separator='',formstyle='bootstrap')
form.vars.title='mevrouw'
form.vars.first_name='Charlotte'
form.vars.last_name='Vermeer'
form.vars.shortname=username
form.vars.email='[email protected]
form.vars.username=username
form.vars.password=password
form.vars.nodeID=3
form[0].insert(8,DIV(LABEL(H5(password),_class="control-label"),_class="control-group"))
if form.process(keepvalues=False).accepted:
userID=db.auth_user.insert(**db.auth_user._filter_fields(form.vars))
context=dict(id=form.vars.nodeID,title=form.vars.title,familyNamePreposition=form.vars.familyNamePreposition,\
lastName=form.vars.last_name,username=form.vars.username,password=password,signature=None)
message=response.render('mail/register.html',context)
recipient=form.vars.email
mail.send(to=[recipient],subject='Your ID to get acces to our
CMS',message=[None,message])
response.flash=warning
elif form.errors:
response.flash='Form contains errors'
elif not response.flash:
response.flash='Fill out form'
return dict(form=form)
I am working in web2py version 2.4.6
Kind regards,
Annet
--
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.