def do_login(self, username, password, from_page='..', **kwargs):
        """Login.

        May raise redirect, or return True if request handled.
        """
        response = cherrypy.serving.response
        error_msg = self.check_username_and_password(username, password)
        if error_msg:
            body = self.login_screen(from_page, username, error_msg)
            response.body = body
            if 'Content-Length' in response.headers:
                # Delete Content-Length header so finalize() recalcs it.
                del response.headers['Content-Length']
            return True
        else:
            cherrypy.serving.request.login = username
            cherrypy.session[self.session_key] = username
            self.on_login(username)
            raise cherrypy.HTTPRedirect(from_page or '/')
Login.

        May raise redirect, or return True if request handled.
        
cherrypy/lib/cptools.py