mirror of
https://github.com/YunoHost-Apps/my_webapp_ynh.git
synced 2024-09-03 19:46:26 +02:00
Password strength is to be enforced by the core
This commit is contained in:
parent
3e34a7e69d
commit
421888d137
3 changed files with 4 additions and 21 deletions
|
@ -13,7 +13,7 @@ name = "My webapp configuration"
|
||||||
default = true
|
default = true
|
||||||
|
|
||||||
[main.sftp.password]
|
[main.sftp.password]
|
||||||
ask = "Set a password for the SFTP access. ≥ 5 character"
|
ask = "Set a password for the SFTP access"
|
||||||
type = "password"
|
type = "password"
|
||||||
optional = true
|
optional = true
|
||||||
help = "If a password already exist, it will not be replaced."
|
help = "If a password already exist, it will not be replaced."
|
||||||
|
|
|
@ -119,19 +119,11 @@ apply_config() {
|
||||||
# Change the password only if none was already set for the user
|
# Change the password only if none was already set for the user
|
||||||
if [ $is_password_exist -eq 0 ] && [ $with_sftp -eq 1 ]
|
if [ $is_password_exist -eq 0 ] && [ $with_sftp -eq 1 ]
|
||||||
then
|
then
|
||||||
# Check password strength
|
|
||||||
if [ ${#password} -le 5 ]
|
|
||||||
then
|
|
||||||
ynh_print_err --message="The password is too weak, it must be longer than 5 characters."
|
|
||||||
# Disable the sftp access, as the password is incorrect
|
|
||||||
yunohost app action run $app sftp --args with_sftp=0
|
|
||||||
else
|
|
||||||
# Add the password to the user
|
# Add the password to the user
|
||||||
chpasswd <<< "${app}:${password}"
|
chpasswd <<< "${app}:${password}"
|
||||||
ynh_app_setting_set --app=$app --key=password --value="$password"
|
ynh_app_setting_set --app=$app --key=password --value="$password"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RECONFIGURE PHP-FPM
|
# RECONFIGURE PHP-FPM
|
||||||
|
|
|
@ -39,15 +39,6 @@ ynh_script_progression --message="Validating installation parameters..." --weigh
|
||||||
final_path=/var/www/$app
|
final_path=/var/www/$app
|
||||||
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
|
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
|
||||||
|
|
||||||
if [ $with_sftp -eq 1 ]
|
|
||||||
then
|
|
||||||
# Check password strength
|
|
||||||
if [ ${#password} -le 5 ]
|
|
||||||
then
|
|
||||||
ynh_die --message="The password is too weak, it must be longer than 5 characters"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Register (book) web path
|
# Register (book) web path
|
||||||
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue