Skip to content

Commit ab3cd47

Browse files
authored
Merge pull request #50 from gsirin/master
Validation and Custom-Validator throws error since flow 6
2 parents db3c177 + 23d358a commit ab3cd47

File tree

2 files changed

+17
-15
lines changed

2 files changed

+17
-15
lines changed

Classes/Controller/ProfileController.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use Neos\Flow\Mvc\Controller\ActionController;
66
use Neos\Flow\Security\Account;
77
use Neos\Flow\Security\AccountRepository;
8-
use Neos\Flow\Security\Authentication\AuthenticationManagerInterface;
8+
use Neos\Flow\Security\Authentication\TokenAndProviderFactoryInterface;
99
use Neos\Flow\Security\Authentication\Token\UsernamePassword;
1010
use Neos\Flow\Security\Authentication\TokenInterface;
1111
use Neos\Flow\Security\Context;
@@ -31,11 +31,11 @@ class ProfileController extends ActionController
3131
*/
3232
protected $userRepository;
3333

34-
/**
35-
* @Flow\Inject
36-
* @var AuthenticationManagerInterface
37-
*/
38-
protected $authenticationManager;
34+
/**
35+
* @Flow\Inject
36+
* @var TokenAndProviderFactoryInterface
37+
*/
38+
protected $tokenAndProviderFactory;
3939

4040
/**
4141
* @Flow\Inject
@@ -104,7 +104,7 @@ protected function getErrorFlashMessage()
104104
*/
105105
protected function setPassword(Account $account, $password)
106106
{
107-
$tokens = $this->authenticationManager->getTokens();
107+
$tokens = $this->tokenAndProviderFactory->getTokens();
108108
$indexedTokens = array();
109109
foreach ($tokens as $token) {
110110
/** @var TokenInterface $token */

Classes/Domain/Validator/RegistrationFlowValidator.php

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,29 +43,31 @@ class RegistrationFlowValidator extends AbstractValidator
4343
*/
4444
protected function isValid($value)
4545
{
46-
46+
4747
/** @noinspection PhpUndefinedMethodInspection */
4848
$existingAccount = $this->accountRepository->findOneByAccountIdentifier($value->getEmail());
4949

5050
if ($existingAccount) {
5151
$message = $this->translator->translateById('validations.registrationflow.email', [$value->getEmail()], null, null, 'Main', 'Sandstorm.UserManagement');
52-
$this->result->forProperty('email')->addError(new Error($message, 1336499566));
52+
$this->getResult()->forProperty('email')->addError(new Error($message, 1336499566));
5353
}
5454

5555
// If a custom validation service is registered, call its validate method to allow custom validations during registration
5656
if ($this->objectManager->isRegistered(RegistrationFlowValidationServiceInterface::class)) {
5757
$instance = $this->objectManager->get(RegistrationFlowValidationServiceInterface::class);
5858
$instance->validateRegistrationFlow($value, $this);
5959
}
60+
6061
}
61-
62+
6263
/**
6364
* The custom validation service might need to access the result directly, so it is exposed here
6465
*
6566
* @return Result
66-
*/
67-
public function getResult()
68-
{
69-
return $this->result;
70-
}
67+
*/
68+
public function getResult()
69+
{
70+
return parent::getResult();
71+
}
72+
7173
}

0 commit comments

Comments
 (0)