I think the form processing within the auth.register() function is probably
failing because you have renamed the form to 's_registration', and it is
expecting a form named 'register' (it uses the formname to check the
_formkey value in the session). If the form doesn't get accepted, it
doesn't get to the redirect logic.
Anthony
On Thursday, June 6, 2013 6:59:51 PM UTC-4, lesssugar wrote:
>
> Right, thanks. But what about the "next" attribute? What might be the
> reason of the argument not working?
>
> On Friday, June 7, 2013 12:53:35 AM UTC+2, Anthony wrote:
>>
>> auth.register() automatically processes the form, so you should not
>> subsequently call request_form.process().
>>
>> Anthony
>>
>> On Thursday, June 6, 2013 6:21:52 PM UTC-4, lesssugar wrote:
>>>
>>> After user registers, I would like to redirect them to a different URL,
>>> let's say default/index.
>>>
>>> Auto-login in db.py is set to False.
>>>
>>> In my default.py controller I have this:
>>>
>>> register_form = auth.register(next=URL('default', 'index'))
>>> register_form.update(_class='formstyle', _name='s_registration')
>>> if register_form.process().accepts(request.vars,
>>> formname='s_registration'):
>>> auth.add_membership(group_id=1,
>>> user_id=register_form.vars.id<http://register_form_s.vars.id>
>>> )
>>>
>>> return dict(register_form=register_form)
>>>
>>> So after user registers, no redirection takes place. However, the
>>> registration itself is correct (checked auth_user and auth_membership in
>>> the DB).
>>>
>>> Any suggestions why "next" argument does't get the job done?
>>>
>>> UPDATE:
>>> If I add "redirect(URL('default', 'index'))" in the IF condition (code
>>> above) - all goes fine. What's with the "next" argument then?
>>>
>>>
--
---
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.