Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
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
Jérome Perrin
slapos.core
Commits
5bf0d22b
Commit
5bf0d22b
authored
Mar 29, 2023
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_subscription_request: A valid Assignment is required to be a valid user.
parent
b8011d42
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
17 deletions
+16
-17
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_boostrapUserAccount.py
...iption_request/SubscriptionRequest_boostrapUserAccount.py
+1
-1
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_createUser.py
...os_subscription_request/SubscriptionRequest_createUser.py
+8
-10
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionSkins.py
...ortal_components/test.erp5.testSlapOSSubscriptionSkins.py
+7
-6
No files found.
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_boostrapUserAccount.py
View file @
5bf0d22b
...
@@ -53,7 +53,7 @@ if not login_list:
...
@@ -53,7 +53,7 @@ if not login_list:
login
=
login_list
[
0
]
login
=
login_list
[
0
]
# Let's reset password if the user is his first login.
# Let's reset password if the user is his first login.
if
not
open_assignment_list
and
person
.
getUserId
()
==
login_list
[
0
].
getReference
():
if
"%s-FIRST-SUBSCRIBER-LOGIN"
%
person
.
getUserId
()
==
login_list
[
0
].
getReference
():
login
.
invalidate
()
login
.
invalidate
()
login
.
setReference
(
person
.
getDefaultEmailText
())
login
.
setReference
(
person
.
getDefaultEmailText
())
reference
=
person
.
getDefaultEmailText
()
reference
=
person
.
getDefaultEmailText
()
...
...
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_createUser.py
View file @
5bf0d22b
...
@@ -14,7 +14,6 @@ if person is not None:
...
@@ -14,7 +14,6 @@ if person is not None:
# Already has login with this.
# Already has login with this.
person
=
context
.
SubscriptionRequest_searchExistingUserByEmail
(
email
)
person
=
context
.
SubscriptionRequest_searchExistingUserByEmail
(
email
)
if
person
is
not
None
:
if
person
is
not
None
:
return
person
,
False
return
person
,
False
...
@@ -23,20 +22,19 @@ person = portal.person_module.newContent(
...
@@ -23,20 +22,19 @@ person = portal.person_module.newContent(
portal_type
=
"Person"
,
portal_type
=
"Person"
,
first_name
=
name
)
first_name
=
name
)
password
=
[
random
.
choice
(
string
.
upper
(
string
.
ascii_letters
)),
for
role
in
[
'member'
,
'subscriber'
]:
random
.
choice
(
string
.
lower
(
string
.
ascii_letters
)),
person
.
newContent
(
random
.
choice
(
string
.
digits
),
portal_type
=
'Assignment'
,
random
.
choice
(
"$!*#%$.;:,"
)]
title
=
'%s Assignment'
%
(
role
.
capitalize
()),
role
=
role
).
open
(
comment
=
"Created by Subscription Request"
)
chars
=
string
.
ascii_letters
+
string
.
digits
+
'!@#$%^&*()'
password
.
extend
([
random
.
choice
(
chars
)
for
_
in
range
(
26
)])
password
=
list
(
""
.
join
([
context
.
Person_generatePassword
(
15
,
5
,
4
)
for
_
in
range
(
random
.
randint
(
2
,
4
))]))
random
.
shuffle
(
password
)
random
.
shuffle
(
password
)
login
=
person
.
newContent
(
login
=
person
.
newContent
(
portal_type
=
"ERP5 Login"
,
portal_type
=
"ERP5 Login"
,
reference
=
person
.
getUserId
(),
reference
=
"%s-FIRST-SUBSCRIBER-LOGIN"
%
person
.
getUserId
(),
password
=
''
.
join
(
password
))
password
=
""
.
join
(
password
))
login
.
validate
()
login
.
validate
()
...
...
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionSkins.py
View file @
5bf0d22b
...
@@ -294,7 +294,7 @@ class TestSubscriptionRequest_createUser(TestSubscriptionSkinsMixin):
...
@@ -294,7 +294,7 @@ class TestSubscriptionRequest_createUser(TestSubscriptionSkinsMixin):
erp5_login
=
[
i
for
i
in
person
.
searchFolder
(
portal_type
=
"ERP5 Login"
)][
0
]
erp5_login
=
[
i
for
i
in
person
.
searchFolder
(
portal_type
=
"ERP5 Login"
)][
0
]
self
.
assertEqual
(
person
.
getValidationState
(),
"draft"
)
self
.
assertEqual
(
person
.
getValidationState
(),
"draft"
)
self
.
assertEqual
(
erp5_login
.
getValidationState
(),
"validated"
)
self
.
assertEqual
(
erp5_login
.
getValidationState
(),
"validated"
)
self
.
assertEqual
(
erp5_login
.
getReference
(),
person
.
getUserId
())
self
.
assertEqual
(
erp5_login
.
getReference
(),
person
.
getUserId
()
+
"-FIRST-SUBSCRIBER-LOGIN"
)
class
Test0SubscriptionRequestModule_requestSubscriptionProxy
(
TestSubscriptionSkinsMixin
):
class
Test0SubscriptionRequestModule_requestSubscriptionProxy
(
TestSubscriptionSkinsMixin
):
...
@@ -388,7 +388,8 @@ class TestSubscriptionRequest_applyCondition(TestSubscriptionSkinsMixin):
...
@@ -388,7 +388,8 @@ class TestSubscriptionRequest_applyCondition(TestSubscriptionSkinsMixin):
class
SubscriptionRequest_boostrapUserAccount
(
TestSubscriptionSkinsMixin
):
class
SubscriptionRequest_boostrapUserAccount
(
TestSubscriptionSkinsMixin
):
@
simulate
(
'SubscriptionRequest_sendAcceptedNotification'
,
'reference, password'
,
"""assert reference == context.getDefaultEmailText()
@
simulate
(
'SubscriptionRequest_sendAcceptedNotification'
,
'reference, password'
,
"""
assert reference == context.getDefaultEmailText(), "%s != %s" % (reference, context.getDefaultEmailText())
assert password"""
)
assert password"""
)
def
test_bootstrap_user
(
self
):
def
test_bootstrap_user
(
self
):
email
=
"abc%s@nexedi.com"
%
self
.
new_id
email
=
"abc%s@nexedi.com"
%
self
.
new_id
...
@@ -405,7 +406,7 @@ assert password""")
...
@@ -405,7 +406,7 @@ assert password""")
subscription_request
.
plan
()
subscription_request
.
plan
()
self
.
assertEqual
(
len
(
person
.
searchFolder
(
portal_type
=
"Assignment"
,
self
.
assertEqual
(
len
(
person
.
searchFolder
(
portal_type
=
"Assignment"
,
validation_state
=
"open"
)),
0
)
validation_state
=
"open"
)),
2
)
subscription_request
.
SubscriptionRequest_boostrapUserAccount
()
subscription_request
.
SubscriptionRequest_boostrapUserAccount
()
...
@@ -795,7 +796,7 @@ class TestSubscriptionRequest_sendAcceptedNotification(TestSubscriptionSkinsMixi
...
@@ -795,7 +796,7 @@ class TestSubscriptionRequest_sendAcceptedNotification(TestSubscriptionSkinsMixi
self
.
assertEqual
(
event
.
getContentType
(),
'text/html'
)
self
.
assertEqual
(
event
.
getContentType
(),
'text/html'
)
self
.
assertEqual
(
self
.
assertEqual
(
event
.
getTextContent
(),
'%s %s'
%
(
person
.
getTitle
(),
person
.
getUserId
()))
event
.
getTextContent
(),
'%s %s
-FIRST-SUBSCRIBER-LOGIN
'
%
(
person
.
getTitle
(),
person
.
getUserId
()))
def
test_send_notification_with_password
(
self
):
def
test_send_notification_with_password
(
self
):
...
@@ -824,7 +825,7 @@ class TestSubscriptionRequest_sendAcceptedNotification(TestSubscriptionSkinsMixi
...
@@ -824,7 +825,7 @@ class TestSubscriptionRequest_sendAcceptedNotification(TestSubscriptionSkinsMixi
self
.
assertEqual
(
event
.
getContentType
(),
'text/html'
)
self
.
assertEqual
(
event
.
getContentType
(),
'text/html'
)
self
.
assertEqual
(
self
.
assertEqual
(
event
.
getTextContent
(),
'%s %s password'
%
(
person
.
getTitle
(),
person
.
getUserId
()))
event
.
getTextContent
(),
'%s %s password'
%
(
person
.
getTitle
(),
person
.
getUserId
()
+
"-FIRST-SUBSCRIBER-LOGIN"
))
class
TestSubscriptionRequest_notifyInstanceIsReady
(
TestSubscriptionSkinsMixin
):
class
TestSubscriptionRequest_notifyInstanceIsReady
(
TestSubscriptionSkinsMixin
):
...
...
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