logo       
Google Custom Search
    AddThis Social Bookmark Button
-->

Re: confirming password with CGI::A::ValidateRM: msg#00007

Subject: Re: confirming password with CGI::A::ValidateRM
Yep - you can do it with the constraint rule ... I did it like this in the Validator hashref:

sub _second_profile {
 return {
  'required'            =>   [ qw( [snip] password password2  ) ],
  'constraints' =>   {
    'password'                  =>   {
        name            =>   'users_passwords',
        constraint      =>   \&check_password,
        params          =>   [ qw( password password2 ) ],
        },
    [snip]
  },
  'msgs'                        =>   {
    'any_errors'        =>   'some_errors',
    'prefix'            =>   'err_',
    constraints         =>   {
      'users_passwords' =>   "Your passwords don't match",
    },
  };
}

And then this easy support method, which could be simplified code-wise:

sub check_password {
        my ( $p1, $p2 ) = @_;
        
        if ( $p1 eq $p2 ) {
                return 1;
        } else {
                return 0;
        }
}

HTH,

Jason

John Day wrote:

Hi,

I am using CGI::Application::ValidateRM in a webapp and i tmust be too late in 
teh week for clear thinking.

I need to do a check on a cofirmation password. You know, the old signup page 
that asks you to confirm the password by retyping it. Is there a simple way of 
doing it within the D::FV profile?

John


---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/cgiapp@xxxxxxxxxxxxxxxxx/
              http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: cgiapp-unsubscribe@xxxxxxxxxxxxxxxxx
For additional commands, e-mail: cgiapp-help@xxxxxxxxxxxxxxxxx


---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/cgiapp@xxxxxxxxxxxxxxxxx/
             http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: cgiapp-unsubscribe@xxxxxxxxxxxxxxxxx
For additional commands, e-mail: cgiapp-help@xxxxxxxxxxxxxxxxx




<Prev in Thread] Current Thread [Next in Thread>