Ejemplo n.º 1
0
 /**
  * Static function for checking hashed password (as required by Doctrine)
  *
  * @param snUser\Entity\User $user The identity object
  * @param string $passwordGiven Password provided to be verified
  * @return boolean true if the password was correct, else, returns false
  */
 public static function verifyHashedPassword(User $user, $passwordGiven)
 {
     $bcrypt = new Bcrypt(array('cost' => 10));
     return $bcrypt->verify($passwordGiven, $user->getPassword());
 }
Ejemplo n.º 2
0
 /**
  * Remove myFriend
  *
  * @param User $user
  * @return User
  */
 public function removeMyFriend(\CsnUser\Entity\User $user)
 {
     $user->removeFriendWithMe($this);
     // synchronously updating inverse side.
     $this->myFriends->removeElement($user);
     return $this;
 }
Ejemplo n.º 3
0
 public function testUserInitialState()
 {
     $user = new User();
     $this->assertNull($user->getId(), '"id" should initially be null');
     $this->assertNull($user->getUsername(), '"username" should initially be null');
     $this->assertNull($user->getDisplayName(), '"displayName" should initially be null');
     $this->assertNull($user->getPassword(), '"password" should initially be null');
     $this->assertNull($user->getEmail(), '"email" should initially be null');
     $this->assertNull($user->getRole(), '"role" should initially be null');
     $this->assertNull($user->getLanguage(), '"language" should initially be null');
     $this->assertNull($user->getState(), '"state" should initially be null');
     $this->assertNull($user->getQuestion(), '"question" should initially be null');
     $this->assertNull($user->getAnswer(), '"answer" should initially be null');
     $this->assertNull($user->getPicture(), '"picture" should initially be null');
     $this->assertEquals($user->getRegistrationDate(), new \DateTime(), '"registrationDate" should initially be <Now>');
     $this->assertNull($user->getRegistrationToken(), '"registrationToken" should initially be null');
     $this->assertNull($user->getEmailConfirmed(), '"emailConfirmed" should initially be null');
 }