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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Eteri
erp5
Commits
2f395e96
Commit
2f395e96
authored
Apr 29, 2022
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Plain Diff
erp5_oauth_[google/facebook]_login: Drop minor duplication
See merge request
nexedi/erp5!1607
parents
b787ad1c
72a74a6f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
16 deletions
+6
-16
bt5/erp5_oauth_facebook_login/ExtensionTemplateItem/portal_components/extension.erp5.FacebookLoginUtility.py
.../portal_components/extension.erp5.FacebookLoginUtility.py
+3
-8
bt5/erp5_oauth_google_login/ExtensionTemplateItem/portal_components/extension.erp5.GoogleLoginUtility.py
...em/portal_components/extension.erp5.GoogleLoginUtility.py
+3
-8
No files found.
bt5/erp5_oauth_facebook_login/ExtensionTemplateItem/portal_components/extension.erp5.FacebookLoginUtility.py
View file @
2f395e96
...
@@ -9,12 +9,7 @@ def _getFacebookClientIdAndSecretKey(portal, reference="default"):
...
@@ -9,12 +9,7 @@ def _getFacebookClientIdAndSecretKey(portal, reference="default"):
Internal function.
Internal function.
"""
"""
result_list
=
portal
.
portal_catalog
.
unrestrictedSearchResults
(
result_list
=
unrestrictedSearchFacebookConnector
(
portal
,
reference
=
reference
)
portal_type
=
"Facebook Connector"
,
reference
=
reference
,
validation_state
=
"validated"
,
limit
=
2
,
)
assert
result_list
,
"Facebook Connector not found"
assert
result_list
,
"Facebook Connector not found"
if
len
(
result_list
)
==
2
:
if
len
(
result_list
)
==
2
:
raise
ValueError
(
"Impossible to select one Facebook Connector"
)
raise
ValueError
(
"Impossible to select one Facebook Connector"
)
...
@@ -38,10 +33,10 @@ def getAccessTokenFromCode(self, code, redirect_uri):
...
@@ -38,10 +33,10 @@ def getAccessTokenFromCode(self, code, redirect_uri):
code
=
code
,
redirect_uri
=
redirect_uri
,
code
=
code
,
redirect_uri
=
redirect_uri
,
app_id
=
client_id
,
app_secret
=
secret_key
)
app_id
=
client_id
,
app_secret
=
secret_key
)
def
unrestrictedSearchFacebookConnector
(
self
):
def
unrestrictedSearchFacebookConnector
(
self
,
reference
=
"default"
):
return
self
.
getPortalObject
().
portal_catalog
.
unrestrictedSearchResults
(
return
self
.
getPortalObject
().
portal_catalog
.
unrestrictedSearchResults
(
portal_type
=
"Facebook Connector"
,
portal_type
=
"Facebook Connector"
,
reference
=
"default"
,
reference
=
reference
,
validation_state
=
"validated"
,
validation_state
=
"validated"
,
limit
=
2
)
limit
=
2
)
...
...
bt5/erp5_oauth_google_login/ExtensionTemplateItem/portal_components/extension.erp5.GoogleLoginUtility.py
View file @
2f395e96
...
@@ -13,12 +13,7 @@ def _getGoogleClientIdAndSecretKey(portal, reference="default"):
...
@@ -13,12 +13,7 @@ def _getGoogleClientIdAndSecretKey(portal, reference="default"):
Internal function.
Internal function.
"""
"""
result_list
=
portal
.
portal_catalog
.
unrestrictedSearchResults
(
result_list
=
unrestrictedSearchGoogleConnector
(
portal
,
reference
=
reference
)
portal_type
=
"Google Connector"
,
reference
=
reference
,
validation_state
=
"validated"
,
limit
=
2
,
)
assert
result_list
,
"Google Connector not found"
assert
result_list
,
"Google Connector not found"
if
len
(
result_list
)
==
2
:
if
len
(
result_list
)
==
2
:
raise
ValueError
(
"Impossible to select one Google Connector"
)
raise
ValueError
(
"Impossible to select one Google Connector"
)
...
@@ -51,10 +46,10 @@ def getAccessTokenFromCode(self, code, redirect_uri):
...
@@ -51,10 +46,10 @@ def getAccessTokenFromCode(self, code, redirect_uri):
credential_data
=
json
.
loads
(
credential
.
to_json
())
credential_data
=
json
.
loads
(
credential
.
to_json
())
return
credential_data
return
credential_data
def
unrestrictedSearchGoogleConnector
(
self
):
def
unrestrictedSearchGoogleConnector
(
self
,
reference
=
"default"
):
return
self
.
getPortalObject
().
portal_catalog
.
unrestrictedSearchResults
(
return
self
.
getPortalObject
().
portal_catalog
.
unrestrictedSearchResults
(
portal_type
=
"Google Connector"
,
portal_type
=
"Google Connector"
,
reference
=
"default"
,
reference
=
reference
,
validation_state
=
"validated"
,
validation_state
=
"validated"
,
limit
=
2
)
limit
=
2
)
...
...
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