Skip to content

Commit 25cd363

Browse files
committed
Psalm fixes
1 parent 028fc5e commit 25cd363

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

lib/Auth/Source/YubiKey.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@ public static function handleLogin($authStateId, $otp)
141141

142142
/* Find authentication source. */
143143
assert(array_key_exists(self::AUTHID, $state));
144+
145+
/** @var \SimpleSAML\Module\authYubiKey\Auth\Source\YubiKey $source */
144146
$source = \SimpleSAML\Auth\Source::getById($state[self::AUTHID]);
145147
if ($source === null) {
146148
throw new \Exception('Could not find authentication source with id '.$state[self::AUTHID]);

www/yubikeylogin.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,12 @@
2323
// attempt to log in
2424
$errorCode = \SimpleSAML\Module\authYubiKey\Auth\Source\YubiKey::handleLogin($authStateId, $_REQUEST['otp']);
2525
$errorCodes = \SimpleSAML\Error\ErrorCodes::getAllErrorCodeMessages();
26-
$t->data['errorTitle'] = $errorCodes['title'][$errorCode];
27-
$t->data['errorDesc'] = $errorCodes['desc'][$errorCode];
26+
if (array_key_exists($errorCode, $errorCodes['title'])) {
27+
$t->data['errorTitle'] = $errorCodes['title'][$errorCode];
28+
}
29+
if (array_key_exists($errorCode, $errorCodes['desc'])) {
30+
$t->data['errorDesc'] = $errorCodes['desc'][$errorCode];
31+
}
2832
}
2933

3034
$t->data['header'] = $translator->t('{authYubiKey:yubikey:header}');

0 commit comments

Comments
 (0)