Render the captcha field on the login and register pages - #1297
Merged
swainn merged 3 commits intoAug 17, 2026
Conversation
PR tethysplatform#1293 replaced whole-form rendering with an explicit list of fields in order to hide the labels. Enumerating the fields dropped the captcha, which is not one of them. With ENABLE_CAPTCHA enabled the field is still required by LoginForm and RegisterForm, so every submission fails validation on a field the page never rendered and the form simply re-renders. That locks all users out of a portal that has captcha turned on. Render the field when the form has one. get_captcha returns None when ENABLE_CAPTCHA is off, in which case the form has no such field and bootstrap_field would raise, so the tag is guarded. The gap was untested in both directions: the account view tests mock render and get_template, and the form tests never render a template. Adds tests that render both pages with captcha enabled and disabled.
swainn
approved these changes
Aug 17, 2026
romer8
force-pushed
the
fix/render-captcha-on-login-register
branch
from
August 17, 2026 20:58
5b5a3b8 to
697ee0e
Compare
swainn
approved these changes
Aug 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
#1293 switched the login and register forms to an explicit field list to hide labels, which dropped the captcha. With
ENABLE_CAPTCHAenabled the field is still required but never rendered, so every submission fails validation and the page re-renders, locking users out. Released in 4.6.0.Changes Made to Code
form.captcha, guarded sinceget_captcha()returnsNonewhen disabled.