Skip to content

Commit 0f2e425

Browse files
committed
Merge branch 'release/1.1.3'
2 parents 94442e7 + 101b81e commit 0f2e425

6 files changed

Lines changed: 94 additions & 36 deletions

File tree

CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,25 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1111

1212
- nothing, yet
1313

14+
## [1.1.3] - 2019-05-04
15+
16+
### Changed
17+
18+
- provide `TYPO3\CMS\Lang\LanguageService` via constructor injection
19+
in `CodeFareith\CfGoogleAuthenticator\Controller\Frontend\SetupController`
20+
- use `CodeFareith\CfGoogleAuthenticator\Domain\Repository\FrontendUserRepository` instead of
21+
`TYPO3\CMS\Extbase\Domain\Repository\FrontendUserRepository` in `CodeFareith\CfGoogleAuthenticator\Controller\Frontend\SetupController`
22+
- remove object mapping in `setup.typoscript` and move table mapping to `ext_typoscript_setup.typoscript`
23+
24+
### Added
25+
26+
#### Files
27+
28+
- Classes/Domain/Repository/FrontendUserRepository
29+
- ext_typoscript_setup.typoscript
30+
31+
32+
1433
## [1.1.2] - 2018-10-15
1534

1635
### Changed

Classes/Controller/Frontend/SetupController.php

Lines changed: 37 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,21 @@
1515
use CodeFareith\CfGoogleAuthenticator\Domain\Form\SetupForm;
1616
use CodeFareith\CfGoogleAuthenticator\Domain\Immutable\AuthenticationSecret;
1717
use CodeFareith\CfGoogleAuthenticator\Domain\Model\FrontendUser;
18+
use CodeFareith\CfGoogleAuthenticator\Domain\Repository\FrontendUserRepository;
1819
use CodeFareith\CfGoogleAuthenticator\Service\GoogleQrCodeGenerator;
1920
use CodeFareith\CfGoogleAuthenticator\Service\QrCodeGeneratorInterface;
20-
use CodeFareith\CfGoogleAuthenticator\Traits\GeneralUtilityContext;
2121
use CodeFareith\CfGoogleAuthenticator\Utility\Base32Utility;
2222
use CodeFareith\CfGoogleAuthenticator\Utility\PathUtility;
2323
use CodeFareith\CfGoogleAuthenticator\Validation\Validator\SetupFormValidator;
24+
use Exception;
2425
use TYPO3\CMS\Core\Messaging\FlashMessage;
25-
use TYPO3\CMS\Extbase\Domain\Repository\FrontendUserRepository;
2626
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
2727
use TYPO3\CMS\Extbase\Mvc\Exception\NoSuchArgumentException;
28+
use TYPO3\CMS\Extbase\Mvc\Exception\StopActionException;
29+
use TYPO3\CMS\Extbase\Mvc\Exception\UnsupportedRequestTypeException;
30+
use TYPO3\CMS\Extbase\Object\InvalidClassException;
31+
use TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException;
32+
use TYPO3\CMS\Extbase\Persistence\Exception\UnknownObjectException;
2833
use TYPO3\CMS\Lang\LanguageService;
2934

3035
/**
@@ -50,6 +55,9 @@ class SetupController
5055
/** @var SetupFormValidator */
5156
protected $setupFormValidator;
5257

58+
/** @var LanguageService */
59+
protected $languageService;
60+
5361
/** @var AuthenticationSecret */
5462
private $authenticationSecret;
5563

@@ -59,18 +67,20 @@ class SetupController
5967
public function __construct(
6068
FrontendUserRepository $frontendUserRepository,
6169
GoogleQrCodeGenerator $qrCodeGenerator,
62-
SetupFormValidator $setupFormValidator
70+
SetupFormValidator $setupFormValidator,
71+
LanguageService $languageService
6372
)
6473
{
6574
parent::__construct();
6675

6776
$this->frontendUserRepository = $frontendUserRepository;
6877
$this->qrCodeGenerator = $qrCodeGenerator;
6978
$this->setupFormValidator = $setupFormValidator;
79+
$this->languageService = $languageService;
7080
}
7181

