1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/jirafeau_ynh.git synced 2024-09-03 19:35:53 +02:00

[fix] Properly set and save upload password, allowing empty one

This commit is contained in:
Jérôme Lebleu 2015-07-13 22:28:21 +02:00
parent d0fe46eb34
commit d27e1bbfb9
3 changed files with 17 additions and 4 deletions

View file

@ -51,7 +51,7 @@ $cfg['link_name_length'] = 8;
* $cfg['upload_password'] = array('psw1', 'psw2'); // Two passwords * $cfg['upload_password'] = array('psw1', 'psw2'); // Two passwords
* ... and so on * ... and so on
*/ */
$cfg['upload_password'] = array('YNH_UPLOAD_PASSWORD'); $cfg['upload_password'] = array(YNH_UPLOAD_PASSWORD);
/* An empty admin password will disable the classic admin password /* An empty admin password will disable the classic admin password
* authentication. * authentication.
*/ */

View file

@ -25,9 +25,17 @@ fi
# Save specific settings # Save specific settings
sudo yunohost app setting jirafeau admin_user -v $admin_user sudo yunohost app setting jirafeau admin_user -v $admin_user
sudo yunohost app setting jirafeau upload_password -v $upload_password
sudo yunohost app setting jirafeau is_public -v $is_public sudo yunohost app setting jirafeau is_public -v $is_public
# Set and save upload password, allowing an empty one
if [[ -z "$upload_password" ]]; then
sed -i "s@YNH_UPLOAD_PASSWORD@@g" ../conf/config.local.php
sudo yunohost app setting jirafeau upload_password -v ''
else
sed -i "s@YNH_UPLOAD_PASSWORD@'$upload_password'@g" ../conf/config.local.php
sudo yunohost app setting jirafeau upload_password -v $upload_password
fi
# Copy files to the right place # Copy files to the right place
final_path=/var/www/jirafeau final_path=/var/www/jirafeau
var_root=/home/yunohost.app/jirafeau var_root=/home/yunohost.app/jirafeau
@ -37,7 +45,6 @@ sed -i "s@YNH_DOMAIN@$domain@g" ../conf/config.local.php
sed -i "s@YNH_WWW_PATH@$path@g" ../conf/config.local.php sed -i "s@YNH_WWW_PATH@$path@g" ../conf/config.local.php
sed -i "s@YNH_VAR_ROOT@$var_root@g" ../conf/config.local.php sed -i "s@YNH_VAR_ROOT@$var_root@g" ../conf/config.local.php
sed -i "s@YNH_ADMIN_USER@$admin_user@g" ../conf/config.local.php sed -i "s@YNH_ADMIN_USER@$admin_user@g" ../conf/config.local.php
sed -i "s@YNH_UPLOAD_PASSWORD@$upload_password@g" ../conf/config.local.php
sudo cp ../conf/config.local.php $final_path/lib sudo cp ../conf/config.local.php $final_path/lib
sudo rm $final_path/install.php sudo rm $final_path/install.php

View file

@ -9,6 +9,13 @@ is_public=$(sudo yunohost app setting jirafeau is_public)
# Remove trailing "/" for next commands # Remove trailing "/" for next commands
path=${path%/} path=${path%/}
# Set upload password, allowing an empty one
if [[ -z "$upload_password" ]]; then
sed -i "s@YNH_UPLOAD_PASSWORD@@g" ../conf/config.local.php
else
sed -i "s@YNH_UPLOAD_PASSWORD@'$upload_password'@g" ../conf/config.local.php
fi
# Copy files to the right place # Copy files to the right place
final_path=/var/www/jirafeau final_path=/var/www/jirafeau
var_root=/home/yunohost.app/jirafeau var_root=/home/yunohost.app/jirafeau
@ -19,7 +26,6 @@ sed -i "s@YNH_DOMAIN@$domain@g" ../conf/config.local.php
sed -i "s@YNH_WWW_PATH@$path@g" ../conf/config.local.php sed -i "s@YNH_WWW_PATH@$path@g" ../conf/config.local.php
sed -i "s@YNH_VAR_ROOT@$var_root@g" ../conf/config.local.php sed -i "s@YNH_VAR_ROOT@$var_root@g" ../conf/config.local.php
sed -i "s@YNH_ADMIN_USER@$admin_user@g" ../conf/config.local.php sed -i "s@YNH_ADMIN_USER@$admin_user@g" ../conf/config.local.php
sed -i "s@YNH_UPLOAD_PASSWORD@$upload_password@g" ../conf/config.local.php
sudo cp ../conf/config.local.php $final_path/lib sudo cp ../conf/config.local.php $final_path/lib
sudo rm $final_path/install.php sudo rm $final_path/install.php