Skip to content

Instantly share code, notes, and snippets.

@Etheriq
Last active October 21, 2015 12:25
Show Gist options
  • Save Etheriq/1562e86578796dbb920f to your computer and use it in GitHub Desktop.
Save Etheriq/1562e86578796dbb920f to your computer and use it in GitHub Desktop.
example custom password generation
<?php
public function encodePassword(User $user, $plainPassword)
{
/** @var \Symfony\Component\Security\Core\Encoder\PasswordEncoderInterface $encoder */
$encoder = $this->container->get('security.encoder_factory')
->getEncoder($user);
return $encoder->encodePassword($plainPassword, $user->getSalt());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment