[html-formfu] Constraint for salted hash password
Christian Lackas
christian at lackas.net
Fri Feb 27 11:45:05 GMT 2009
* Moritz Onken <onken at houseofdesign.de> [090227 11:15]:
Hi Moritz,
> > My idea was to have this in my form.yml:
> >
> > - type: Password
> > name: password_old
> > label: Old password
> > filters:
> > - type: Callback
> > callback: MyApp::Utils::hashpassword
> > constraint:
> > - type: Set
> > message: Password does not match
> You can try to create a Transformer. This one is called after a constraint
> is checked.
Found the problem, after digging some more through the documentation:
[ in Controller, which known $user ]
$field->validator('Callback')->callback( sub {
return Crypt::SaltedHash->validate($user->password, shift);
});
One more question, how do I set a custom message? I use
- type: Password
name: password_old
label: Old password
validator:
- type: Callback
message: Password does not match
together with above line, but that does not really help (works for
constraints, though). Still just says 'Validator error'.
Christian
More information about the HTML-FormFu
mailing list