>
> def index():

    
>     user_auth = auth.login()
>     user_auth.add_button('register me', URL('register_user'))
>

Right after the above, just do:

    if auth.user:
        session.user_name = auth.user.username

auth.login() not only creates the login form, but it also processes it and 
then logs the user in. So, if the login was successful, auth.user will 
exist after auth.login() has been called.

Do you really need session.user_name in the session, though? You can 
already get it via auth.user.username whenever needed.

Anthony

-- 

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