jayvenn21 commented on code in PR #37773:
URL: https://github.com/apache/superset/pull/37773#discussion_r2776739780


##########
superset/security/manager.py:
##########
@@ -3022,6 +3022,21 @@ 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)):
+                    if getattr(view, "blueprint", None) is not None:
+                        current_app.unregister_blueprint(view.blueprint)

Review Comment:
   Good catch, thanks for flagging this.
   
   I've updated the logic to guard the call behind a `hasattr(current_app, 
"unregister_blueprint")`
   check so this remains safe across Flask versions that don't expose that 
method.



-- 
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]

Reply via email to