Commit e6a4b981 authored by Weblate's avatar Weblate

Merge remote-tracking branch 'origin/master'

parents 600d7bee 924792dc
......@@ -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\tuser: admin\n\tpassword: " + 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\tuser: admin\n\tpassword: " + new_pass
if __name__ == "__main__":
secure_db()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment