By default, web2py looks for a view with the same name as the associated 
function in a folder with the same name as the associated controller. In 
the scaffolding app, auth actions are handled by the user() function in the 
default.py controller, so it will automatically use the 
/views/default/user.html view for all auth actions. If you want to set a 
custom view, you can do something like:

def user():
    auth_views = dict(login='default/login.html', register=
'default/register.html')
    response.view = auth_views.get(request.args(0), response.view)
    return dict(form=auth())

You could also create completely separate functions for login and 
registration.

Anthony

On Sunday, February 17, 2013 10:34:11 AM UTC-5, Alec Taylor wrote:
>
> I am trying to replace these views with custom ones I've created. 
>
> So I have a folder called "user" with a "login.html" and a 
> "register.html". 
>
> Putting this "user" folder in web2py/<appname>/views does not make the 
> system use these views. Moving them to the 
> web2py/<appname>/views/default folder also has no affect. 
>
> How do I use custom views for my auth.* stuff in web2py? (e.g.: so 
> @auth.requires_login() redirects to the modified views) 
>
> Thanks for all suggestions, 
>
> Alec Taylor 
>

-- 

--- 
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.


Reply via email to