Ignore:
Timestamp:
12 Oct 2023, 21:45:55 (15 months ago)
Author:
Henrik Bettermann
Message:

Customize LoginPage? to redirect to request_webservice instead of showing the login page.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/browser/pages.py

    r16508 r17611  
    2626    SessionConfigurationManageFormPage,
    2727    ConfigurationContainerManageFormPage,
    28     SourcesOverview)
     28    SourcesOverview, LoginPage)
    2929from waeup.kofa.browser.layout import KofaPage
    3030from kofacustom.nigeria.interfaces import (
     
    3333    ICustomSessionConfigurationAdd)
    3434from kofacustom.nigeria.interfaces import MessageFactory as _
     35
     36class NigeriaLoginPage(LoginPage):
     37    """A login page, available for all objects.
     38    """
     39
     40    def update(self, SUBMIT=None, camefrom=None, login=None, password=None):
     41
     42        # Redirect to camefrom if user is still logged in. Don't show login page.
     43        if camefrom and 'request_webservice' in camefrom and \
     44            self.request.principal.id != 'zope.anybody':
     45            self.redirect(self.application_url() + camefrom)
     46            return
     47
     48        super(NigeriaLoginPage, self).update(SUBMIT, camefrom, login, password)
     49
    3550
    3651class NigeriaSourcesOverview(SourcesOverview):
Note: See TracChangeset for help on using the changeset viewer.