7282
/**
73-
* @throws \Exception
83+
* @throws Exception
7484
*/
7585
public function indexAction(): void
7686
{
@@ -107,10 +117,10 @@ public function initializeUpdateAction(): void
107117

108118
/**
109119
* @throws NoSuchArgumentException
110-
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\StopActionException
111-
* @throws \TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException
112-
* @throws \TYPO3\CMS\Extbase\Persistence\Exception\UnknownObjectException
113-
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\UnsupportedRequestTypeException
120+
* @throws StopActionException
121+
* @throws IllegalObjectTypeException
122+
* @throws UnknownObjectException
123+
* @throws UnsupportedRequestTypeException
114124
*/
115125
public function updateAction(): void
116126
{
@@ -155,7 +165,7 @@ private function isUserLoggedin(): bool
155165
}
156166

157167
/**
158-
* @throws \Exception
168+
* @throws Exception
159169
*/
160170
private function getAuthenticationSecret(): AuthenticationSecret
161171
{
@@ -195,7 +205,7 @@ private function getUsername(): string
195205
}
196206

197207
/**
198-
* @throws \Exception
208+
* @throws Exception
199209
*/
200210
private function getSecretKey(): string
201211
{
@@ -226,16 +236,30 @@ private function isGoogleAuthenticatorEnabled(): bool
226236
}
227237

228238
/**
229-
* @throws \Exception
239+
* @throws Exception
230240
*/
231241
private function getSetupForm(): SetupForm
232242
{
233243
/** @noinspection PhpMethodParametersCountMismatchInspection */
234-
return $this->objectManager->get(
244+
$object = $this->objectManager->get(
235245
SetupForm::class,
236246
$this->getAuthenticationSecret()->getSecretKey(),
237247
''
238248
);
249+
250+
if (!$object instanceof SetupForm) {
251+
throw new InvalidClassException(
252+
\vsprintf(
253+
'Invalid class. Expected "%s", got "%s".',
254+
[
255+
SetupForm::class,
256+
\get_class($object),
257+
]
258+
)
259+
);
260+
}
261+
262+
return $object;
239263
}
240264

241265
/**
@@ -274,6 +298,6 @@ private function getFrontendUserId(): int
274298

275299
private function getLanguageService(): LanguageService
276300
{
277-
return $GLOBALS['LANG'];
301+
return $this->languageService;
278302
}
279303
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
/**
3+
* @author Robin 'codeFareith' von den Bergen <robinvonberg@gmx.de>
4+
* @copyright (c) 2018 by Robin von den Bergen
5+
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
6+
* @version 1.0.0
7+
*
8+
* @link https://github.com/codeFareith/cf_google_authenticator
9+
* @see https://www.fareith.de
10+
* @see https://typo3.org
11+
*/
12+
13+
namespace CodeFareith\CfGoogleAuthenticator\Domain\Repository;
14+
15+
use TYPO3\CMS\Extbase\Persistence\Repository;
16+
17+
class FrontendUserRepository extends Repository
18+
{
19+
}

Configuration/TypoScript/setup.typoscript

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,4 @@
11
plugin {
2-
tx_cfgoogleauthenticator {
3-
persistence {
4-
classes {
5-
CodeFareith\CfGoogleAuthenticator\Domain\Model\FrontendUser {
6-
mapping {
7-
tableName = fe_users
8-
}
9-
}
10-
CodeFareith\CfGoogleAuthenticator\Domain\Model\BackendUser {
11-
mapping {
12-
tableName = be_users
13-
}
14-
}
15-
}
16-
}
17-
18-
objects {
19-
TYPO3\CMS\Extbase\Domain\Model\FrontendUser.className = CodeFareith\CfGoogleAuthenticator\Domain\Model\FrontendUser
20-
TYPO3\CMS\Extbase\Domain\Model\BackendUser.className = CodeFareith\CfGoogleAuthenticator\Domain\Model\BackendUser
21-
}
22-
}
23-
242
tx_cfgoogleauthenticator_setup {
253
view {
264
layoutRootPaths {

ext_emconf.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
'author_company' => '',
2828

2929
'state' => 'stable',
30-
'version' => '1.1.2',
30+
'version' => '1.1.3',
3131

3232
'uploadFolders' => false,
3333
'createDirs' => '',

ext_typoscript_setup.typoscript

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
config {
2+
tx_extbase {
3+
persistence {
4+
classes {
5+
CodeFareith\CfGoogleAuthenticator\Domain\Model\FrontendUser {
6+
mapping {
7+
tableName = fe_users
8+
}
9+
}
10+
CodeFareith\CfGoogleAuthenticator\Domain\Model\BackendUser {
11+
mapping {
12+
tableName = be_users
13+
}
14+
}
15+
}
16+
}
17+
}
18+
}

0 commit comments

Comments
 (0)