Example #1
0
    def update(self):
        # Register the PAU as a local utility
        installer = ISiteLocalInstaller(self.context)

        installer.registerUtility(PluggableAuthenticatorPlugin,
                                  provided=IAuthentication,
                                  name_in_container='pau')

        installer.registerUtility(AuthenticatorPlugin,
                                  provided=IAuthenticatorPlugin,
                                  name='users')
Example #2
0
    def handle_login(self, **data):
        ''' If the authentication plugins are not yet installed, install them
        '''
        pau = queryUtility(IAuthentication)
        if pau is None or type(pau) is not PluggableAuthenticatorPlugin:
            installer = ISiteLocalInstaller(grok.getSite())

            installer.registerUtility(PluggableAuthenticatorPlugin,
                                      provided=IAuthentication,
                                      name_in_container='pau')

            installer.registerUtility(AuthenticatorPlugin,
                                      provided=IAuthenticatorPlugin,
                                      name='users')
            pau = queryUtility(IAuthentication)
            if pau is not None: pau.authenticate(self.request)
            self.redirect(self.url(self.context, data=data))