[html-formfu] password element: empty after submission

Jens Schwarz blacky6767 at gmx.de
Tue Nov 11 12:58:32 GMT 2008


-------- Original-Nachricht --------
> Datum: Tue, 11 Nov 2008 09:30:44 +0000
> Von: "Carl Franks" <fireartist at gmail.com>
> An: "HTML Form Creation, 	Rendering and Validation Framework" <html-formfu at lists.scsys.co.uk>
> Betreff: Re: [html-formfu] password element: empty after submission

> (...)
> > Please note the empty value attribute where I espected the user input!
> 
> You're not really checking what was submitted, you're re-rendering the
> form - and for security, password field values aren't returned to the
> browser, by default.

Ah, ok, that makes sense.

> (... Dumper ...)
> If you want password fields to keep their value when you're rendering
> them after a submission, you need to set $field->render_value(1)

That might be an option, right.

> > Any hints on how I can get my password hashed as intended?
> 
> Generally, I would have DBIx::Class handle that, but you could easily
> write a FormFu Filter to do it.

Great! The FormFu-filter-way did its job:

<catalyst root>/root/forms/foobar.yml:

(...)
elements:
  - type: Password
    name: mypass
    label: Enter password
    filters:
      - type: Callback
        callback: <catalyst root>::Controller::somewhere::myhashedpassword
    constraints:
      - type: Equal
        others: mypass_confirm
      - type: Required
(...)

<catalyst root>/lib/MyApp/Controller/somehere.pm:

(...)
sub myhashedpassword {
  my ($value) = @_;
  return sha1_hex($value);
}
(...)

Thanks a lot! :-D
-- 
"Feel free" - 5 GB Mailbox, 50 FreeSMS/Monat ...
Jetzt GMX ProMail testen: http://www.gmx.net/de/go/promail



More information about the HTML-FormFu mailing list