>
> Hello Anthony,
>
> Well i have done a custom login in the index page, so after the user logs 
> in the login form is still shown.... so i am trying to redirect the user to 
> a different page after the login
>
> controller:
>     
>  # -*- coding: utf-8 -*-
> ### required - do no delete
> def user(): return dict(form=auth())
> def download(): return response.download(request,db)
> def call(): return service()
> ### end requires
> def index():
> return dict(form=auth.login())
>
>
> def home():
> return dict()
>
> def error():
> return dict()
>
>
> View:
>
> {{extend 'layout.html'}}
>
> <div id="login_form">
>
>
>
> {{=form}}
>
> </div>
>
> This code gives me the login form in the index page, but after the login 
> the login form is still shown
>

If you set auth.settings.login_next = URL('index'), then after login (which 
happens on the index page), it will simply redirect right back to the index 
page. If you want to redirect to a page other than the index page, then you 
have to set auth.settings.login_next to the URL of that other page.

Note, another option is to simply remove the login form from the index page 
once the user has logged in:

def index():
    return dict(form=auth.login() if not auth.user else None)

index.html:

{{if form:}}
<div id="login_form">
{{=form}}
</div> 
{{pass}}

Anthony

Reply via email to