mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-04 01:01:41 +09:00
Fix #2313 inconsistent email validation rules
This commit is contained in:
parent
61a0cf38c3
commit
848a45cabe
3 changed files with 13 additions and 3 deletions
|
|
@ -211,10 +211,18 @@ class Mail extends Rhymix\Framework\Mail
|
|||
* Check if param is a valid email or not
|
||||
*
|
||||
* @param string $email_address Email address to check
|
||||
* @param bool $restrictive
|
||||
* @return string
|
||||
*/
|
||||
public static function isVaildMailAddress($email_address)
|
||||
public static function isVaildMailAddress($email_address, $restrictive = true)
|
||||
{
|
||||
// Restrictive mode
|
||||
if ($restrictive)
|
||||
{
|
||||
return preg_match('/^[\w-]+((?:\.|\+|\~)[\w-]+)*@[\w-]+(\.[\w-]+)+$/', $email_address) ? $email_address : '';
|
||||
}
|
||||
|
||||
// RFC mode
|
||||
$validator = new \Egulias\EmailValidator\EmailValidator;
|
||||
$rfc = new \Egulias\EmailValidator\Validation\RFCValidation;
|
||||
if($validator->isValid($email_address, $rfc))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue