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
Labels
Merge Requests
138
Merge Requests
138
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
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
e9a472fc
Commit
e9a472fc
authored
Feb 12, 2018
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_base: Upgrade login to Facebook/Google login when applicable.
parent
9eb3828d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
8 deletions
+19
-8
bt5/erp5_base/ExtensionTemplateItem/portal_components/extension.erp5.PersonLoginMigration.py
.../portal_components/extension.erp5.PersonLoginMigration.py
+19
-8
No files found.
bt5/erp5_base/ExtensionTemplateItem/portal_components/extension.erp5.PersonLoginMigration.py
View file @
e9a472fc
def
migrateToERP5Login
(
self
):
assert
self
.
getPortalType
()
==
'Person'
login_portal_type
=
'ERP5 Login'
reference
=
self
.
getReference
()
if
not
reference
:
# no user id and no login is required
return
if
not
self
.
hasUserId
()
or
self
.
getUserId
()
==
reference
:
if
not
(
self
.
hasUserId
()
or
self
.
getUserId
()
==
reference
)
:
self
.
setUserId
(
reference
)
if
reference
.
startswith
(
"go_"
):
login_portal_type
=
"Google Login"
reference
=
self
.
getDefaultEmailText
()
elif
reference
.
startswith
(
"fb_"
):
login_portal_type
=
"Facebook Login"
reference
=
reference
[
len
(
"fb_"
):]
else
:
if
not
self
.
hasPassword
():
# no login is required, but possibly another Login type object is required if implemented
return
if
len
(
self
.
objectValues
(
portal_type
=
self
.
getPortalObject
().
getPortalLoginTypeList
()
)):
if
len
(
self
.
objectValues
(
portal_type
=
login_portal_type
)):
# already migrated
return
login
=
self
.
newContent
(
portal_type
=
'ERP5 Login'
,
portal_type
=
login_portal_type
,
reference
=
reference
,
)
if
login_portal_type
==
"ERP5 Login"
:
login
.
_setEncodedPassword
(
self
.
getPassword
())
login
.
validate
()
self
.
_setEncodedPassword
(
None
)
login
.
validate
()
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