Reputation: 185
Is it possible to perform specific email validation in cakephp? In my model file, I have
public $validate = array(
'email' => array(
'required' => 'true',
'rule' => array('email', true),
'message'=> 'Please supply a valid email address.')
);
But I want to be able to enforce the constraint that the email address will end in something specific, for example:
@example.com
Any help would be appreciated, thanks.
Upvotes: 0
Views: 1773
Reputation: 3337
You could add a custom one if you are enforcing the constraint on a domain..
public $validate = array(
'login' => array(
'rule' => '/^.+@domain\.com$/i',
'message' => 'This email address must be @domain.com'
)
);
Upvotes: 3