From feb973afed12f68dc966280a50344b8b463d60b3 Mon Sep 17 00:00:00 2001 From: Rich Lott / Artful Robot Date: Mon, 2 Oct 2023 17:47:30 +0100 Subject: [PATCH] standalone: correct Capitalised API4 actions --- ext/standaloneusers/Civi/Api4/User.php | 3 --- ext/standaloneusers/ang/crmResetPassword.js | 4 ++-- .../tests/phpunit/Civi/Standalone/SecurityTest.php | 4 ++-- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/ext/standaloneusers/Civi/Api4/User.php b/ext/standaloneusers/Civi/Api4/User.php index 7d5f6b67e9..a013da7269 100644 --- a/ext/standaloneusers/Civi/Api4/User.php +++ b/ext/standaloneusers/Civi/Api4/User.php @@ -59,9 +59,6 @@ class User extends Generic\DAOEntity { 'default' => ['access CiviCRM'], 'passwordReset' => ['access password resets'], 'sendPasswordReset' => ['access password resets'], - - 'PasswordReset' => ['access password resets'], - 'SendPasswordReset' => ['access password resets'], ]; } diff --git a/ext/standaloneusers/ang/crmResetPassword.js b/ext/standaloneusers/ang/crmResetPassword.js index a32b93213f..2d5db04fd4 100644 --- a/ext/standaloneusers/ang/crmResetPassword.js +++ b/ext/standaloneusers/ang/crmResetPassword.js @@ -43,7 +43,7 @@ alert(ts('Please provide your username/email.')); return; } - crmApi4('User', 'SendPasswordReset', { identifier: ctrl.identifier }) + crmApi4('User', 'sendPasswordReset', { identifier: ctrl.identifier }) .then(r => { updateAngular('busy', ''); updateAngular('resetSuccessfullySubmitted', true); @@ -101,7 +101,7 @@ updateAngular('busy', ctrl.busy + ts('Changing...')); updateAngular('formSubmitted', true); // Now submit api request. - return crmApi4('User', 'PasswordReset', { + return crmApi4('User', 'passwordReset', { token: ctrl.token, password: ctrl.newPassword, }) diff --git a/ext/standaloneusers/tests/phpunit/Civi/Standalone/SecurityTest.php b/ext/standaloneusers/tests/phpunit/Civi/Standalone/SecurityTest.php index 29a74ee8cd..d22c669a22 100644 --- a/ext/standaloneusers/tests/phpunit/Civi/Standalone/SecurityTest.php +++ b/ext/standaloneusers/tests/phpunit/Civi/Standalone/SecurityTest.php @@ -394,7 +394,7 @@ class SecurityTest extends \PHPUnit\Framework\TestCase implements EndToEndInterf $token = \Civi\Api4\Action\User\SendPasswordReset::updateToken($userID); // Attempt to change the user's password using this token to authenticate. - $result = User::PasswordReset(TRUE) + $result = User::passwordReset(TRUE) ->setToken($token) ->setPassword('fingersCrossed') ->execute(); @@ -405,7 +405,7 @@ class SecurityTest extends \PHPUnit\Framework\TestCase implements EndToEndInterf // Should not work a 2nd time with same token. try { - User::PasswordReset(TRUE) + User::passwordReset(TRUE) ->setToken($token) ->setPassword('oooh') ->execute(); -- 2.25.1