I am trying to manually create the user as i have some check-in application,using below code
$identifier = ‘andi’;
$password = ‘secret@12334’;
$roles = array(‘Neos.Neos:Administrator’);
$authenticationProviderName = ‘DefaultProvider’;
$data=$userManager -> createAccountWithPassword($identifier, $password, $roles, $authenticationProviderName);
Giving below error.
Call to a member function hashPassword() on null
How did you solve it? I’ll urge you to not just mark a topic as solved without the actual solution.
If you post your solution here, others (one of your co-workers, perhaps) with the same questions as you, will find a solution easier and faster. That benefits the whole community
dbuecker
(damian buecker)
August 8, 2019, 2:47pm
3
maybe this will help:
use Neos\Flow\Security\Cryptography\HashService;
use Neos\Flow\Security\AccountRepository;
.....
.....
.....
$identifier = ‘andi’;
$password = ‘secret@12334’;
$roles = array(‘Neos.Neos:Administrator’);
$authenticationProviderName = ‘DefaultProvider’;
$data=$this->accountFactory-> createAccountWithPassword($identifier, $password, $roles,$authenticationProviderName);
$data->setCredentialsSource($this->hashService->hashPassword($password));
$this->accountRepository->add($data);
This is untested code out of my memory