Use this validator to ignore accents:
- Put this after sfCoreAutoload::register(); in config/ProjectConfiguration.class.php:
require_once dirname(__FILE__).'/../lib/validator/sfValidatorEmail.class.php';
- Create lib/validator/sfValidatorEmail.class.php with this content:
class sfValidatorEmail extends sfValidatorRegex
{
// const REGEX_EMAIL = '/^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i';
// const REGEX_EMAIL = '/^([^@öüóőúéáűíÖÜÓŐÚÉÁŰÍ\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i';
const REGEX_EMAIL = '/^([A-Z0-9._%+-]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i';
/**
* @see sfValidatorRegex
*/
protected function configure($options = array(), $messages = array())
{
parent::configure($options, $messages);
$this->setOption('pattern', self::REGEX_EMAIL);
}
}
No comments:
Post a Comment