Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Lukas Niegsch
erp5
Commits
8c33379a
Commit
8c33379a
authored
Sep 06, 2018
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_oauth_facebook_login: fix test failure, describe the #_=_ hack
/reviewed-on
nexedi/erp5!739
parent
807701f2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
1 deletion
+7
-1
bt5/erp5_oauth_facebook_login/SkinTemplateItem/portal_skins/erp5_oauth_facebook_login/ERP5Site_callbackFacebookLogin.py
...p5_oauth_facebook_login/ERP5Site_callbackFacebookLogin.py
+5
-0
bt5/erp5_oauth_facebook_login/TestTemplateItem/portal_components/test.erp5.testFacebookLogin.py
...lateItem/portal_components/test.erp5.testFacebookLogin.py
+2
-1
No files found.
bt5/erp5_oauth_facebook_login/SkinTemplateItem/portal_skins/erp5_oauth_facebook_login/ERP5Site_callbackFacebookLogin.py
View file @
8c33379a
...
@@ -40,6 +40,11 @@ elif code is not None:
...
@@ -40,6 +40,11 @@ elif code is not None:
if
method
is
not
None
:
if
method
is
not
None
:
method
(
user_reference
,
user_dict
)
method
(
user_reference
,
user_dict
)
# We intentionnally add this # to the URL because otherwise Facebook adds
# #_=_ and it breaks renderjs hash based URL routing.
# https://developers.facebook.com/support/bugs/318390728250352/?disable_redirect=0
# https://stackoverflow.com/questions/7131909/facebook-callback-appends-to-return-url/33257076#33257076
# https://lab.nexedi.com/nexedi/erp5/merge_requests/417#note_64365
came_from
=
context
.
REQUEST
.
get
(
"came_from"
,
portal
.
absolute_url
()
+
"#"
)
came_from
=
context
.
REQUEST
.
get
(
"came_from"
,
portal
.
absolute_url
()
+
"#"
)
return
context
.
REQUEST
.
RESPONSE
.
redirect
(
came_from
)
return
context
.
REQUEST
.
RESPONSE
.
redirect
(
came_from
)
...
...
bt5/erp5_oauth_facebook_login/TestTemplateItem/portal_components/test.erp5.testFacebookLogin.py
View file @
8c33379a
...
@@ -164,7 +164,8 @@ return credential_request
...
@@ -164,7 +164,8 @@ return credential_request
response
=
self
.
portal
.
ERP5Site_callbackFacebookLogin
(
code
=
CODE
)
response
=
self
.
portal
.
ERP5Site_callbackFacebookLogin
(
code
=
CODE
)
facebook_hash
=
self
.
portal
.
REQUEST
.
RESPONSE
.
cookies
.
get
(
"__ac_facebook_hash"
)[
"value"
]
facebook_hash
=
self
.
portal
.
REQUEST
.
RESPONSE
.
cookies
.
get
(
"__ac_facebook_hash"
)[
"value"
]
self
.
assertEqual
(
"8cec04e21e927f1023f4f4980ec11a77"
,
facebook_hash
)
self
.
assertEqual
(
"8cec04e21e927f1023f4f4980ec11a77"
,
facebook_hash
)
self
.
assertEqual
(
self
.
portal
.
absolute_url
(),
response
)
# The # is because we workaround facebook adding #_=_ in return URL
self
.
assertEqual
(
self
.
portal
.
absolute_url
()
+
'#'
,
response
)
cache_dict
=
self
.
portal
.
Base_getBearerToken
(
facebook_hash
,
"facebook_server_auth_token_cache_factory"
)
cache_dict
=
self
.
portal
.
Base_getBearerToken
(
facebook_hash
,
"facebook_server_auth_token_cache_factory"
)
self
.
assertEqual
(
ACCESS_TOKEN
,
cache_dict
[
"access_token"
])
self
.
assertEqual
(
ACCESS_TOKEN
,
cache_dict
[
"access_token"
])
self
.
assertEqual
({
'reference'
:
getUserId
(
None
)},
self
.
assertEqual
({
'reference'
:
getUserId
(
None
)},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment