mirror of
https://github.com/YunoHost-Apps/monica_ynh.git
synced 2024-09-03 19:46:23 +02:00
Added support to enable dav,signup and 2FA
This commit is contained in:
parent
b64f7ede59
commit
ad4995f41f
5 changed files with 87 additions and 5 deletions
|
@ -10,6 +10,9 @@
|
||||||
admin="john" (USER)
|
admin="john" (USER)
|
||||||
is_public=1 (PUBLIC|public=1|private=0)
|
is_public=1 (PUBLIC|public=1|private=0)
|
||||||
language="fr"
|
language="fr"
|
||||||
|
dav_support=1 (DAV_SUPPORT|dav_support=1|dav_support=0)
|
||||||
|
signup=0 (SIGNUP|signup=1|signup=0)
|
||||||
|
two_factor=0 (TWO_FACTOR|two_factor=1|two_factor=0)
|
||||||
; Checks
|
; Checks
|
||||||
pkg_linter=1
|
pkg_linter=1
|
||||||
setup_sub_dir=0
|
setup_sub_dir=0
|
||||||
|
|
|
@ -68,7 +68,7 @@ APP_DEFAULT_LOCALE=language
|
||||||
|
|
||||||
# Ability to disable signups on your instance.
|
# Ability to disable signups on your instance.
|
||||||
# Can be true or false. Default to false.
|
# Can be true or false. Default to false.
|
||||||
APP_DISABLE_SIGNUP=false
|
APP_DISABLE_SIGNUP=__SIGNUP__
|
||||||
|
|
||||||
# Enable user email verification.
|
# Enable user email verification.
|
||||||
APP_SIGNUP_DOUBLE_OPTIN=false
|
APP_SIGNUP_DOUBLE_OPTIN=false
|
||||||
|
@ -132,10 +132,10 @@ AWS_BUCKET=
|
||||||
AWS_SERVER=
|
AWS_SERVER=
|
||||||
|
|
||||||
# Allow Two Factor Authentication feature on your instance
|
# Allow Two Factor Authentication feature on your instance
|
||||||
MFA_ENABLED=true
|
MFA_ENABLED=__TWO_FACTOR__
|
||||||
|
|
||||||
# Enable DAV support
|
# Enable DAV support
|
||||||
DAV_ENABLED=true
|
DAV_ENABLED=__DAV__
|
||||||
|
|
||||||
# CLIENT ID and SECRET used for OAuth authentication
|
# CLIENT ID and SECRET used for OAuth authentication
|
||||||
PASSPORT_PERSONAL_ACCESS_CLIENT_ID=__IDENTITY__
|
PASSPORT_PERSONAL_ACCESS_CLIENT_ID=__IDENTITY__
|
||||||
|
|
|
@ -70,6 +70,30 @@
|
||||||
},
|
},
|
||||||
"choices": ["cs","de","en","es","fr","he","it","nl","pt","ru","zh"],
|
"choices": ["cs","de","en","es","fr","he","it","nl","pt","ru","zh"],
|
||||||
"default": "en"
|
"default": "en"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "dav_support",
|
||||||
|
"type": "boolean",
|
||||||
|
"ask": {
|
||||||
|
"en": "Enable DAV support?"
|
||||||
|
},
|
||||||
|
"default": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "signup",
|
||||||
|
"type": "boolean",
|
||||||
|
"ask": {
|
||||||
|
"en": "Enable signup for public users?"
|
||||||
|
},
|
||||||
|
"default": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "two_factor",
|
||||||
|
"type": "boolean",
|
||||||
|
"ask": {
|
||||||
|
"en": "Enable Two Factor Authentication for accounts?"
|
||||||
|
},
|
||||||
|
"default": false
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,9 @@ language=$YNH_APP_ARG_LANGUAGE
|
||||||
random_key=$(ynh_string_random --length=32)
|
random_key=$(ynh_string_random --length=32)
|
||||||
email=$(ynh_user_get_info $admin 'mail')
|
email=$(ynh_user_get_info $admin 'mail')
|
||||||
password=$(ynh_string_random --length=8)
|
password=$(ynh_string_random --length=8)
|
||||||
|
dav_support=$YNH_APP_ARG_DAV_SUPPORT
|
||||||
|
signup=$YNH_APP_ARG_SIGNUP
|
||||||
|
two_factor=$YNH_APP_ARG_TWO_FACTOR
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
@ -55,6 +58,9 @@ ynh_app_setting_set --app=$app --key=admin --value=$admin
|
||||||
ynh_app_setting_set --app=$app --key=is_public --value=$is_public
|
ynh_app_setting_set --app=$app --key=is_public --value=$is_public
|
||||||
ynh_app_setting_set --app=$app --key=language --value=$language
|
ynh_app_setting_set --app=$app --key=language --value=$language
|
||||||
ynh_app_setting_set --app=$app --key=random_key --value=$random_key
|
ynh_app_setting_set --app=$app --key=random_key --value=$random_key
|
||||||
|
ynh_app_setting_set --app=$app --key=dav_support --value=$dav_support
|
||||||
|
ynh_app_setting_set --app=$app --key=signup --value=$signup
|
||||||
|
ynh_app_setting_set --app=$app --key=two_factor --value=$two_factor
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD MODIFICATIONS
|
# STANDARD MODIFICATIONS
|
||||||
|
@ -134,6 +140,30 @@ ynh_replace_string --match_string="yunobase" --replace_string="$db_name" --targe
|
||||||
ynh_replace_string --match_string="yunomail" --replace_string="$email" --target_file="$config"
|
ynh_replace_string --match_string="yunomail" --replace_string="$email" --target_file="$config"
|
||||||
ynh_replace_string --match_string="yunodomain" --replace_string="$domain" --target_file="$config"
|
ynh_replace_string --match_string="yunodomain" --replace_string="$domain" --target_file="$config"
|
||||||
ynh_replace_string --match_string="language" --replace_string="$language" --target_file="$config"
|
ynh_replace_string --match_string="language" --replace_string="$language" --target_file="$config"
|
||||||
|
# Enable or disable DAV support for users
|
||||||
|
if [ $dav_support -eq 0 ]
|
||||||
|
then
|
||||||
|
ynh_replace_string --match_string="__DAV__" --replace_string="false" --target_file="$config"
|
||||||
|
else
|
||||||
|
then
|
||||||
|
ynh_replace_string --match_string="__DAV__" --replace_string="true" --target_file="$config"
|
||||||
|
fi
|
||||||
|
# Enable or disable signup for public users
|
||||||
|
if [ $signup -eq 1 ]
|
||||||
|
then
|
||||||
|
ynh_replace_string --match_string="__SIGNUP__" --replace_string="false" --target_file="$config"
|
||||||
|
else
|
||||||
|
then
|
||||||
|
ynh_replace_string --match_string="__SIGNUP__" --replace_string="true" --target_file="$config"
|
||||||
|
fi
|
||||||
|
# Enable or disable two factor authentication support for users
|
||||||
|
if [ $two_factor -eq 1 ]
|
||||||
|
then
|
||||||
|
ynh_replace_string --match_string="__TWO_FACTOR__" --replace_string="true" --target_file="$config"
|
||||||
|
else
|
||||||
|
then
|
||||||
|
ynh_replace_string --match_string="__TWO_FACTOR__" --replace_string="false" --target_file="$config"
|
||||||
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DEPLOY
|
# DEPLOY
|
||||||
|
@ -141,8 +171,7 @@ ynh_replace_string --match_string="language" --replace_string="$language" --targ
|
||||||
ynh_script_progression --message="Deploying..."
|
ynh_script_progression --message="Deploying..."
|
||||||
|
|
||||||
pushd "$final_path"
|
pushd "$final_path"
|
||||||
php$phpversion artisan monica:update --force
|
php$phpversion artisan setup:production --email=$email --password=$password -vvv -n --force
|
||||||
php$phpversion artisan setup:production --email=$email --password=$password -vvv -n
|
|
||||||
php$phpversion artisan passport:client --password -n > key.txt
|
php$phpversion artisan passport:client --password -n > key.txt
|
||||||
mobile_id=$( cd $final_path && tail -2 key.txt | head -1 | cut -c 12- )
|
mobile_id=$( cd $final_path && tail -2 key.txt | head -1 | cut -c 12- )
|
||||||
mobile_key=$( cd $final_path && tail -1 key.txt | cut -c 16- )
|
mobile_key=$( cd $final_path && tail -1 key.txt | cut -c 16- )
|
||||||
|
|
|
@ -28,6 +28,9 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||||
random_key=$(ynh_app_setting_get --app=$app --key=random_key)
|
random_key=$(ynh_app_setting_get --app=$app --key=random_key)
|
||||||
email=$(ynh_user_get_info --username=$admin --key=mail)
|
email=$(ynh_user_get_info --username=$admin --key=mail)
|
||||||
|
dav_support=$(ynh_app_setting_get --app=$app --key=dav_support)
|
||||||
|
signup=$(ynh_app_setting_get --app=$app --key=signup)
|
||||||
|
two_factor=$(ynh_app_setting_get --app=$app --key=two_factor)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK VERSION
|
# CHECK VERSION
|
||||||
|
@ -165,6 +168,29 @@ ynh_replace_string --match_string="yunomail" --replace_string="$email" -
|
||||||
ynh_replace_string --match_string="yunodomain" --replace_string="$domain" --target_file="$config"
|
ynh_replace_string --match_string="yunodomain" --replace_string="$domain" --target_file="$config"
|
||||||
ynh_replace_string --match_string="language" --replace_string="$language" --target_file="$config"
|
ynh_replace_string --match_string="language" --replace_string="$language" --target_file="$config"
|
||||||
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$config"
|
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$config"
|
||||||
|
if [ $dav_support -eq 0 ]
|
||||||
|
then
|
||||||
|
ynh_replace_string --match_string="__DAV__" --replace_string="false" --target_file="$config"
|
||||||
|
else
|
||||||
|
then
|
||||||
|
ynh_replace_string --match_string="__DAV__" --replace_string="true" --target_file="$config"
|
||||||
|
fi
|
||||||
|
# Enable or disable signup for public users
|
||||||
|
if [ $signup -eq 1 ]
|
||||||
|
then
|
||||||
|
ynh_replace_string --match_string="__SIGNUP__" --replace_string="false" --target_file="$config"
|
||||||
|
else
|
||||||
|
then
|
||||||
|
ynh_replace_string --match_string="__SIGNUP__" --replace_string="true" --target_file="$config"
|
||||||
|
fi
|
||||||
|
# Enable or disable two factor authentication support for users
|
||||||
|
if [ $two_factor -eq 1 ]
|
||||||
|
then
|
||||||
|
ynh_replace_string --match_string="__TWO_FACTOR__" --replace_string="true" --target_file="$config"
|
||||||
|
else
|
||||||
|
then
|
||||||
|
ynh_replace_string --match_string="__TWO_FACTOR__" --replace_string="false" --target_file="$config"
|
||||||
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DEPLOYMENT
|
# DEPLOYMENT
|
||||||
|
|
Loading…
Add table
Reference in a new issue