mirror of https://github.com/MISP/MISP
chg: [user] Relaxed email validation rule
parent
7226b1371f
commit
6f85e3e39d
|
@ -65,13 +65,10 @@ class User extends AppModel
|
|||
),
|
||||
),
|
||||
'email' => array(
|
||||
'email' => array(
|
||||
'rule' => array('email'),
|
||||
'message' => 'Please enter a valid email address.',
|
||||
//'allowEmpty' => false,
|
||||
'emailValidation' => array(
|
||||
'rule' => array('validateEmail'),
|
||||
'message' => 'Please nter a valid email address.',
|
||||
'required' => true,
|
||||
//'last' => false, // Stop validation after this rule
|
||||
//'on' => 'create', // Limit validation to 'create' or 'update' operations
|
||||
),
|
||||
'unique' => array(
|
||||
'rule' => 'isUnique',
|
||||
|
@ -386,6 +383,16 @@ class User extends AppModel
|
|||
return true;
|
||||
}
|
||||
|
||||
public function validateEmail($check)
|
||||
{
|
||||
$localPartReg = '[\p{L}0-9!#$%&\'*+\/=?^_`{|}~-]+(?:\.[\p{L}0-9!#$%&\'*+\/=?^_`{|}~-]+)*@';
|
||||
$domainReg = '[a-z0-9_\-\.]+';
|
||||
$fullReg = sprintf('/^%s%s$/ui', $localPartReg, $domainReg);
|
||||
$check = array_values($check);
|
||||
$check = $check[0];
|
||||
return preg_match($fullReg, $check, $matches) ? true : false;
|
||||
}
|
||||
|
||||
/*
|
||||
default password:
|
||||
6 characters minimum
|
||||
|
|
Loading…
Reference in New Issue