mirror of
https://github.com/YunoHost-Apps/movim_ynh.git
synced 2024-09-03 19:46:19 +02:00
[enh] Redirect to the SSO dynamically on logging out
This commit is contained in:
parent
56a1fa361b
commit
5decd0dd65
4 changed files with 27 additions and 4 deletions
13
patches/sso-logout.patch
Normal file
13
patches/sso-logout.patch
Normal file
|
@ -0,0 +1,13 @@
|
|||
diff --git a/app/controllers/DisconnectController.php b/app/controllers/DisconnectController.php
|
||||
index 7af0d4b..74f0c61 100644
|
||||
--- a/app/controllers/DisconnectController.php
|
||||
+++ b/app/controllers/DisconnectController.php
|
||||
@@ -13,6 +13,7 @@ class DisconnectController extends Base
|
||||
|
||||
Session::dispose();
|
||||
|
||||
- $this->redirect('login');
|
||||
+ $main_domain = exec('cat /etc/yunohost/current_host');
|
||||
+ header('Location: https://' . $main_domain . '/yunohost/sso/?action=logout');
|
||||
}
|
||||
}
|
|
@ -11,6 +11,9 @@ HEAD_COMMIT="512523576b03c2c8952305e70681ed31172b9fd2"
|
|||
# Source code destination directory
|
||||
DESTDIR="/var/www/movim"
|
||||
|
||||
# App package root directory should be the parent folder
|
||||
PKGDIR=$(cd ../; pwd)
|
||||
|
||||
#
|
||||
# Common helpers
|
||||
#
|
||||
|
@ -21,3 +24,12 @@ exec_cmd() {
|
|||
(cd "$DESTDIR" \
|
||||
&& sudo sudo -u movim "$@")
|
||||
}
|
||||
|
||||
# Apply the SSO patch to Movim source code
|
||||
# usage: apply_sso_patch
|
||||
apply_sso_patch() {
|
||||
local patch_path="/tmp/sso-logout.patch"
|
||||
cp -f "${PKGDIR}/patches/sso-logout.patch" "$patch_path"
|
||||
exec_cmd git apply "$patch_path"
|
||||
rm -f "$patch_path"
|
||||
}
|
||||
|
|
|
@ -134,8 +134,7 @@ if [[ "$ssoenabled" = "0" ]]; then
|
|||
exec_cmd php mud.php config --xmppwhitelist="$domain"
|
||||
else
|
||||
ynh_app_setting_set "$app" unprotected_uris "/"
|
||||
# Next line is to avoid SSO to auto-connect just after disconnect
|
||||
sudo sed -i "s@redirect('login')@redirect('')@g" $DESTDIR/app/controllers/DisconnectController.php
|
||||
apply_sso_patch
|
||||
fi
|
||||
|
||||
# Start Movim
|
||||
|
|
|
@ -66,8 +66,7 @@ if [[ "$ssoenabled" =~ ^0|No$ ]]; then
|
|||
exec_cmd php mud.php config --xmppwhitelist=$domain
|
||||
else
|
||||
ynh_app_setting_set "$app" unprotected_uris "/"
|
||||
# Next line is to avoid SSO to auto-connect just after disconnect
|
||||
sudo sed -i "s@redirect('login')@redirect('')@g" $DESTDIR/app/controllers/DisconnectController.php
|
||||
apply_sso_patch
|
||||
fi
|
||||
|
||||
# Update init scripts
|
||||
|
|
Loading…
Add table
Reference in a new issue