Skip to content

Commit

Permalink
Merge pull request #77 from eea/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
erral authored Feb 13, 2023
2 parents 8dd057e + ecc8c45 commit 190329a
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 7 deletions.
20 changes: 20 additions & 0 deletions clms/addon/browser/loginview.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

from DateTime import DateTime
from pas.plugins.oidc.browser.view import CallbackView as BaseCallbackView
from pas.plugins.oidc.browser.view import LoginView as BaseLoginView
from pas.plugins.oidc.browser.view import Session
from plone import api
from plone.protect.interfaces import IDisableCSRFProtection
Expand All @@ -24,6 +25,25 @@ def return_url(self, session):
return "{}/my-custom-callback".format(self.context.absolute_url())


class LoginView(BaseLoginView):
"""Override of Login view to avoid Timeout and other errors from EU Login
services
"""

def __call__(self):
"""custom __call__ method"""
try:
return super().__call__()
except Exception as e:
log = getLogger(__name__)
log.info("There was an error handling the login process")
log.exception(e)
self.request.response.setHeader(
"Cache-Control", "no-cache, must-revalidate"
)
return self.request.response.redirect("/")


class MyCallBack(BrowserView):
"""Custom callback view"""

Expand Down
20 changes: 14 additions & 6 deletions clms/addon/browser/overrides.zcml
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:browser="http://namespaces.zope.org/browser"
i18n_domain="clms">
xmlns="http://namespaces.zope.org/zope"
xmlns:browser="http://namespaces.zope.org/browser"
i18n_domain="clms"
>

<browser:page
for="pas.plugins.oidc.plugins.IOIDCPlugin"
name="callback"
for="pas.plugins.oidc.plugins.IOIDCPlugin"
class=".loginview.CallbackView"
permission="zope2.View"
layer="pas.plugins.oidc.interfaces.IPasPluginsOidcLayer"
/>


<browser:page
for="*"
name="login"
for="pas.plugins.oidc.plugins.IOIDCPlugin"
class=".loginview.LoginView"
permission="zope2.View"
layer="pas.plugins.oidc.interfaces.IPasPluginsOidcLayer"
/>

<browser:page
name="send_mail_template"
for="*"
template="send_mail_template.pt"
permission="zope2.View"
/>
Expand Down
2 changes: 1 addition & 1 deletion clms/addon/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.3
7.4
5 changes: 5 additions & 0 deletions docs/HISTORY.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Changelog
=========

7.4 - (2023-02-13)
---------------------------
* Change: Develop
[erral]

7.3 - (2023-02-13)
---------------------------
* Change: Develop
Expand Down

0 comments on commit 190329a

Please sign in to comment.