Hashing input values from form.

Hello,

I validating form input password:

but values doesnt matching:

I think, that password_confirm is hashed , and password value not.

How could i hashed password value from input?

Thanks for any reply..


  'password' => array(
            'empty' => array(
                'rule'      => 'notEmpty',
                'message'   => 'Must not be blank',
                'required'  => true,
            ),
        ),
	 'password_confirm' => array(
            'compare'    => array(
                'rule'      => array('password_match', 'password', true),
                'message'   => 'The password you entered does not match',
                'required'  => true,
            ),
        ),

    function password_match($data, $password_field, $hashed = true)
    {
        $password         = $this->data[$this->alias][$password_field];
        $keys             = array_keys($data);
        $password_confirm = $hashed ?
              Security::hash($data[$keys[0]], null, true) :
              $data[$keys[0]];
        return $password === $password_confirm;
    }
	

Asked by blacksymmetry, on 8/2/10

1 Answer

here is how i did it, seems a bit simpler

http://github.com/infinitas/infinitas/blob/dev-rmac/infinitas/management/models/user.php#L93

Answered by dogmatic69on 8/2/10

<< previous next >>

Your Answer

You can use Creole Wiki Syntax to format your text.

Tagged with

Rating

0

Viewed

211 times

Last Activity

on 8/2/10