From b1c6370bb2806a67988e4ce27265974907fe27f4 Mon Sep 17 00:00:00 2001 From: Umer Salman Date: Mon, 28 Oct 2024 11:28:05 -0500 Subject: [PATCH] Split rule name for the Rule Checker 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. --- src/Model/Table/UsersTable.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Model/Table/UsersTable.php b/src/Model/Table/UsersTable.php index 353b43cf..5f176492 100644 --- a/src/Model/Table/UsersTable.php +++ b/src/Model/Table/UsersTable.php @@ -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'), ]);