|
@@ -4,7 +4,7 @@ namespace AppBundle\Entity;
|
|
|
|
|
|
use Doctrine\Common\Collections\ArrayCollection;
|
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
|
-use Symfony\Component\Security\Core\User\UserInterface;
|
|
|
+use Symfony\Component\Security\Core\User\AdvancedUserInterface;
|
|
|
use Symfony\Component\Validator\Constraints as Assert;
|
|
|
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
|
|
|
|
@@ -18,7 +18,7 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
|
|
* @UniqueEntity(fields="token", message="Erreur, token non unique")
|
|
|
*
|
|
|
*/
|
|
|
-class User implements UserInterface
|
|
|
+class User implements AdvancedUserInterface
|
|
|
{
|
|
|
/**
|
|
|
* @var int
|
|
@@ -90,9 +90,9 @@ class User implements UserInterface
|
|
|
/**
|
|
|
* @var boolean
|
|
|
*
|
|
|
- * @ORM\Column(name="activated", type="boolean")
|
|
|
+ * @ORM\Column(name="is_active", type="boolean")
|
|
|
*/
|
|
|
- private $activated;
|
|
|
+ private $isActive;
|
|
|
|
|
|
/**
|
|
|
* @var array
|
|
@@ -182,24 +182,14 @@ class User implements UserInterface
|
|
|
return $this->username;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * @return bool
|
|
|
- */
|
|
|
- public function isActivated()
|
|
|
- {
|
|
|
- return $this->activated;
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* @param bool $activated
|
|
|
*/
|
|
|
public function setActivated($activated)
|
|
|
{
|
|
|
- $this->activated = $activated;
|
|
|
+ $this->isActive = $activated;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
/**
|
|
|
* @return string
|
|
|
*/
|
|
@@ -475,4 +465,51 @@ class User implements UserInterface
|
|
|
return $this->getPrenom()." ".$this->getNom();
|
|
|
}
|
|
|
|
|
|
+ public function isAccountNonExpired()
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ public function isAccountNonLocked()
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ public function isCredentialsNonExpired()
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ public function isEnabled()
|
|
|
+ {
|
|
|
+ return $this->isActive;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** @see \Serializable::serialize() */
|
|
|
+ public function serialize()
|
|
|
+ {
|
|
|
+ return serialize(array(
|
|
|
+ $this->id,
|
|
|
+ $this->username,
|
|
|
+ $this->password,
|
|
|
+ $this->isActive,
|
|
|
+ // see section on salt below
|
|
|
+ // $this->salt,
|
|
|
+ ));
|
|
|
+ }
|
|
|
+
|
|
|
+ /** @see \Serializable::unserialize() */
|
|
|
+ public function unserialize($serialized)
|
|
|
+ {
|
|
|
+ list (
|
|
|
+ $this->id,
|
|
|
+ $this->username,
|
|
|
+ $this->password,
|
|
|
+ $this->isActive,
|
|
|
+
|
|
|
+ // see section on salt below
|
|
|
+ // $this->salt
|
|
|
+ ) = unserialize($serialized, array('allowed_classes' => false));
|
|
|
+ }
|
|
|
+
|
|
|
}
|