fix: [security] disallow multiple individuals with the same e-mail address
- As reported by Matúš Mikuláš, Adam Gajdošík, Milan Pikula of SK-CERTdevelop-unstable
parent
e0f92aa8e0
commit
a5eb016fc4
|
@ -6,6 +6,8 @@ use App\Model\Table\AppTable;
|
||||||
use Cake\ORM\Table;
|
use Cake\ORM\Table;
|
||||||
use Cake\Validation\Validator;
|
use Cake\Validation\Validator;
|
||||||
use Cake\ORM\Query;
|
use Cake\ORM\Query;
|
||||||
|
use Cake\ORM\RulesChecker;
|
||||||
|
use Cake\Core\Configure;
|
||||||
|
|
||||||
|
|
||||||
class IndividualsTable extends AppTable
|
class IndividualsTable extends AppTable
|
||||||
|
@ -46,6 +48,12 @@ class IndividualsTable extends AppTable
|
||||||
$this->setDisplayField('email');
|
$this->setDisplayField('email');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function buildRules(RulesChecker $rules): RulesChecker
|
||||||
|
{
|
||||||
|
$rules->add($rules->isUnique(['email']));
|
||||||
|
return $rules;
|
||||||
|
}
|
||||||
|
|
||||||
public function validationDefault(Validator $validator): Validator
|
public function validationDefault(Validator $validator): Validator
|
||||||
{
|
{
|
||||||
$validator
|
$validator
|
||||||
|
|
Loading…
Reference in New Issue