Merge pull request #8217 from DCSO/linotp_errormessages

[chg] LinOTP error exceptions up to the ui
pull/8227/head
Alexandre Dulaunoy 2022-03-17 15:48:35 +01:00 committed by GitHub
commit 78d6f8b93f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -138,7 +138,7 @@ class LinOTPAuthenticate extends BaseAuthenticate
if (!$linOTP_baseUrl || $linOTP_baseUrl === "") {
CakeLog::error("LinOTP: Please configure baseUrl.");
if ($mixedauth) {
throw new CakeException(__d('cake_dev', 'LinOTP: Missing "baseUrl" configuration - access denied!', 'authenticate()'));
throw new ForbiddenException(__('LinOTP: Missing "baseUrl" configuration - access denied!'));
} else {
return false;
}
@ -157,7 +157,7 @@ class LinOTPAuthenticate extends BaseAuthenticate
} else {
// Enforce OTP token by Authentication Form
if (!$otp || $otp === "") {
throw new CakeException(__d('cake_dev', 'Missing OTP Token.', 'authenticate()'));
throw new ForbiddenException(__('Missing OTP Token.'));
}
$response = $this->_linotp_verify(
@ -207,7 +207,7 @@ class LinOTPAuthenticate extends BaseAuthenticate
// Don't fall back to FormAuthenticate in mixedauth mode.
// This enforces the second factor.
if ($mixedauth && !self::$user) {
throw new CakeException(__d('cake_dev', 'User could not be authenticated by LinOTP.', 'authenticate()'));
throw new UnauthorizedException(__('User could not be authenticated by LinOTP.'));
}
return self::$user;
}