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
e6a4b981
Commit
e6a4b981
authored
Feb 23, 2015
by
Weblate
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
600d7bee
924792dc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
23 deletions
+28
-23
openshift/secure_db.py
openshift/secure_db.py
+28
-23
No files found.
openshift/secure_db.py
View file @
e6a4b981
...
...
@@ -27,26 +27,31 @@ from openshift.openshiftlibs import make_secure_key, get_openshift_secret_token
from
hashlib
import
sha256
from
django.contrib.auth.hashers
import
make_password
# Use default Django settings
settings
.
configure
()
new_pass
=
make_secure_key
({
'hash'
:
sha256
(
get_openshift_secret_token
()).
hexdigest
(),
'original'
:
'0'
*
12
,
'variable'
:
''
})
new_hash
=
make_password
(
new_pass
)
# Update admin password in database
conn
=
sqlite3
.
connect
(
os
.
environ
[
'OPENSHIFT_DATA_DIR'
]
+
'/weblate.db'
)
cursor
=
conn
.
cursor
()
cursor
.
execute
(
'UPDATE AUTH_USER SET password = ? WHERE username = ?'
,
[
new_hash
,
'admin'
]
)
conn
.
commit
()
cursor
.
close
()
conn
.
close
()
# Print the new password info
print
"Weblate admin credentials:
\
n
\
t
user: admin
\
n
\
t
password: "
+
new_pass
def
secure_db
():
# Use default Django settings
settings
.
configure
()
new_pass
=
make_secure_key
({
'hash'
:
sha256
(
get_openshift_secret_token
()).
hexdigest
(),
'original'
:
'0'
*
12
,
'variable'
:
''
})
new_hash
=
make_password
(
new_pass
)
# Update admin password in database
conn
=
sqlite3
.
connect
(
os
.
environ
[
'OPENSHIFT_DATA_DIR'
]
+
'/weblate.db'
)
cursor
=
conn
.
cursor
()
cursor
.
execute
(
'UPDATE AUTH_USER SET password = ? WHERE username = ?'
,
[
new_hash
,
'admin'
]
)
conn
.
commit
()
cursor
.
close
()
conn
.
close
()
# Print the new password info
print
"Weblate admin credentials:
\
n
\
t
user: admin
\
n
\
t
password: "
+
new_pass
if
__name__
==
"__main__"
:
secure_db
()
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