Skip to content

Fix captcha on login page - #623

Merged
GuillaumeRoques merged 1 commit into
MediaArea:masterfrom
GuillaumeRoques:add-captcha-fix
Aug 14, 2026
Merged

GuillaumeRoques merged 1 commit into
MediaArea:masterfrom
GuillaumeRoques:add-captcha-fix

Conversation

@GuillaumeRoques

Copy link
Copy Markdown
Contributor

No description provided.

Signed-off-by: Guillaume Roques <guillaume.roques@gmail.com>
Copilot AI lite review requested due to automatic review settings August 14, 2026 09:11
@GuillaumeRoques
GuillaumeRoques merged commit 5feecdf into MediaArea:master Aug 14, 2026
1 check passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to fix login-page CAPTCHA enforcement by ensuring the invisible reCAPTCHA flow actually submits the login form on success and by validating the reCAPTCHA token server-side before the security check proceeds.

Changes:

  • Register a LoginCaptchaSubscriber service to verify g-recaptcha-response on fos_user_security_check POST requests.
  • Update the login reCAPTCHA widget configuration to use a callback and add a JS handler that submits the form on success.
  • Add a form id/class hook needed for the callback-driven submit.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/UserBundle/Resources/config/services.yml Registers the login CAPTCHA kernel event subscriber and wires required arguments.
src/UserBundle/EventSubscriber/LoginCaptchaSubscriber.php Replaces EWZ form-based validation with direct server-side verification using ReCaptcha\ReCaptcha.
src/UserBundle/Controller/SecurityController.php Adds the reCAPTCHA callback option for the invisible widget.
app/Resources/FOSUserBundle/views/Security/login_content.html.twig Defines the callback JS and adds id/class to the login form for submission on CAPTCHA success.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +48 to +50
$recaptcha = new ReCaptcha($this->privateKey);
$recaptcha->setExpectedHostname($request->getHost());
$response = $recaptcha->verify($request->request->get('g-recaptcha-response'), $request->getClientIp());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants