Skip to content

Commit

Permalink
Split rule name for the Rule Checker
Browse files Browse the repository at this point in the history
When registering a new user after registering a first, we get an error for "A rule with the same name already exists in /web/geoviz2/vendor/cakephp/cakephp/src/Datasource/RulesChecker.php on line 428". This fixes.
  • Loading branch information
umer936 authored Oct 28, 2024
1 parent 85f055d commit b1c6370
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Model/Table/UsersTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,13 +197,13 @@ public function validationRegister(Validator $validator)
*/
public function buildRules(RulesChecker $rules): RulesChecker
{
$rules->add($rules->isUnique(['username']), '_isUnique', [
$rules->add($rules->isUnique(['username']), '_isUniqueUsername', [
'errorField' => 'username',
'message' => __d('cake_d_c/users', 'Username already exists'),
]);

if ($this->isValidateEmail) {
$rules->add($rules->isUnique(['email']), '_isUnique', [
$rules->add($rules->isUnique(['email']), '_isUniqueEmail', [
'errorField' => 'email',
'message' => __d('cake_d_c/users', 'Email already exists'),
]);
Expand Down

0 comments on commit b1c6370

Please sign in to comment.