Commit 64c0bb5d authored by Jérome Perrin's avatar Jérome Perrin

oauth_google_login: redirect with a trailing / for ERP5JS

ERP5JS web sites, when accessed with their full path, needs the trailing
slash, so add it before redirecting. This should not be a problem in the
case of xhtml style
parent cbb00275
Pipeline #10219 passed with stage
in 0 seconds
......@@ -36,6 +36,7 @@ elif code is not None:
method = getattr(context, "ERP5Site_createGoogleUserToOAuth", None)
if method is not None:
method(user_reference, user_dict)
return response.redirect(request.get("came_from") or context.absolute_url())
# XXX for ERP5JS web sites without a rewrite rule, we make sure there's a trailing /
return response.redirect(request.get("came_from") or context.absolute_url() + '/')
return handleError('')
......@@ -283,7 +283,9 @@ return credential_request
google_hash = self.portal.REQUEST.RESPONSE.cookies.get("__ac_google_hash")["value"]
self.assertEqual("b01533abb684a658dc71c81da4e67546", google_hash)
self.assertEqual(self.portal.absolute_url(), response)
absolute_url = self.portal.absolute_url()
self.assertNotEqual(absolute_url[-1], '/')
self.assertEqual(absolute_url + '/', response)
cache_dict = self.portal.Base_getBearerToken(google_hash, "google_server_auth_token_cache_factory")
self.assertEqual(CLIENT_ID, cache_dict["client_id"])
self.assertEqual(ACCESS_TOKEN, cache_dict["access_token"])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment