Skip to content

Instantly share code, notes, and snippets.

@housni
Created February 13, 2012 18:41
Show Gist options
  • Save housni/1818975 to your computer and use it in GitHub Desktop.
Save housni/1818975 to your computer and use it in GitHub Desktop.
<?php
//extensions/data/Model.php
public static function __init() {
static::_isBase(__CLASS__, true);
parent::__init();
//static::all(); //doesn't work
#$self = static::_object();
#static::config();
//check to see if passwords match
Validator::add('passwordVerification', function($value, $rule, $options) {
/**
* If password2 does not exist, that means a form without a password2 field was submitted.
* If such a form was submitted, it's safe to assumed we don't need to match the passwords.
*/
if(!isset($options['values']['password2'])) {
return true;
}
if (Password::check($options['values']['password2'], $options['values']['password'])) {
return true;
}
return false;
});
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment