Hello,

I don't get the correct behavior when update response.headers with
onaccept parameter on auth.login function. Here I'm trying to redirect
with Javascript after user logins but it redirect to "default/
index.load", below:


# default.py
def login():
    nc = request.vars.nc or 'default'
    nf = request.vars.nf or 'index'
    next = URL(r=request, c=nc, f=nf)
    return dict(form=auth.login(onaccept=lambda form:
response.headers.update({'web2py-component-
command':"document.location='%s'"%next})))


# index.html
{{extend 'layout.html'}}
{{=LOAD("default","login.load",vars={'nc':'editor','nf':'list.html'},ajax=True,ajax_trap=True)}}


# login.load
{{=form.custom.begin}}
Usuario: {{=form.custom.widget.username}}
Clave: {{=form.custom.widget.password}}
{{=form.custom.submit}}
{{=form.custom.end}}


If anyone see something, please tell me.

Reply via email to