Alright, I think I got this figured out. Issue is 2-fold. First, IS_LENGTH 
validator is executed after CRYPT() runs, so it fails. Moving IS_LENGTH to 
the array position before CRYPT() and changing password2 validator to 
... requires=IS_EQUAL_TO(request.vars.password) ... causes things to work.


On Monday, January 7, 2013 10:47:47 PM UTC+8, weheh wrote:
>
> After upgrading to 2.3.2, my custom user registration breaks. I have 
> auth_user password encoded as follows in my user's model:
> ...
>     Field('password', 'password',
>         readable=False,
>         label=T('Password'),
>         requires=[CRYPT(), IS_LENGTH(512, 6)],
>         ),
> ...
>
> During registration, I create the register_form like so in my controller:
>
>     register_form = SQLFORM.factory(
> ...
>             db.auth_user.password,
>             Field('password2', 'password',
>                 label=T(Verify password'),
>                 requires=db.auth_user.password.requires,
>                 ),
> ...
>             )
>
>
> During form acceptance, the form is validated by this:
>
> def validate_registration(form):
>  ...
>     if form.vars.password != form.vars.password2:
>         form.errors.password = form.errors.password2 = T(
>             'Passwords do not match')
> ...
>     return form
>
> The problem is the passwords aren't the same. I'm assuming the problem is 
> the requires=CRYPT(), which actually encrypts the password twice, producing 
> two different results for password and password2. How would I  get CRYPT() 
> to product the same result for both passwords? Do I need to pass in the 
> hmac_key or salt? Or not run CRYPT() at all?
>

-- 



Reply via email to