Skip to content

Commit 26eedd5

Browse files
committed
OXDEV-9927 Add otp template
1 parent b113a13 commit 26eedd5

3 files changed

Lines changed: 78 additions & 0 deletions

File tree

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
3+
/**
4+
* Copyright © OXID eSales AG. All rights reserved.
5+
* See LICENSE file for license details.
6+
*/
7+
8+
declare(strict_types=1);
9+
10+
namespace OxidEsales\SecurityModule\Authentication\TwoFactorAuth\Service;
11+
12+
use OxidEsales\EshopCommunity\Internal\Domain\Authentication\Bridge\PasswordServiceBridgeInterface;
13+
use OxidEsales\SecurityModule\Authentication\TwoFactorAuth\Infrastructure\Factory\UserFactoryInterface;
14+
use OxidEsales\SecurityModule\Authentication\TwoFactorAuth\Infrastructure\Repository\UserRepositoryInterface;
15+
16+
class UserService implements UserServiceInterface
17+
{
18+
public function __construct(
19+
private AuthorizeServiceInterface $authorizeService,
20+
private UserFactoryInterface $userFactory,
21+
private UserRepositoryInterface $userRepository,
22+
private PasswordServiceBridgeInterface $passwordServiceBridge
23+
) {
24+
}
25+
26+
public function handleLogin($userName): void
27+
{
28+
$this->authorizeService->generate($userName);
29+
30+
// redirect to controller and rende template
31+
// use template renderer to render the template
32+
}
33+
34+
public function checkPassword($password, $userName): bool
35+
{
36+
// var_dump($userId);
37+
// $userModel = $this->userFactory->create();
38+
// $userModel->load($userId);
39+
40+
$userPasswordHash = $this->userRepository->getUserPasswordHash($userName);
41+
// var_dump($userPasswordHash);
42+
return $this->passwordServiceBridge
43+
->verifyPassword($password, $userPasswordHash);
44+
}
45+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
/**
4+
* Copyright © OXID eSales AG. All rights reserved.
5+
* See LICENSE file for license details.
6+
*/
7+
8+
namespace OxidEsales\SecurityModule\Authentication\TwoFactorAuth\Service;
9+
10+
interface UserServiceInterface
11+
{
12+
public function handleLogin($userName): void;
13+
14+
public function checkPassword($password, $userId): bool;
15+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{% capture append = "oxidBlock_content" %}
2+
<h1 class="page-header">{{ translate({ ident: "TWO_FACTOR_AUTHENTICATION_TITLE" }) }}</h1>
3+
<br>
4+
<form action="{{ oViewConf.getSelfLink()|raw }}" name="two_factor_auth" method="post" role="form">
5+
<div class="hidden">
6+
{{ oViewConf.getHiddenSid()|raw }}
7+
<input type="hidden" name="cl" value="twofactorauth">
8+
<input type="hidden" name="fnc" value="handleOTP">
9+
</div>
10+
<div>
11+
<input type="text" class="editinput" maxlength="254" id="auth_code" name="auth_code" value="">
12+
<button class="btn btn-primary submitButton largeButton" type="submit" id="auth_submit" class="submitButton">{{ translate({ ident: "SUBMIT" }) }}</button>
13+
</div>
14+
</form>
15+
<br>
16+
{% endcapture %}
17+
18+
{% include "layout/page.html.twig" %}

0 commit comments

Comments
 (0)