Skip to content

Commit 5dbbc86

Browse files
committed
allow to use 'authenticate' without logging in
1 parent 2416814 commit 5dbbc86

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

lib/Horde/Core/Auth/Application.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,12 @@ public function authenticate($userId, $credentials, $login = true)
128128
return false;
129129
}
130130

131-
try {
132-
list($userId, $credentials) = $this->runHook(trim($userId), $credentials, 'preauthenticate', 'authenticate');
133-
} catch (Horde_Auth_Exception $e) {
134-
return false;
131+
if ($login) {
132+
try {
133+
list($userId, $credentials) = $this->runHook(trim($userId), $credentials, 'preauthenticate', 'authenticate');
134+
} catch (Horde_Auth_Exception $e) {
135+
return false;
136+
}
135137
}
136138

137139
if ($this->_base) {
@@ -141,7 +143,9 @@ public function authenticate($userId, $credentials, $login = true)
141143
} elseif (!parent::authenticate($userId, $credentials, $login)) {
142144
return false;
143145
}
144-
146+
if (!$login) {
147+
return true;
148+
}
145149
/* Remember the user's mode choice, if applicable. */
146150
if (!empty($credentials['mode'])) {
147151
$this->_view = $credentials['mode'];

0 commit comments

Comments
 (0)