Conversation
| return match ($mainRequest->get('_route')) { | ||
| 'backend_action', | ||
| 'backend_login' => ActionSlug::fromRequest($mainRequest)->getTranslationDomain(), | ||
| 'backend_2fa_login' => ActionSlug::fromRequest($mainRequest)->getTranslationDomain(), |
There was a problem hiding this comment.
please use the fallback, so just add them to the comma list with backend_action and backend_login
There was a problem hiding this comment.
Could you clarify what you mean
There was a problem hiding this comment.
The code is exactly the same as for backend_action and backend_login, so you can just include them in that comma separated list
src/Modules/Backend/templates/Backend/Actions/UserEdit.html.twig
Outdated
Show resolved
Hide resolved
src/Modules/Backend/Domain/User/Command/DisableTwoFactorAuthentication.php
Outdated
Show resolved
Hide resolved
src/Modules/Backend/Domain/User/Command/DisableTwoFactorAuthenticationHandler.php
Show resolved
Hide resolved
src/Modules/Backend/Backend/Ajax/AjaxActionGetTwoFactorAuthorizationCode.php
Show resolved
Hide resolved
| return parent::form($request); | ||
| } | ||
|
|
||
| protected function getTemplateVars(Request $request, TwoFactorTokenInterface $token): array |
There was a problem hiding this comment.
Note to self: update the code here in my own branch with changes (I've made this more generic and easy to add extra controllers)
There was a problem hiding this comment.
@bjorvack this code has already landed, you only need to set the things specific for your controller all those others should already be there
src/Modules/Backend/Domain/ModuleSettings/ModuleSettingsType.php
Outdated
Show resolved
Hide resolved
|
You'll also need to fix the tests and add tests for 2FA |
carakas
left a comment
There was a problem hiding this comment.
The tests are still failing
A little bit of extra feedback
Can you rebase your code?
| { | ||
| $this->moduleRepository->save($changeModuleSettings->module); | ||
| $this->moduleSettings->invalidateCache(); | ||
| $this->commandBus->dispatch(new ClearContainerCache()); |
There was a problem hiding this comment.
can you use $this->eventDispatcher->dispatch(new ClearCacheEvent()); instead?
| return match ($mainRequest->get('_route')) { | ||
| 'backend_action', | ||
| 'backend_login' => ActionSlug::fromRequest($mainRequest)->getTranslationDomain(), | ||
| 'backend_2fa_login' => ActionSlug::fromRequest($mainRequest)->getTranslationDomain(), |
There was a problem hiding this comment.
The code is exactly the same as for backend_action and backend_login, so you can just include them in that comma separated list
| validCallback: function (FormInterface $form): Response { | ||
| $this->commandBus->dispatch($form->getData()); | ||
|
|
||
| if (!$this->moduleSettings->get(ModuleName::fromString('Backend'), '2fa_enabled', false)) { |
There was a problem hiding this comment.
Doesn't this also belong in the command? Otherwise if the command is used somewhere else this code won't be executed
| ); | ||
| } | ||
|
|
||
| #[Route('/2fa', name: 'backend_2fa_login')] |
There was a problem hiding this comment.
shouldn't this route be /private/2fa?
| return parent::form($request); | ||
| } | ||
|
|
||
| protected function getTemplateVars(Request $request, TwoFactorTokenInterface $token): array |
There was a problem hiding this comment.
@bjorvack this code has already landed, you only need to set the things specific for your controller all those others should already be there
Type
Resolves the following issues
Adds 2FA login