Exemplo n.º 1
0
 /**
  * Update users to the new password encoding when they login
  * @param  AuthenticationEntityInterface $authEntity
  * @param  string         $password
  */
 protected function updateLegacyPassword(AuthenticationEntityInterface $authEntity, $password)
 {
     if ($authEntity->isLegacyAccount()) {
         //we have to have a valid token to update the user because the audit log requires it
         $authenticatedToken = new PreAuthenticatedToken($authEntity->getUser(), 'fakekey', 'fakeProvider');
         $authenticatedToken->setAuthenticated(true);
         $this->tokenStorage->setToken($authenticatedToken);
         $authEntity->setPasswordSha256(null);
         $encodedPassword = $this->encoder->encodePassword($authEntity->getUser(), $password);
         $authEntity->setPasswordBcrypt($encodedPassword);
         $this->authManager->updateAuthentication($authEntity);
     }
 }