Hi Carlos,
I haven't done subclassing Auth yet, but I was wondering why you
didn't use
>> URL('user',args='retrieve_username')
On Dec 2, 8:42 am, Carlos Hanson <[email protected]> wrote:
> While subclassing Auth to override retrieve_username, I needed to create a
> link to retrieve_username and also to login. The solution I found was the
> following:
>
> >>> URL('user')
>
> '/ssam/default/user'>>> URL('user') + '/retrieve_username'
>
> '/ssam/default/user/retrieve_username'>>> URL('user') + '/login'
>
> '/ssam/default/user/login'
>
> We create a URL to the user function in our controller, then add the Auth
> function name we want. The interesting thing I just realized is we can
> modify the user function to do things based on which Auth function is
> requested by using request.args.
>
> I wanted to set the username in the login form. While I don't see a way to
> do that without overriding login in Auth (which I don't want to do), I
> decided setting response.flash would suffice. So now I have the following:
>
> def user():
> if request.args[0] == 'login':
> if request.vars.username:
> response.flash = request.vars.username
> return dict(form=auth())
>
> Just thought I would share.
>
> Carlos