Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
bc4440cd
Commit
bc4440cd
authored
Apr 12, 2002
by
Andreas Jung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
replaced whrandom by random module because whrandom will be deprecated soon
parent
4c53db31
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
5 deletions
+4
-5
zpasswd.py
zpasswd.py
+4
-5
No files found.
zpasswd.py
View file @
bc4440cd
...
@@ -13,9 +13,9 @@
...
@@ -13,9 +13,9 @@
##############################################################################
##############################################################################
"""Zope user bootstrap system"""
"""Zope user bootstrap system"""
__version__
=
'$Revision: 1.1
4
$ '
[
11
:
-
2
]
__version__
=
'$Revision: 1.1
5
$ '
[
11
:
-
2
]
import
sys
,
sha
,
binascii
,
wh
random
,
getopt
,
getpass
,
os
import
sys
,
sha
,
binascii
,
random
,
getopt
,
getpass
,
os
try
:
try
:
from
crypt
import
crypt
from
crypt
import
crypt
...
@@ -27,7 +27,7 @@ def generate_salt():
...
@@ -27,7 +27,7 @@ def generate_salt():
salt_choices
=
(
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
salt_choices
=
(
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"
"abcdefghijklmnopqrstuvwxyz"
"0123456789./"
)
"0123456789./"
)
return
whrandom
.
choice
(
salt_choices
)
+
wh
random
.
choice
(
salt_choices
)
return
random
.
choice
(
salt_choices
)
+
random
.
choice
(
salt_choices
)
def
generate_passwd
(
password
,
encoding
):
def
generate_passwd
(
password
,
encoding
):
encoding
=
encoding
.
upper
()
encoding
=
encoding
.
upper
()
...
@@ -41,14 +41,13 @@ def generate_passwd(password, encoding):
...
@@ -41,14 +41,13 @@ def generate_passwd(password, encoding):
return
pw
return
pw
def
write_generated_password
(
home
,
ac_path
,
username
):
def
write_generated_password
(
home
,
ac_path
,
username
):
import
whrandom
pw_choices
=
(
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
pw_choices
=
(
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"
"abcdefghijklmnopqrstuvwxyz"
"0123456789!"
)
"0123456789!"
)
acfile
=
open
(
ac_path
,
'w'
)
acfile
=
open
(
ac_path
,
'w'
)
pw
=
''
pw
=
''
for
i
in
range
(
8
):
for
i
in
range
(
8
):
pw
=
pw
+
wh
random
.
choice
(
pw_choices
)
pw
=
pw
+
random
.
choice
(
pw_choices
)
acfile
.
write
(
'%s:%s'
%
(
username
,
generate_passwd
(
pw
,
'SHA'
)))
acfile
.
write
(
'%s:%s'
%
(
username
,
generate_passwd
(
pw
,
'SHA'
)))
acfile
.
close
()
acfile
.
close
()
os
.
system
(
'chmod 644 %s'
%
ac_path
)
os
.
system
(
'chmod 644 %s'
%
ac_path
)
...
...
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