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
Titouan Soulard
slapos.core
Commits
67e29a8e
Commit
67e29a8e
authored
Feb 08, 2024
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_erp5: rely on default password generator
parent
2cb6483a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
1 addition
and
131 deletions
+1
-131
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_base/Person_generatePassword.py
...eItem/portal_skins/slapos_base/Person_generatePassword.py
+0
-61
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_base/Person_generatePassword.xml
...Item/portal_skins/slapos_base/Person_generatePassword.xml
+0
-66
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_createUser.py
...os_subscription_request/SubscriptionRequest_createUser.py
+1
-4
No files found.
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_base/Person_generatePassword.py
deleted
100644 → 0
View file @
2cb6483a
"""
This script generates a human readable random
password in the form 'word'+digits+'word'.
from http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/410076
parameters: number of 'characters' , number of 'digits'
Pradeep Kishore Gowda <pradeep at btbytes.com >
License : GPL
Date : 2005.April.15
Revision 1.2
ChangeLog:
1.1 - fixed typos
1.2 - renamed functions _apart & _npart to a_part & n_part as zope does not allow functions to
start with _
"""
import
string
,
random
vowel_list
=
[
'a'
,
'e'
,
'i'
,
'o'
,
'u'
]
consonant_list
=
[
a
for
a
in
string
.
ascii_lowercase
if
a
not
in
vowel_list
]
digit_list
=
string
.
digits
symbol_list
=
[
"$"
,
"-"
,
"_"
,
"&"
]
def
a_part
(
slen
):
ret
=
''
for
i
in
range
(
slen
):
if
i
%
2
==
0
:
randid
=
random
.
randint
(
0
,
20
)
#number of consonants
ret
+=
consonant_list
[
randid
]
else
:
randid
=
random
.
randint
(
0
,
4
)
#number of vowels
ret
+=
vowel_list
[
randid
]
return
ret
def
n_part
(
slen
):
ret
=
''
for
_
in
range
(
slen
):
randid
=
random
.
randint
(
0
,
9
)
#number of digits
ret
+=
digit_list
[
randid
]
return
ret
def
s_part
(
slen
):
ret
=
''
for
_
in
range
(
slen
):
randid
=
random
.
randint
(
0
,
3
)
#number of digits
ret
+=
symbol_list
[
randid
]
return
ret
fpl
=
alpha
/
2
if
alpha
%
2
:
fpl
=
int
(
alpha
/
2
)
+
1
lpl
=
alpha
-
fpl
begin
=
string
.
upper
(
a_part
(
fpl
))
mid
=
n_part
(
numeric
)
third
=
a_part
(
lpl
)
end
=
s_part
(
symbol
)
newpass
=
"%s%s%s%s"
%
(
begin
,
mid
,
third
,
end
)
return
newpass
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_base/Person_generatePassword.xml
deleted
100644 → 0
View file @
2cb6483a
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"_reconstructor"
module=
"copy_reg"
/>
</klass>
<tuple>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
<global
name=
"object"
module=
"__builtin__"
/>
<none/>
</tuple>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
alpha=6, numeric=2, symbol=1
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Person_generatePassword
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Generate human readable random password
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_createUser.py
View file @
67e29a8e
...
...
@@ -28,13 +28,10 @@ for role in ['member', 'subscriber']:
title
=
'%s Assignment'
%
(
role
.
capitalize
()),
role
=
role
).
open
(
comment
=
"Created by Subscription Request"
)
password
=
list
(
""
.
join
([
context
.
Person_generatePassword
(
15
,
5
,
4
)
for
_
in
range
(
random
.
randint
(
2
,
4
))]))
random
.
shuffle
(
password
)
login
=
person
.
newContent
(
portal_type
=
"ERP5 Login"
,
reference
=
"%s-FIRST-SUBSCRIBER-LOGIN"
%
person
.
getUserId
(),
password
=
""
.
join
(
password
))
password
=
context
.
Person_generatePassword
(
))
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