Update finish.sh
This commit is contained in:
parent
1a6d526ab0
commit
ddca9feea4
|
|
@ -12,7 +12,9 @@ cd "$(dirname "$0")"
|
|||
database_host=127.0.0.1
|
||||
database_port=5432
|
||||
database_username=fusionpbx
|
||||
database_password=$(dd if=/dev/urandom bs=1 count=20 2>/dev/null | base64 | sed 's/[=\+//]//g')
|
||||
if [ .$database_password = .'random' ]; then
|
||||
database_password=$(dd if=/dev/urandom bs=1 count=20 2>/dev/null | base64 | sed 's/[=\+//]//g')
|
||||
fi
|
||||
|
||||
#allow the script to use the new password
|
||||
export PGPASSWORD=$database_password
|
||||
|
|
@ -49,8 +51,12 @@ cd /var/www/fusionpbx && php /var/www/fusionpbx/core/upgrade/upgrade_domains.php
|
|||
#add the user
|
||||
user_uuid=$(/usr/bin/php /var/www/fusionpbx/resources/uuid.php);
|
||||
user_salt=$(/usr/bin/php /var/www/fusionpbx/resources/uuid.php);
|
||||
user_name=admin
|
||||
user_password=$(dd if=/dev/urandom bs=1 count=12 2>/dev/null | base64 | sed 's/[=\+//]//g')
|
||||
user_name=$system_username
|
||||
if [ .$system_password = .'random' ]; then
|
||||
user_password=$(dd if=/dev/urandom bs=1 count=12 2>/dev/null | base64 | sed 's/[=\+//]//g')
|
||||
else
|
||||
user_password=$system_password
|
||||
fi
|
||||
password_hash=$(php -r "echo md5('$user_salt$user_password');");
|
||||
psql --host=$database_host --port=$database_port --username=$database_username -t -c "insert into v_users (user_uuid, domain_uuid, username, password, salt, user_enabled) values('$user_uuid', '$domain_uuid', '$user_name', '$password_hash', '$user_salt', 'true');"
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue