[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cgiapp] 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/suppressed/
              http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed


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


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.