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
Carlos Ramos Carreño
erp5
Commits
d586d541
Commit
d586d541
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
0c45ae38
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
8 deletions
+20
-8
bt5/erp5_base/ExtensionTemplateItem/portal_components/extension.erp5.PersonLoginMigration.py
.../portal_components/extension.erp5.PersonLoginMigration.py
+20
-8
No files found.
bt5/erp5_base/ExtensionTemplateItem/portal_components/extension.erp5.PersonLoginMigration.py
View file @
d586d541
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
.
_baseSetUserId
(
reference
)
self
.
_baseSetUserId
(
reference
)
self
.
reindexObject
()
self
.
reindexObject
()
if
not
self
.
hasPassword
():
# no login is required, but possibly another Login type object is required if implemented
if
reference
.
startswith
(
"go_"
):
return
login_portal_type
=
"Google Login"
if
len
(
self
.
objectValues
(
portal_type
=
self
.
getPortalObject
().
getPortalLoginTypeList
())):
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
=
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
,
)
)
login
.
_setEncodedPassword
(
self
.
getPassword
())
if
login_portal_type
==
"ERP5 Login"
:
login
.
_setEncodedPassword
(
self
.
getPassword
())
self
.
_setEncodedPassword
(
None
)
login
.
validate
()
login
.
validate
()
self
.
_setEncodedPassword
(
None
)
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