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\Validation\Validator;
|
||||
use Cake\ORM\Query;
|
||||
use Cake\ORM\RulesChecker;
|
||||
use Cake\Core\Configure;
|
||||
|
||||
|
||||
class IndividualsTable extends AppTable
|
||||
|
@ -46,6 +48,12 @@ class IndividualsTable extends AppTable
|
|||
$this->setDisplayField('email');
|
||||
}
|
||||
|
||||
public function buildRules(RulesChecker $rules): RulesChecker
|
||||
{
|
||||
$rules->add($rules->isUnique(['email']));
|
||||
return $rules;
|
||||
}
|
||||
|
||||
public function validationDefault(Validator $validator): Validator
|
||||
{
|
||||
$validator
|
||||
|
|
Loading…
Reference in New Issue