dpgaspar commented on code in PR #37773:
URL: https://github.com/apache/superset/pull/37773#discussion_r2782209176
##########
superset/security/manager.py:
##########
@@ -3022,6 +3022,24 @@ def register_views(self) -> None:
) in ["/roles", "/users", "/groups", "registrations"]:
self.appbuilder.baseviews.remove(view)
+ # When legacy FAB password views are disabled, unregister their routes
+ # so direct URL access to /superset/resetpassword and
/superset/resetmypassword
+ # is no longer possible (SPA handles password changes post-porting).
+ if not current_app.config.get("ENABLE_LEGACY_FAB_PASSWORD_VIEWS",
False):
+ from flask_appbuilder.security.views import (
+ ResetMyPasswordView,
+ ResetPasswordView,
+ )
+
+ for view in list(self.appbuilder.baseviews):
+ if isinstance(view, (ResetPasswordView, ResetMyPasswordView)):
+ blueprint = getattr(view, "blueprint", None)
+ if blueprint is not None and hasattr(
+ current_app, "unregister_blueprint"
+ ):
+ current_app.unregister_blueprint(blueprint)
+ self.appbuilder.baseviews.remove(view)
Review Comment:
A simple PR on FAB would make this way cleaner. We could add a new FAB
config to not register certain security views, similar to:
`FAB_ADD_SECURITY_VIEWS`, `FAB_ADD_SECURITY_PERMISSION_VIEW`,
`FAB_ADD_SECURITY_VIEW_MENU_VIEW`, `FAB_ADD_SECURITY_PERMISSION_VIEWS_VIEW`
--
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]