Ahh yes that would explain it. Thanks for the tip, Anthony!

Also, submitted the issue: 
https://code.google.com/p/web2py/issues/detail?id=1971

On Thursday, August 28, 2014 3:36:17 PM UTC-7, Anthony wrote:
>
> Looks like a bug. The login() method does the following:
>
>         passfield = settings.password_field
>         try:
>             table_user[passfield].requires[-1].min_length = 0
>         except:
>             pass
>
> It sets the minimum length for the password field to 0 but doesn't restore 
> it. Please submit a Google Code issue.
>
> In the meantime, you can just define the register form first, or after 
> defining the login form, do:
>
> db.auth_user.password.requires[-1].min_length = auth.settings.
> password_min_length
>
> Anthony
>
> On Thursday, August 28, 2014 4:17:33 PM UTC-4, Mark Li wrote:
>>
>> I currently have both auth.login() and auth.register() forms on the same 
>> page. A simplified version of my code below:
>>
>> def page():
>>     login_form = auth.login()
>>     register_form = auth.register()
>>
>>     return dict(login_form=login_form, register_form=register_form)
>>
>> If you go to the page with both forms, and submit the register form with 
>> errors (such as completely blank), the password field is NOT validated for 
>> the submitted register form!
>>
>> I have a test example here:
>> http://tedlee.pythonanywhere.com/welcome/default/formtest
>>
>> If you define auth.register() first, instead of auth.login(), then this 
>> problem does not appear for register, but there might be problems with 
>> auth.login() (I have not tested this yet).
>>
>> Is this a bug, or is there a proper way to include both login and 
>> register forms on the same page, while having correct server-side 
>> validation?
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to