OCS API should catch LoginExceptions

Catching the login exception and returning false (login failed). Makes
the OCS API properly return data instead of printing the exception page.
This commit is contained in:
Roeland Jago Douma 2016-04-20 16:27:16 +02:00 committed by Thomas Müller
parent 271ba6da63
commit 9b875db8b8
No known key found for this signature in database
GPG key ID: A943788A3BBEC44C

View file

@ -356,7 +356,11 @@ class OC_API {
if(isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_PW']) ) {
$authUser = $_SERVER['PHP_AUTH_USER'];
$authPw = $_SERVER['PHP_AUTH_PW'];
$return = OC_User::login($authUser, $authPw);
try {
$return = OC_User::login($authUser, $authPw);
} catch (\OC\User\LoginException $e) {
return false;
}
if ($return === true) {
self::$logoutRequired = true;