Ejemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function updatePassword(CredentialsHolderInterface $user)
 {
     if ('' !== ($password = $user->getPlainPassword())) {
         $user->setPassword($this->userPasswordEncoder->encode($user));
         $user->eraseCredentials();
     }
 }
Ejemplo n.º 2
0
 function it_does_nothing_if_plain_password_is_empty(UserPasswordEncoderInterface $userPasswordEncoder, UserInterface $user)
 {
     $user->getPlainPassword()->willReturn('');
     $userPasswordEncoder->encode($user)->willReturn('topSecretEncodedPassword');
     $user->setPassword(Argument::any())->shouldNotBeCalled();
     $user->eraseCredentials()->shouldNotBeCalled();
     $this->updatePassword($user);
 }