def require_login():
"""If the user isn't logged in, raise 403 with an error."""
- if cherrypy.request.login is False:
+ if not cherrypy.request.login:
raise cherrypy.HTTPError(403,
"You are not authorized to access that resource")
environ = cherrypy.request.wsgi_environ
user = environ.get('REMOTE_USER')
if user is None:
+ cherrypy.request.login = None
return
- else:
- cherrypy.request.login = None # clear what cherrypy put there
if environ.get('AUTH_TYPE') == 'Negotiate':
# Convert the krb5 principal into a krb4 username
if not user.endswith('@%s' % config.kerberos.realm):
- cherrypy.request.login = False # failed to login
+ cherrypy.request.login = None
else:
cherrypy.request.login = user.split('@')[0].replace('/', '.')
else: