1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/nextcloud_ynh.git synced 2024-09-03 19:55:57 +02:00
nextcloud_ynh/sources/patches_last_version/app-00-add-logout_url-conf.patch
ljf (zamentur) 830f904804
[fix] redirect logout (#636)
* [fix] Logout on sso if needed

* Auto-update README

* [fix] Bad path in patch

---------

Co-authored-by: yunohost-bot <yunohost@yunohost.org>
Co-authored-by: Éric Gaspar <46165813+ericgaspar@users.noreply.github.com>
Co-authored-by: ericgaspar <junk.eg@free.fr>
2024-04-24 22:31:50 +02:00

32 lines
1.5 KiB
Diff

diff --git a/core/Controller/LoginController.php b/core/Controller/LoginController.php
index aa6617c..eb47b80 100644
--- a/core/Controller/LoginController.php
+++ b/core/Controller/LoginController.php
@@ -111,16 +111,20 @@ class LoginController extends Controller {
#[UseSession]
public function logout() {
$loginToken = $this->request->getCookie('nc_token');
+ $uuidUser = $this->userSession->getUser()->getUID();
+ $isLdapUser = $this->config->getUserValue($uuidUser, 'user_ldap', 'uid');
if (!is_null($loginToken)) {
- $this->config->deleteUserValue($this->userSession->getUser()->getUID(), 'login_token', $loginToken);
+ $this->config->deleteUserValue($uuidUser, 'login_token', $loginToken);
}
$this->userSession->logout();
-
- $response = new RedirectResponse($this->urlGenerator->linkToRouteAbsolute(
- 'core.login.showLoginForm',
- ['clear' => true] // this param the code in login.js may be removed when the "Clear-Site-Data" is working in the browsers
- ));
-
+ $redirectUrl = $this->urlGenerator->linkToRouteAbsolute(
+ 'core.login.showLoginForm',
+ ['clear' => true] // this param the code in login.js may be removed when the "Clear-Site-Data" is working in the browsers)
+ );
+ if (!is_null($isLdapUser)) {
+ $redirectUrl = $this->config->getSystemValue('logout_url', $redirectUrl);
+ }
+ $response = new RedirectResponse($redirectUrl);
$this->session->set('clearingExecutionContexts', '1');
$this->session->close();