If the postlogin_path is 'login', redirect to '/' instead
Related to #4291173
"""Special authentifiers.:license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses"""__docformat__="restructuredtext en"fromcubicwebimportAuthenticationErrorfromcubicweb.server.sourcesimportnativeclassToken(object):passEXT_TOKEN=Token()classDirectAuthentifier(native.BaseAuthentifier):"""return CWUser eid for the given login. Before doing so, it makes sure the authentication request comes from xxx by checking the special '__externalauth_directauth' kwarg. """auth_rql=('Any U WHERE U is CWUser, ''U eid %(eid)s')defauthenticate(self,session,login,**kwargs):"""Return the CWUser eid for the given login. Make sure the request comes from inside pyramid by checking the special '__pyramid_directauth' kwarg. """session.debug('authentication by %s',self.__class__.__name__)directauth=kwargs.get('__pyramid_directauth',None)try:ifdirectauth==EXT_TOKEN:rset=session.execute(self.auth_rql,{'eid':int(login)})ifrset:session.debug('Successfully identified %s',login)returnrset[0][0]exceptException,exc:session.debug('authentication failure (%s)',exc)raiseAuthenticationError('user is not registered')