Cool, thanks guys.
I do have decorators on certain login-only pages, but I want a page
that's visible to both members and guests. The idea is to have a login
form that shows up only under certain circumstances.
I've done some further tests, and I think auth.login() is working in-
template, but it doesn't seem to work if there's already a login form
on the page. Can I only call auth.login() once?
Here's how I'm attempting to do login now:
{{if user_id:}}
<span>Welcome {{=user_current().first_name }}!</span>
<form>
<input type="button" id="logoutBtn" value="Log Out"
onclick="window.location.href =
'{{=URL('default','user',args=['logout'])}}';" />
</form>
{{else:}}
{{top_login_form = auth.login()}}
{{=top_login_form.custom.begin}}
{{=top_login_form.custom.widget.email}}
{{=top_login_form.custom.widget.password}}
{{top_login_form.custom.widget.login}}
<input type="image" src="/init/static/images/buttons/
login.png" id="loginBtn" value="Log In" />
<!--input type="text" placeholder="email" name="email">
<input type="password" placeholder="password"
name="password">
<input type="image" src="/init/static/images/buttons/
login.png" id="loginBtn" value="Log In"-->
{{=top_login_form.custom.end}}
{{pass}}
On Nov 14, 4:07 pm, Anthony <[email protected]> wrote:
> auth.login() handles its own processing, so you don't need to do
> login_form.accepts(). So, just use auth.login() wherever you need it.
>
> Anthony
>
>
>
>
>
>
>
> On Monday, November 14, 2011 3:58:52 PM UTC-5, Chris wrote:
>
> > Hello,
>
> > I'd like to make a login form and have it be accessible in multiple
> > pages, without having to rewrite the same code in every single
> > controller action:
>
> > login_form = auth.login()
> > if login_form.accepts(...
>
> > Is this possible?
>
> > Thanks,
> > Chris