Skip to content

Fix Recaptcha rendering on dynamic forms#21

Open
loleg wants to merge 1 commit into
mainfrom
fix-recaptcha-macro-8929327357394990505
Open

Fix Recaptcha rendering on dynamic forms#21
loleg wants to merge 1 commit into
mainfrom
fix-recaptcha-macro-8929327357394990505

Conversation

@loleg

@loleg loleg commented Jun 20, 2026

Copy link
Copy Markdown
Member

This patch fixes a bug where the Google Captcha was only rendering correctly on the hardcoded login.html form, but failing to render on dynamically generated forms (like register.html and forgot.html) that use the render_form macro.

The root cause was that RecaptchaFields were falling back to the render_input handler within dribdat/templates/macros/_form.html, which injects class_="form-control" and wrapping label tags, breaking the script tags outputted by Flask-WTF for reCAPTCHA.

By adding an explicit check for field.type == 'RecaptchaField' in the render_form loop, the field is now rendered cleanly within a standard <div class="form-group">, solving the rendering issue.


PR created automatically by Jules for task 8929327357394990505 started by @loleg

Explicitly handle RecaptchaField in `render_form` macro to prevent passing it through `render_input`, which adds inappropriate CSS classes (`form-control`) that break the Recaptcha widget rendering. This ensures the captcha is displayed correctly on all forms using the macro (like register and forgot password).

Co-authored-by: loleg <31819+loleg@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

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.

1 participant