Try adding ajax_trap=True to your LOAD call. Without that, your form will be
posted to the action of the parent page, which is not prepared to process
the login submission. ajax_trap=True will post the form submission back to
the login() action. Or you can just use ajax=True for the login component.
Anthony
On Saturday, July 9, 2011 9:06:17 AM UTC-4, LightOfMooN wrote:
> Hello.
> I'm trying to make a login viewlet.
>
> So, I have function in controller "default":
> def login():
> return dict(form=auth.login())
>
> And view:
> <div id="log_menu">
> {{if not auth.user:}}
> <form action="" enctype="multipart/form-data" method="POST">
> <div>
> Login<input name="username" type="text" value="" />
> </div>
> <div>
> Password<input name="password" type="password" value="" />
> </div>
> <div>
> <input name="remember" type="checkbox" value="on"
> checked="checked">remember me
> </div>
> {{=form.hidden_fields()}}
> <div>
> <input class="formbutton" type="submit" value="login">
> </div>
> </form>
> {{else:}}
> <a href="{{=URL('default','user',args='logout')}}">logout</a>
> {{pass}}
> </div>
>
> By url /default/login it works fine, but when I include it in
> layout.html with
> {{=LOAD('default','login', vars=request.vars, ajax=False)[0][0]}}
> it doesn't log user in.
>
> How to make it works? thx