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
Noah Brackenbury
erp5
Commits
d00ca84a
Commit
d00ca84a
authored
Feb 06, 2017
by
Gabriel Monnerat
Committed by
Jérome Perrin
May 02, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_oauth_google_login: Add comments and minor changes to make the code more readable
parent
caa2da48
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
10 deletions
+12
-10
bt5/erp5_oauth_google_login/SkinTemplateItem/portal_skins/erp5_oauth_google_login/Base_createOauth2User.py
...al_skins/erp5_oauth_google_login/Base_createOauth2User.py
+12
-10
No files found.
bt5/erp5_oauth_google_login/SkinTemplateItem/portal_skins/erp5_oauth_google_login/Base_createOauth2User.py
View file @
d00ca84a
...
@@ -7,17 +7,21 @@ context.REQUEST.set('Base_createOauth2User', 1)
...
@@ -7,17 +7,21 @@ context.REQUEST.set('Base_createOauth2User', 1)
portal
=
context
.
getPortalObject
()
portal
=
context
.
getPortalObject
()
if
portal
.
portal_activities
.
countMessageWithTag
(
tag
)
>
0
:
if
portal
.
portal_activities
.
countMessageWithTag
(
tag
)
>
0
:
# If activity already exists, it means that the user reloaded the page and
# searchUsers() from ERP5ExternalOauth2ExtractionPlugin:186 did not find the user yet
return
return
person
=
portal
.
Base_getUserValueByUserId
(
reference
)
person
=
portal
.
Base_getUserValueByUserId
(
reference
)
if
person
is
not
None
:
current_user
=
portal
.
portal_membership
.
getAuthenticatedMember
()
context
.
log
(
"Person already exists please "
+
\
"consider this object: %s"
%
person
.
getRelativeUrl
())
if
person
is
not
None
or
(
current_user
and
current_user
is
None
):
# Script should here stop if person exists or the user logged in is a Zope user
return
return
activate_kw
=
{
'tag'
:
tag
}
activate_kw
=
{
'tag'
:
tag
}
# In future we can move this script to another, because this script is generic enough
# In future we can move this script to another, because this script is generic enough
# to support Facebook login
# to support Facebook login
, for example.
assert
login_portal_type
in
(
"Google Login"
,),
"Impossible to select a portal type"
assert
login_portal_type
in
(
"Google Login"
,),
"Impossible to select a portal type"
if
user_id
in
(
"Anonymous User"
,
None
):
if
user_id
in
(
"Anonymous User"
,
None
):
...
@@ -27,13 +31,11 @@ if user_id in ("Anonymous User", None):
...
@@ -27,13 +31,11 @@ if user_id in ("Anonymous User", None):
last_name
=
last_name
,
last_name
=
last_name
,
default_email_coordinate_text
=
email
,
default_email_coordinate_text
=
email
,
activate_kw
=
activate_kw
)
activate_kw
=
activate_kw
)
# Support erp5_credential
duration
=
getattr
(
portal
.
portal_preferences
,
getDuration
=
getattr
(
portal
.
portal_preferences
,
"getPreferredCredentialAssignmentDuration"
,
"getPreferredCredentialAssignmentDuration"
,
None
)
lambda
:
0
)()
or
365
assignment_duration
=
getDuration
and
getDuration
()
or
365
today
=
DateTime
()
today
=
DateTime
()
delay
=
today
+
assignment_
duration
delay
=
today
+
duration
# Support erp5_credential
# Support erp5_credential
getAssignmentCategoryList
=
getattr
(
portal
.
portal_preferences
,
getAssignmentCategoryList
=
getattr
(
portal
.
portal_preferences
,
...
...
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