mirror of
https://github.com/YunoHost-Apps/agendav_ynh.git
synced 2024-09-03 20:36:12 +02:00
Merge pull request #27 from YunoHost-Apps/fix_testing
Fix certificat issue
This commit is contained in:
commit
3809218562
6 changed files with 57 additions and 35 deletions
|
@ -4,18 +4,16 @@
|
|||
domain="domain.tld" (DOMAIN)
|
||||
path="/path" (PATH)
|
||||
language="fr"
|
||||
disablecacheck=1
|
||||
; pre-install
|
||||
sudo yunohost app fetchlist
|
||||
sudo yunohost domain add --verbose baikaldomain.tld --admin-password $PASSWORD
|
||||
sudo yunohost domain add baikaldomain.tld --admin-password $PASSWORD
|
||||
sudo yunohost app install baikal -a "domain=baikaldomain.tld&path=/baikal&password=admin"
|
||||
; Checks
|
||||
pkg_linter=1
|
||||
setup_sub_dir=1
|
||||
setup_root=0
|
||||
setup_nourl=0
|
||||
# Private test only should be fixed in package check before.
|
||||
# setup_private=1
|
||||
setup_private=1
|
||||
setup_public=0
|
||||
upgrade=1
|
||||
backup_restore=1
|
||||
|
|
|
@ -40,7 +40,7 @@ $app['caldav.baseurl'] = '{CALDAV_BASEURL}';
|
|||
$app['caldav.authmethod'] = 'basic';
|
||||
|
||||
// Do not verify SSL certificate, it is self signed
|
||||
$app['caldav.certificate.verify'] = __CACHECK__;
|
||||
$app['caldav.certificate.verify'] = false;
|
||||
|
||||
// Whether to show public CalDAV urls
|
||||
$app['caldav.publicurls'] = true;
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
},
|
||||
"multi_instance": false,
|
||||
"requirements": {
|
||||
"yunohost": ">= 2.7.0"
|
||||
"yunohost": ">= 3.0.0"
|
||||
},
|
||||
"services": [
|
||||
"nginx",
|
||||
|
@ -53,14 +53,6 @@
|
|||
"de", "en", "es", "fr", "it", "nl"
|
||||
],
|
||||
"default": "en"
|
||||
},
|
||||
{
|
||||
"name": "disablecacheck",
|
||||
"ask": {
|
||||
"en": "Disable certificate checks? (if not using a valid certificate)"
|
||||
},
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@ ynh_abort_if_errors
|
|||
domain=$YNH_APP_ARG_DOMAIN
|
||||
path_url=$YNH_APP_ARG_PATH
|
||||
language=$YNH_APP_ARG_LANGUAGE
|
||||
disablecacheck=$YNH_APP_ARG_DISABLECACHECK
|
||||
|
||||
# Set and store language
|
||||
language=${LANGUAGES[$language]}
|
||||
|
@ -75,7 +74,6 @@ fi
|
|||
ynh_app_setting_set "$app" language "$language"
|
||||
ynh_app_setting_set "$app" path "$path_url"
|
||||
ynh_app_setting_set "$app" domain "$domain"
|
||||
ynh_app_setting_set "$app" disablecacheck "$disablecacheck"
|
||||
ynh_app_setting_set "$app" final_path "$final_path"
|
||||
|
||||
#=================================================
|
||||
|
@ -151,12 +149,6 @@ ynh_replace_string "{LANGUAGE}" "${language}" "$conf_path"
|
|||
ynh_replace_string "{CALDAV_BASEURL}" "${caldav_url}${caldav_baseurl}" "$conf_path"
|
||||
ynh_replace_string "{CALDAV_DOMAIN}" "${caldav_domain}" "$conf_path"
|
||||
|
||||
if [ "$disablecacheck" -eq 0 ]; then
|
||||
ynh_replace_string "__CACHECK__" "true" "$conf_path"
|
||||
else
|
||||
ynh_replace_string "__CACHECK__" "false" "$conf_path"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# STORE THE CHECKSUM OF THE CONFIG FILE
|
||||
#=================================================
|
||||
|
|
|
@ -24,7 +24,6 @@ path_url=$(ynh_app_setting_get "$app" path)
|
|||
dbpass=$(ynh_app_setting_get "$app" mysqlpwd)
|
||||
encryptkey=$(ynh_app_setting_get "$app" encryptkey)
|
||||
language=$(ynh_app_setting_get "$app" language)
|
||||
disablecacheck=$(ynh_app_setting_get "$app" disablecacheck)
|
||||
|
||||
LOGDIR=/var/log/$app
|
||||
|
||||
|
@ -59,12 +58,6 @@ if [ -z "$db_name" ]; then
|
|||
ynh_app_setting_set "$app" db_name "$db_name"
|
||||
fi
|
||||
|
||||
# If disablecacheck doesn't exist, create it
|
||||
if [ -z "$disablecacheck" ]; then
|
||||
disablecacheck=0
|
||||
ynh_app_setting_set "$app" disablecacheck "$disablecacheck"
|
||||
fi
|
||||
|
||||
# If final_path doesn't exist, create it
|
||||
if [ -z "$final_path" ]; then
|
||||
final_path=/var/www/$app
|
||||
|
@ -170,12 +163,6 @@ ynh_replace_string "{LANGUAGE}" "${language}" "$conf_path"
|
|||
ynh_replace_string "{CALDAV_BASEURL}" "${caldav_url}${caldav_baseurl}" "$conf_path"
|
||||
ynh_replace_string "{CALDAV_DOMAIN}" "${caldav_domain}" "$conf_path"
|
||||
|
||||
if [ "$disablecacheck" -eq 0 ]; then
|
||||
ynh_replace_string "__CACHECK__" "true" "$conf_path"
|
||||
else
|
||||
ynh_replace_string "__CACHECK__" "false" "$conf_path"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# STORE THE CHECKSUM OF THE CONFIG FILE
|
||||
#=================================================
|
||||
|
|
53
sources/patches/app-00-add-http-auth.patch
Normal file
53
sources/patches/app-00-add-http-auth.patch
Normal file
|
@ -0,0 +1,53 @@
|
|||
--- a/web/app/controllers.php
|
||||
+++ b/web/app/controllers.php
|
||||
@@ -58,14 +58,20 @@ $controllers->before(function(Request $request, Silex\Application $app) {
|
||||
// processing the request
|
||||
if ($app['session']->has('username')) {
|
||||
$username = $app['session']->get('username');
|
||||
- $preferences = $app['preferences.repository']->userPreferences($username);
|
||||
- $app['user.preferences'] = $preferences;
|
||||
- $app['user.timezone'] = $preferences->get('timezone');
|
||||
-
|
||||
- // Set application language
|
||||
- $request->setLocale($preferences->get('language'));
|
||||
- $app['translator']->setLocale($preferences->get('language'));
|
||||
- return;
|
||||
+ // Clear user session if HTTP authentication changed
|
||||
+ if (isset($_SERVER['PHP_AUTH_USER'])
|
||||
+ && $username != $_SERVER['PHP_AUTH_USER']) {
|
||||
+ $app['session']->clear();
|
||||
+ } else {
|
||||
+ $preferences = $app['preferences.repository']->userPreferences($username);
|
||||
+ $app['user.preferences'] = $preferences;
|
||||
+ $app['user.timezone'] = $preferences->get('timezone');
|
||||
+
|
||||
+ // Set application language
|
||||
+ $request->setLocale($preferences->get('language'));
|
||||
+ $app['translator']->setLocale($preferences->get('language'));
|
||||
+ return;
|
||||
+ }
|
||||
}
|
||||
|
||||
if ($request->isXmlHttpRequest()) {
|
||||
diff --git a/web/src/Controller/Authentication.php b/web/src/Controller/Authentication.php
|
||||
index deebb751..134cc9a8 100644
|
||||
--- a/web/src/Controller/Authentication.php
|
||||
+++ b/web/src/Controller/Authentication.php
|
||||
@@ -34,9 +34,14 @@ class Authentication
|
||||
$success = false;
|
||||
$template_vars = [];
|
||||
|
||||
- if ($request->isMethod('POST')) {
|
||||
- $user = $request->request->get('user');
|
||||
- $password = $request->request->get('password');
|
||||
+ if ($request->isMethod('POST') || isset($_SERVER['PHP_AUTH_USER'])) {
|
||||
+ if (isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_PW'])) {
|
||||
+ $user = $_SERVER['PHP_AUTH_USER'];
|
||||
+ $password = $_SERVER['PHP_AUTH_PW'];
|
||||
+ } else {
|
||||
+ $user = $request->request->get('user');
|
||||
+ $password = $request->request->get('password');
|
||||
+ }
|
||||
|
||||
if (empty($user) || empty($password)) {
|
||||
$template_vars['error'] = $app['translator']->trans('messages.error_empty_fields');
|
Loading…
Add table
Reference in a new issue