Restore matrix user creation

This commit is contained in:
Bob Mottram 2017-05-04 17:42:08 +01:00
parent 0530ff8a73
commit f1ae5ddd38
1 changed files with 17 additions and 12 deletions

View File

@ -86,11 +86,11 @@ function matrix_nginx {
echo ' index index.html;' >> $matrix_nginx_site
echo '' >> $matrix_nginx_site
echo ' # Location' >> $matrix_nginx_site
echo ' location / {' >> $matrix_nginx_site
echo ' location /_matrix {' >> $matrix_nginx_site
function_check nginx_limits
nginx_limits ${MATRIX_DOMAIN_NAME} '15m'
echo " proxy_pass http://localhost:${MATRIX_PORT}/_matrix;" >> $matrix_nginx_site
echo ' proxy_set_header X-Forwarded-For $remote_addr;' >> $matrix_nginx_site
echo ' proxy_pass http://localhost:8008;' >> $matrix_nginx_site
echo ' proxy_set_header X-Forwarded-For $remote_addr;' >> $matrix_nginx_site
echo ' }' >> $matrix_nginx_site
echo '}' >> $matrix_nginx_site
echo '' >> $matrix_nginx_site
@ -116,11 +116,11 @@ function matrix_nginx {
echo ' index index.html;' >> $matrix_nginx_site
echo '' >> $matrix_nginx_site
echo ' # Location' >> $matrix_nginx_site
echo ' location / {' >> $matrix_nginx_site
echo ' location /_matrix {' >> $matrix_nginx_site
function_check nginx_limits
nginx_limits ${MATRIX_DOMAIN_NAME} '15m'
echo " proxy_pass http://localhost:${MATRIX_ID_PORT};" >> $matrix_nginx_site
echo ' proxy_set_header X-Forwarded-For $remote_addr;' >> $matrix_nginx_site
echo ' proxy_pass http://localhost:8008;' >> $matrix_nginx_site
echo ' proxy_set_header X-Forwarded-For $remote_addr;' >> $matrix_nginx_site
echo ' }' >> $matrix_nginx_site
echo '}' >> $matrix_nginx_site
echo '' >> $matrix_nginx_site
@ -300,13 +300,18 @@ function remove_user_matrix {
function add_user_matrix {
new_username="$1"
new_user_password="$2"
is_admin_user='-a'
if [[ "$new_username" != "$MY_USERNAME" ]]; then
is_admin_user=''
fi
${PROJECT_NAME}-pass -u $new_username -a matrix -p "$new_user_password"
if [[ $ONION_ONLY == 'no' ]]; then
retval=$(register_new_matrix_user -c ${MATRIX_DATA_DIR}/homeserver.yaml -u "${new_username}" -p "${new_user_password}" -a https://${MATRIX_DOMAIN_NAME})
retval=$(register_new_matrix_user -c ${MATRIX_DATA_DIR}/homeserver.yaml -u "${new_username}" -p "${new_user_password}" $is_admin_user https://${MATRIX_DOMAIN_NAME})
else
retval=$(register_new_matrix_user -c ${MATRIX_DATA_DIR}/homeserver.yaml -u "${new_username}" -p "${new_user_password}" -a http://${MATRIX_DOMAIN_NAME})
retval=$(register_new_matrix_user -c ${MATRIX_DATA_DIR}/homeserver.yaml -u "${new_username}" -p "${new_user_password}" $is_admin_user http://${MATRIX_DOMAIN_NAME})
fi
echo "0"
}
@ -783,10 +788,10 @@ function install_matrix {
function_check matrix_nginx
matrix_nginx
#if [[ $(add_user_matrix "${MY_USERNAME}" "${MATRIX_PASSWORD}" | tail -n 1) != "0" ]]; then
# echo $'Failed to add matrix admin user';
# exit 879352
#fi
if [[ $(add_user_matrix "${MY_USERNAME}" "${MATRIX_PASSWORD}" | tail -n 1) != "0" ]]; then
echo $'Failed to add matrix admin user';
exit 879352
fi
APP_INSTALLED=1
}