Skip to content

Commit d321f63

Browse files
committed
OXDEV-9927 Add check on get code and fix typos
1 parent 49c0735 commit d321f63

6 files changed

Lines changed: 15 additions & 4 deletions

File tree

src/Authentication/TwoFactorAuth/Controller/TwoFactorAuthController.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
* See LICENSE file for license details.
66
*/
77

8+
declare(strict_types=1);
9+
810
namespace OxidEsales\SecurityModule\Authentication\TwoFactorAuth\Controller;
911

1012
use OxidEsales\Eshop\Application\Controller\FrontendController;

src/Authentication/TwoFactorAuth/Exception/AttemptLimitExceededException.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
* See LICENSE file for license details.
66
*/
77

8+
declare(strict_types=1);
9+
810
namespace OxidEsales\SecurityModule\Authentication\TwoFactorAuth\Exception;
911

1012
class AttemptLimitExceededException extends \Exception

src/Authentication/TwoFactorAuth/Transput/AuthCodeRequest.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
namespace OxidEsales\SecurityModule\Authentication\TwoFactorAuth\Transput;
1111

1212
use OxidEsales\EshopCommunity\Internal\Framework\Request\RequestInterface;
13+
use OxidEsales\SecurityModule\Authentication\TwoFactorAuth\Exception\InvalidCodeException;
1314

1415
readonly class AuthCodeRequest implements AuthCodeRequestInterface
1516
{
@@ -20,6 +21,12 @@ public function __construct(
2021

2122
public function getCode(): string
2223
{
23-
return $this->request->get('auth_code');
24+
$code = $this->request->get('auth_code');
25+
26+
if (!is_string($code) || $code === '') {
27+
throw new InvalidCodeException();
28+
}
29+
30+
return $code;
2431
}
2532
}

translations/de/oesecuritymodule_lang.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,5 @@
4545
'TWO_FACTOR_AUTHENTICATION_TITLE' => 'Two Factor Authentication',
4646
'TWO_FACTOR_AUTHENTICATION_DESCRIPTION' => 'Code has been sent to your email. Please enter it below to proceed.',
4747

48-
'RESENT_CODE' => 'Code erneut senden'
48+
'RESEND_CODE' => 'Code erneut senden'
4949
];

translations/en/oesecuritymodule_lang.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,5 @@
4545
'TWO_FACTOR_AUTHENTICATION_TITLE' => 'Two Factor Authentication',
4646
'TWO_FACTOR_AUTHENTICATION_DESCRIPTION' => 'Code has been sent to your email. Please enter it below to proceed.',
4747

48-
'RESENT_CODE' => 'Resend Code'
48+
'RESEND_CODE' => 'Resend Code'
4949
];

views/twig/templates/two_factor_auth.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<button class="btn btn-primary submitButton largeButton" type="submit" id="auth_submit" class="submitButton">{{ translate({ ident: "SUBMIT" }) }}</button>
1414
</div>
1515
<div>
16-
<button class="btn btn-secondary submitButton largeButton" type="button">{{ translate({ ident: "RESENT_CODE" }) }}</button>
16+
<button class="btn btn-secondary submitButton largeButton" type="button">{{ translate({ ident: "RESEND_CODE" }) }}</button>
1717
</div>
1818
</form>
1919
<br>

0 commit comments

Comments
 (0)