In my application I have a custom registration function. The function
processes registration forms and sends the user
an email with his username and password, this worked well in previous
versions of web2py, however, in version 2.4.6
the generated password changes between inserting a record into the
auth_user table and sending the mail. I have no idea why.
This is the relevant code:
@auth.requires(lambda: auth.has_membership(ADMIN))
def process_register_form():
if not len(request.args):
redirect(URL('register'))
else:
...
userkeyword=generate_userkeyword(name,now)
form=SQLFORM.factory(db.auth_user,submit_button='Sign
up',separator='',formstyle='bootstrap')
form[0].insert(0,DIV(LABEL(H5('Gebruikersgegevens: ' +
userkeyword),_class="control-label"),_class="control-group")) # gives me
the userkeyword OreeH+86
if
form.process(onvalidation=onvalidation_register_form,keepvalues=False).accepted:
...
userID=db.auth_user.insert(title=row.title,first_name=row.firstName,familyNamePreposition=row.familyNamePreposition,\
last_name=row.lastName,shortname=username,phone=row.phone,email=row.email,username=username,password=userkeyword,nodeID=id)
....
context=dict(id=id,title=row.title,familyNamePreposition=row.familyNamePreposition,\
lastName=row.lastName,username=username,userkeyword=userkeyword) # this
userkeywords differs from the one inserted above JreeE~86
message=response.render('mail/register.html',context)
recipient=row.email
mail.send(to=[recipient],subject='Uw Leonexus ID voor de
toegang tot Leonexus CMS',message=[None,message])
elif form.errors:
response.flash=response_flash('formerror',session)
elif not response.flash:
response.flash=response.flash + REQUIRED
session.alert='alert-info'
return dict(form=form)
What happens between inserting the userkeyword in auth_user and adding the
userkeyword in a dict() to the context of the mail, that changes the value
of userkeyword?
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.