Copilot commented on code in PR #36857:
URL: https://github.com/apache/superset/pull/36857#discussion_r2673599656
##########
superset/views/base.py:
##########
@@ -479,7 +479,11 @@ def cached_common_bootstrap_data( # pylint:
disable=unused-argument
auth_type = app.config["AUTH_TYPE"]
auth_user_registration = app.config["AUTH_USER_REGISTRATION"]
frontend_config["AUTH_USER_REGISTRATION"] = auth_user_registration
- should_show_recaptcha = auth_user_registration and (auth_type !=
AUTH_OAUTH)
+ should_show_recaptcha = (
+ auth_user_registration
+ and (auth_type != AUTH_LDAP)
+ and (auth_type != AUTH_OAUTH)
Review Comment:
The multiple inequality checks can be simplified using a membership test.
Consider refactoring to: `auth_user_registration and auth_type not in
(AUTH_LDAP, AUTH_OAUTH)`. This improves readability and makes it easier to add
additional auth types in the future.
```suggestion
and auth_type not in (AUTH_LDAP, AUTH_OAUTH)
```
##########
superset/views/base.py:
##########
@@ -479,7 +479,11 @@ def cached_common_bootstrap_data( # pylint:
disable=unused-argument
auth_type = app.config["AUTH_TYPE"]
auth_user_registration = app.config["AUTH_USER_REGISTRATION"]
frontend_config["AUTH_USER_REGISTRATION"] = auth_user_registration
- should_show_recaptcha = auth_user_registration and (auth_type !=
AUTH_OAUTH)
+ should_show_recaptcha = (
+ auth_user_registration
+ and (auth_type != AUTH_LDAP)
+ and (auth_type != AUTH_OAUTH)
+ )
Review Comment:
The updated logic for disabling reCAPTCHA with LDAP authentication lacks
test coverage. Consider adding test cases to verify that
`should_show_recaptcha` correctly returns False when AUTH_TYPE is AUTH_LDAP,
and that RECAPTCHA_PUBLIC_KEY is not included in the frontend configuration for
LDAP setups.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]