[Buildbot-commits] [Buildbot] #2400: Logging in does not clear "Authentication failed" message

Buildbot nobody at buildbot.net
Sat Dec 15 19:45:38 UTC 2012


#2400: Logging in does not clear "Authentication failed" message
-------------------+--------------------
Reporter:  dank    |       Owner:
    Type:  defect  |      Status:  new
Priority:  minor   |   Milestone:  0.8.8
 Version:  0.8.7   |  Resolution:
Keywords:  web     |
-------------------+--------------------

Comment (by dustin):

 For posterity, that pastie contains:
 {{{
 !patch
 diff --git a/master/buildbot/status/web/auth.py
 b/master/buildbot/status/web/auth.py
 index e9b168c..1577dd5 100644
 --- a/master/buildbot/status/web/auth.py
 +++ b/master/buildbot/status/web/auth.py
 @@ -183,7 +183,8 @@ class AuthFailResource(HtmlResource):

      def content(self, request, cxt):
          templates =request.site.buildbot_service.templates
 -        template = templates.get_template("authfail.html")
 +        template = templates.get_template("authfail.html")
 +        cxt['referer'] =request.requestHeaders.getRawHeaders('referer')
          return template.render(**cxt)

  class AuthzFailResource(HtmlResource):
 @@ -196,16 +197,23 @@ class AuthzFailResource(HtmlResource):

  class LoginResource(ActionResource):

 +    originalPage = None
      def performAction(self, request):
          authz = self.getAuthz(request)
          d = authz.login(request)
          def on_login(res):
              if res:
 +                if originalPage is not None:
 +                    # Nullify originalPage to be assigned url on next
 login failure
 +                    originalPage = None
                  status = request.site.buildbot_service.master.status
                  root = status.getBuildbotURL()
                  return request.requestHeaders.getRawHeaders('referer',
                                                              [root])[0]
              else:
 +                if originalPage is None:
 +                    # Preserve url of the Original Page/Referer
 +                    originalPage =
 request.requestHeaders.getRawHeaders('referer')
                  return path_to_authfail(request)
          d.addBoth(on_login)
          return d
 diff --git a/master/buildbot/status/web/templates/authfail.html
 b/master/buildbot/status/web/templates/authfail.html
 index bae600f..bad1f35 100644
 --- a/master/buildbot/status/web/templates/authfail.html
 +++ b/master/buildbot/status/web/templates/authfail.html
 @@ -5,7 +5,8 @@
  <h1>Authentication Failed</h1>

  <p>The username or password you entered were not correct.
 -   Please go back and try again.
 +   Click here to go back and try again.
 +   <a href="{{ referer }}">back</a>
  </p>

  {% endblock %}
 }}}

-- 
Ticket URL: <http://trac.buildbot.net/ticket/2400#comment:6>
Buildbot <http://buildbot.net/>
Buildbot: build/test automation


More information about the Commits mailing list