Skip to content

Commit b4414d9

Browse files
committed
ACP2E-3300: Captcha on admin login does not require interaction for some users
1 parent 8e3e9de commit b4414d9

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

ReCaptchaUser/Test/Integration/LoginFormTest.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,36 @@ public function testPostRequestIfReCaptchaParameterIsMissed(): void
156156
$this->checkFailedPostResponse();
157157
}
158158

159+
/**
160+
* @magentoAdminConfigFixture admin/security/use_form_key 0
161+
* @magentoAdminConfigFixture admin/captcha/enable 0
162+
* @magentoAdminConfigFixture recaptcha_backend/type_invisible/public_key test_public_key
163+
* @magentoAdminConfigFixture recaptcha_backend/type_invisible/private_key test_private_key
164+
* @magentoAdminConfigFixture recaptcha_backend/type_for/user_login invisible
165+
*/
166+
public function testPostRequestIfReCaptchaParameterIsMissedWithRef(): void
167+
{
168+
$postValues = [];
169+
$this->getRequest()
170+
->setMethod(Http::METHOD_POST)
171+
->setPostValue(array_replace_recursive(
172+
[
173+
'form_key' => $this->formKey->getFormKey(),
174+
'login' => [
175+
'username' => Bootstrap::ADMIN_NAME,
176+
'password' => Bootstrap::ADMIN_PASSWORD,
177+
],
178+
],
179+
$postValues
180+
));
181+
$this->dispatch('backend/admin/dashboard/index');
182+
$this->assertSessionMessages(
183+
self::equalTo(['Something went wrong with reCAPTCHA. Please contact the store owner.']),
184+
MessageInterface::TYPE_ERROR
185+
);
186+
self::assertFalse($this->auth->isLoggedIn());
187+
}
188+
159189
/**
160190
* @magentoAdminConfigFixture admin/security/use_form_key 0
161191
* @magentoAdminConfigFixture admin/captcha/enable 0

0 commit comments

Comments
 (0)