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
Labels
Merge Requests
20
Merge Requests
20
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos.core
Commits
ebdeaffa
Commit
ebdeaffa
authored
Feb 16, 2024
by
Rafael Monnerat
👻
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_subscription_request: Make creation of the user more resilient
...to failures on password generation
parent
56149d16
Pipeline
#32956
passed with stage
in 0 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
3 deletions
+13
-3
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_createUser.py
...os_subscription_request/SubscriptionRequest_createUser.py
+13
-3
No files found.
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_createUser.py
View file @
ebdeaffa
from
zExceptions
import
Unauthorized
from
zExceptions
import
Unauthorized
from
erp5.component.module.Log
import
log
import
random
,
string
import
random
,
string
if
REQUEST
is
not
None
:
if
REQUEST
is
not
None
:
...
@@ -30,11 +31,20 @@ for role in ['member', 'subscriber']:
...
@@ -30,11 +31,20 @@ for role in ['member', 'subscriber']:
login
=
person
.
newContent
(
login
=
person
.
newContent
(
portal_type
=
"ERP5 Login"
,
portal_type
=
"ERP5 Login"
,
reference
=
"%s-FIRST-SUBSCRIBER-LOGIN"
%
person
.
getUserId
(),
reference
=
"%s-FIRST-SUBSCRIBER-LOGIN"
%
person
.
getUserId
())
password
=
context
.
Person_generatePassword
())
login
.
validate
()
for
_
in
range
(
5
):
try
:
login
.
setPassword
(
person
.
Person_generatePassword
())
break
except
ValueError
:
# Skip the generated password wasnt acceptable let it try again.
log
(
"Set password failed, try few more times"
)
if
not
login
.
getPassword
():
raise
ValueError
(
"We could not set a proper password."
)
login
.
validate
()
# The rest of the information will be used later.
# The rest of the information will be used later.
person
.
SubscriptionRequest_saveTransactionalUser
(
person
)
person
.
SubscriptionRequest_saveTransactionalUser
(
person
)
...
...
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