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
Xavier Thompson
erp5
Commits
f6c2f499
Commit
f6c2f499
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
5abf7c6d
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 @
f6c2f499
def
migrateToERP5Login
(
self
):
def
migrateToERP5Login
(
self
):
assert
self
.
getPortalType
()
==
'Person'
assert
self
.
getPortalType
()
==
'Person'
login_portal_type
=
'ERP5 Login'
reference
=
self
.
getReference
()
reference
=
self
.
getReference
()
if
not
reference
:
if
not
reference
:
# no user id and no login is required
# no user id and no login is required
return
return
if
not
self
.
hasUserId
()
or
self
.
getUserId
()
==
reference
:
if
not
(
self
.
hasUserId
()
or
self
.
getUserId
()
==
reference
)
:
self
.
setUserId
(
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
():
if
not
self
.
hasPassword
():
# no login is required, but possibly another Login type object is required if implemented
# no login is required, but possibly another Login type object is required if implemented
return
return
if
len
(
self
.
objectValues
(
portal_type
=
self
.
getPortalObject
().
getPortalLoginTypeList
()
)):
if
len
(
self
.
objectValues
(
portal_type
=
login_portal_type
)):
# already migrated
# already migrated
return
return
login
=
self
.
newContent
(
login
=
self
.
newContent
(
portal_type
=
'ERP5 Login'
,
portal_type
=
login_portal_type
,
reference
=
reference
,
reference
=
reference
,
)
)
if
login_portal_type
==
"ERP5 Login"
:
login
.
_setEncodedPassword
(
self
.
getPassword
())
login
.
_setEncodedPassword
(
self
.
getPassword
())
login
.
validate
()
self
.
_setEncodedPassword
(
None
)
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