Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5-Boxiang
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
Hamza
erp5-Boxiang
Commits
2bf29d0d
Commit
2bf29d0d
authored
Feb 06, 2017
by
Gabriel Monnerat
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
bd182d18
Changes
1
Hide 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 @
2bf29d0d
...
...
@@ -7,17 +7,21 @@ context.REQUEST.set('Base_createOauth2User', 1)
portal
=
context
.
getPortalObject
()
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
person
=
portal
.
Base_getUserValueByUserId
(
reference
)
if
person
is
not
None
:
context
.
log
(
"Person already exists please "
+
\
"consider this object: %s"
%
person
.
getRelativeUrl
())
current_user
=
portal
.
portal_membership
.
getAuthenticatedMember
()
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
activate_kw
=
{
'tag'
:
tag
}
# 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"
if
user_id
in
(
"Anonymous User"
,
None
):
...
...
@@ -27,13 +31,11 @@ if user_id in ("Anonymous User", None):
last_name
=
last_name
,
default_email_coordinate_text
=
email
,
activate_kw
=
activate_kw
)
# Support erp5_credential
getDuration
=
getattr
(
portal
.
portal_preferences
,
"getPreferredCredentialAssignmentDuration"
,
None
)
assignment_duration
=
getDuration
and
getDuration
()
or
365
duration
=
getattr
(
portal
.
portal_preferences
,
"getPreferredCredentialAssignmentDuration"
,
lambda
:
0
)()
or
365
today
=
DateTime
()
delay
=
today
+
assignment_
duration
delay
=
today
+
duration
# Support erp5_credential
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