Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
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
nexedi
converse.js
Commits
b516b4ae
Commit
b516b4ae
authored
Nov 04, 2014
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Get rid of tabs and spaces mix
Signed-off-by:
Michal Čihař
<
michal@cihar.com
>
parent
8c9f5bec
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
19 deletions
+19
-19
openshift/openshiftlibs.py
openshift/openshiftlibs.py
+19
-19
No files found.
openshift/openshiftlibs.py
View file @
b516b4ae
...
@@ -72,27 +72,27 @@ def openshift_secure(default_keys, secure_function = 'make_secure_key'):
...
@@ -72,27 +72,27 @@ def openshift_secure(default_keys, secure_function = 'make_secure_key'):
# This function transforms default keys into per-deployment random keys;
# This function transforms default keys into per-deployment random keys;
def
make_secure_key
(
key_info
):
def
make_secure_key
(
key_info
):
hashcode
=
key_info
[
'hash'
]
hashcode
=
key_info
[
'hash'
]
original
=
key_info
[
'original'
]
original
=
key_info
[
'original'
]
# These are the legal password characters
# These are the legal password characters
# as per the Django source code
# as per the Django source code
# (django/contrib/auth/models.py)
# (django/contrib/auth/models.py)
chars
=
'abcdefghjkmnpqrstuvwxyz'
chars
=
'abcdefghjkmnpqrstuvwxyz'
chars
+=
'ABCDEFGHJKLMNPQRSTUVWXYZ'
chars
+=
'ABCDEFGHJKLMNPQRSTUVWXYZ'
chars
+=
'23456789'
chars
+=
'23456789'
# Use the hash to seed the RNG
# Use the hash to seed the RNG
random
.
seed
(
int
(
"0x"
+
hashcode
[:
8
],
0
))
random
.
seed
(
int
(
"0x"
+
hashcode
[:
8
],
0
))
# Create a random string the same length as the default
# Create a random string the same length as the default
rand_key
=
''
rand_key
=
''
for
_
in
range
(
len
(
original
)):
for
_
in
range
(
len
(
original
)):
rand_pos
=
random
.
randint
(
0
,
len
(
chars
))
rand_pos
=
random
.
randint
(
0
,
len
(
chars
))
rand_key
+=
chars
[
rand_pos
:(
rand_pos
+
1
)]
rand_key
+=
chars
[
rand_pos
:(
rand_pos
+
1
)]
# Reset the RNG
# Reset the RNG
random
.
seed
()
random
.
seed
()
# Set the value
# Set the value
return
rand_key
return
rand_key
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