fix: [security] disallow multiple individuals with the same e-mail address

- As reported by Matúš Mikuláš, Adam Gajdošík, Milan Pikula of SK-CERT
develop-unstable
iglocska 2023-01-03 15:30:26 +01:00
parent e0f92aa8e0
commit a5eb016fc4
No known key found for this signature in database
GPG Key ID: BEA224F1FEF113AC
1 changed files with 8 additions and 0 deletions

View File

@ -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