/**
  * @test
  */
 public function testUserProperties()
 {
     $uid = '123';
     $nick = 'test';
     $email = '*****@*****.**';
     $user = new User($uid, $nick, $email);
     $this->assertEquals($nick, $user->getUsername());
     $this->assertEquals(null, $user->getSalt());
     $this->assertEquals(array('ROLE_USER'), $user->getRoles());
     $this->assertEquals('', $user->getPassword());
 }
Example #2
0
 /**
  * @inheritdoc
  */
 public function getSalt()
 {
     return $this->user->getSalt();
 }
 /**
  * Encode a plain text password for a given user. Hashes the password with the given user's salt.
  *
  * @param User $user
  * @param string $password A plain text password.
  * @return string An encoded password.
  */
 public function encodeUserPassword(User $user, $password)
 {
     return $this->passwordEncoder->encodePassword($password, $user->getSalt());
 }
Example #4
0
 /**
  * Returns a code for password reset
  *
  * @param User $user
  * @return string
  *
  */
 public static function passwordResetCode(User $user)
 {
     return sha1(substr($user->getSalt(), 10, 10) . sfConfig::get('sf_csrf_secret', '') . $user->getEmail() . $user->getPassword());
 }
Example #5
0
 /**
  * @covers AppBundle\Entity\User::getSalt
  * Implement testGetSalt().
  */
 public function testGetSalt()
 {
     $this->assertEquals("salt", $this->user->getSalt());
 }