开发者

Make Plone give proper 403 Forbidden errors

开发者 https://www.devze.com 2023-03-13 12:42 出处:网络
Default Plone behavior is to display login box when the user tries to access content f开发者_如何学Pythonor which he or she does not have permission.

Default Plone behavior is to display login box when the user tries to access content f开发者_如何学Pythonor which he or she does not have permission.

How to change this behavior so that instead and Unauthorized page is displayed? How to customize this unauthorized page to have custom texts. etc?


PAS responds to a 401 Unauthorized error by invoking any challenge plugins, so to avoid the login form deactivate these plugins in acl_users.

A 403 Forbidden should not result in a challenge. However in production mode (but not debug mode) these errors are hidden and they are transformed into 404 Not Found.


Customize this template: Products.CMFPlone/Products/CMFPlone/skins/plone_login/require_login.py, either via "old style" skin customization or "new style" jbot customization: http://pypi.python.org/pypi/z3c.jbot (see CMF Objects section)


FYI, there's now also a PAS plugin that only redirects to login form if the UA is a browser:

https://pypi.python.org/pypi/koodaamo.pas.browseronlyredirect/

0

精彩评论

暂无评论...
验证码 换一张
取 消