File tree Expand file tree Collapse file tree 2 files changed +22
-2
lines changed
flask_appbuilder/security Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -813,13 +813,13 @@ def register_views(self):
813813 if self .registeruser_view :
814814 self .appbuilder .add_view_no_menu (self .registeruser_view )
815815
816- self .appbuilder .add_view_no_menu (self .resetpasswordview ())
817- self .appbuilder .add_view_no_menu (self .resetmypasswordview ())
818816 self .appbuilder .add_view_no_menu (self .userinfoeditview ())
819817
820818 if self .auth_type == AUTH_DB :
821819 self .user_view = self .userdbmodelview
822820 self .auth_view = self .authdbview ()
821+ self .appbuilder .add_view_no_menu (self .resetpasswordview ())
822+ self .appbuilder .add_view_no_menu (self .resetmypasswordview ())
823823
824824 elif self .auth_type == AUTH_LDAP :
825825 self .user_view = self .userldapmodelview
Original file line number Diff line number Diff line change @@ -695,6 +695,26 @@ def test_oauth_user_info_auth0(self):
695695 },
696696 )
697697
698+ def test_reset_password_view_not_registered_with_oauth (self ):
699+ """
700+ OAUTH: test that ResetMyPasswordView is not registered when using OAuth
701+ authentication
702+ """
703+ self .appbuilder = AppBuilder (self .app , self .db .session )
704+
705+ for view in self .appbuilder .baseviews :
706+ if view .__class__ .__name__ == "ResetMyPasswordView" :
707+ self .fail (
708+ "ResetMyPasswordView should not be registered when using OAuth "
709+ "authentication"
710+ )
711+
712+ # Also verify that the view is not accessible via URL
713+ with self .app .test_client () as client :
714+ response = client .get ("/resetmypassword/form" )
715+ # Should return 404 since the view is not registered
716+ self .assertEqual (response .status_code , 404 )
717+
698718
699719class OAuthAuthentikTestCase (unittest .TestCase ):
700720 def setUp (self ):
You can’t perform that action at this time.
0 commit comments