1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/horde_ynh.git synced 2024-09-03 19:16:08 +02:00
horde_ynh/sources/sso_auth.patch

40 lines
1.3 KiB
Diff
Raw Normal View History

2018-02-06 14:33:23 +01:00
diff -Naur a/login.php b/login.php
--- a/login.php 2018-01-06 22:18:02.000000000 +0100
+++ b/login.php 2018-01-06 23:13:50.562577137 +0100
@@ -130,7 +130,8 @@
/* Explicitly set language in un-authenticated session. */
$registry->setLanguage($GLOBALS['language']);
} elseif (Horde_Util::getPost('login_post') ||
- Horde_Util::getPost('login_button')) {
+ Horde_Util::getPost('login_button') ||
+ !empty($_SERVER['REMOTE_USER'])) {
$select_view = Horde_Util::getPost('horde_select_view');
if ($select_view == 'mobile_nojs') {
$nojs = true;
@@ -144,6 +145,16 @@
'password' => Horde_Util::getPost('horde_pass'),
'mode' => $select_view
);
+ $user = Horde_Util::getPost('horde_user');
+
+ /* Get auth from SSO */
+ if ($_SERVER['PHP_AUTH_PW']) {
+ $auth_params = array(
+ 'password' => $_SERVER['PHP_AUTH_PW'],
+ 'mode' => $select_view
+ );
+ $user = $_SERVER['REMOTE_USER'];
+ }
try {
$result = $auth->getLoginParams();
@@ -152,7 +163,7 @@
}
} catch (Horde_Exception $e) {}
- if ($auth->authenticate(Horde_Util::getPost('horde_user'), $auth_params)) {
+ if ($auth->authenticate($user, $auth_params)) {
Horde::log(
sprintf(
'Login success for %s to %s (%s)',