On 04/23/2011 10:47 PM, Anthony wrote:
On Saturday, April 23, 2011 1:40:09 PM UTC-4, encompass wrote:
I would like to make a drop down with the email and password option
there... similar to the way that twitter does it. Is this easily
possible?
auth.login() generates the login form -- I suppose you could return
that from your home page controller and embed it in the view where
appropriate (or just call it directly in the view). On the client
side, you would probably handle the drop-down with simple Javascript
to toggle the visibility of the login form. For an example, see
http://www.beunick.com (it's powered by web2py).
Second, I would like to get read of the "Welcome <first name>"
message
next to the logout buttons.
I tried looking into the auth code and couldn't see where this was
easily possible. For example I don't understand how to make my
own auth
form and response on any other page by the default one.
The login and logout links are generated by the 'navbar' method of the
Auth class in /gluon/tools.py. auth.navbar() returns a web2py HTML
helper object, so you can use the server-side DOM to alter it before
it is rendered (see
http://web2py.com/book/default/chapter/05#Server-side-DOM-and-Parsing). Alternatively,
you could just write your own replacement for the 'navbar' function.
Anthony
GREAT! This got me in what I think is the right direction, but I seem
to be having some issues with auth.register()
I made this in the view:
<div id="statusbar">
{{if auth.is_logged_in():}}
<ul>
<li><a href="{{=URL('default', 'user', args='logout')}}">Logout</a></li>
<li><a href="{{=URL('default', 'user', args='profile')}}">Profile</a></li>
</ul>
<div id="login_widget">
{{=auth.login()}}
</div>
<div id="register_widget">
{{=auth.register()}}
</div>
{{else:}}
<ul>
<li><a href="{{=URL('default', 'user', args='login')}}">Login</a></li>
<li><a href="{{=URL('default', 'user', args='register')}}">Register</a></li>
</ul>
{{pass}}
</div>
But it seems that when I do this I and then go to a page with the code
my browser throws me an error saying it's in a redirect loop...
"The page isn't redirecting properly
Firefox has detected that the server is redirecting the request for this
address in a way that will never complete."
If I take out the =auth.register it will work...
WEIRD!!!
Any ideas into the problem?
---
Best Regards,
Jason Brower