Skip to content

Commit

Permalink
fix broken inithook
Browse files Browse the repository at this point in the history
  • Loading branch information
JedMeister committed Nov 26, 2015
1 parent 7b8d221 commit 3054699
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
18 changes: 3 additions & 15 deletions overlay/usr/lib/inithooks/bin/concrete5.py
Expand Up @@ -7,11 +7,10 @@
"""

import re
import sys
import getopt
import inithooks_cache
import hashlib
import bcrypt

from dialog_wrapper import Dialog
from mysqlconf import MySQL
Expand Down Expand Up @@ -57,19 +56,8 @@ def main():

inithooks_cache.write('APP_EMAIL', email)

salt = ''
config = '/var/www/concrete5/config/site.php'
for s in file(config).readlines():
s = s.strip()
m = re.match("define\('PASSWORD_SALT', '(.*)'\);", s)
if m:
salt = m.group(1)
break

if not salt:
usage("Could not identify salt from: %s" % config)

hashpass = hashlib.md5(':'.join([password, salt])).hexdigest()
salt = bcrypt.gensalt()
hashpass = bcrypt.hashpw(password, salt)

m = MySQL()
m.execute('UPDATE concrete5.Users SET uPassword=\"%s\" WHERE uName=\"admin\";' % hashpass)
Expand Down
2 changes: 2 additions & 0 deletions plan/main
Expand Up @@ -7,3 +7,5 @@ php5-curl

unzip

python-bcrypt

0 comments on commit 3054699

Please sign in to comment.