Commit ec0f21bd authored by Mat's avatar Mat

Ajoute un champs tokenKey sur la table User

* Suis le tuto:
  https://symfony.com/doc/3.4/security/guard_authentication.html#guard-auth-methods
parent a1460cc3
......@@ -42,13 +42,19 @@ class User extends BaseUser
*/
private $utilisateur;
/**
* @ORM\Column(type="string", unique=true, length=50)
*/
private $tokenKey;
/**
* User constructor.
*/
public function __construct()
{
parent::__construct();
// your own logic
$this->tokenKey = bin2hex(random_bytes(20));
}
/**
......@@ -96,4 +102,26 @@ class User extends BaseUser
{
return parent::getUsername() . ' ( ' . parent::getEmail() . ' )';
}
/**
* Set tokenKey
*
* @return User
*/
public function setTokenKey()
{
$this->tokenKey = bin2hex(random_bytes(20));
return $this;
}
/**
* Get tokenKey
*
* @return string
*/
public function getTokenKey()
{
return $this->tokenKey;
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment