Fix Recaptcha rendering on dynamic forms#21
Conversation
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>
|
👋 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 New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
This patch fixes a bug where the Google Captcha was only rendering correctly on the hardcoded
login.htmlform, but failing to render on dynamically generated forms (likeregister.htmlandforgot.html) that use therender_formmacro.The root cause was that
RecaptchaFields were falling back to therender_inputhandler withindribdat/templates/macros/_form.html, which injectsclass_="form-control"and wrapping label tags, breaking the script tags outputted byFlask-WTFfor reCAPTCHA.By adding an explicit check for
field.type == 'RecaptchaField'in therender_formloop, 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