Skip to content

Commit

Permalink
apply suggested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jugmac00 committed May 8, 2021
1 parent dc6db7f commit 4678502
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
9 changes: 4 additions & 5 deletions src/Products/PluggableAuthService/plugins/CookieAuthHelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
from AccessControl.class_init import InitializeClass
from AccessControl.Permissions import view
from AccessControl.SecurityInfo import ClassSecurityInfo
from Acquisition import aq_inner
from Acquisition import aq_parent
from OFS.Folder import Folder
from Products.PageTemplates.PageTemplateFile import PageTemplateFile
from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate
Expand Down Expand Up @@ -282,11 +284,8 @@ def login(self):
# - the administrator did not setup the login form properly
# - the user manipulated the login form and removed `came_from`
# Still, the user provided correct credentials and is logged in.
return (
'<h1>You have been logged in successfully.</h1>\n'
'<p>Unfortunately, we do not know where to redirect you to.</p>'
'<p>If you need help, please ask the site\'s administrator.</p>'
)
pas_root = aq_parent(aq_inner(self._getPAS()))
return response.redirect(pas_root.absolute_url())


classImplements(CookieAuthHelper, ICookieAuthHelper,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,14 +211,6 @@ def test_loginWithoutCredentialsUpdate(self):
helper.login()
self.assertEqual(len(response.cookies), 0)

def test_login_with_missing_came_from(self):
helper = self._makeOne()
response = FauxCookieResponse()
request = FauxSettableRequest(RESPONSE=response)
helper.REQUEST = request
rv = helper.login()
self.assertIn('You have been logged in successfully.', rv)

def test_extractCredentials_from_cookie_with_colon_in_password(self):
# http://www.zope.org/Collectors/PAS/51
# Passwords with ":" characters broke authentication
Expand Down

0 comments on commit 4678502

Please sign in to comment.