setRememberMeSerial(uniqid()); return true; } public function setPassword($password) { if ($this->isNew() && ($password === null || trim($password) == "")) { throw new \InvalidArgumentException("customer password is mandatory on creation"); } if($password !== null && trim($password) != "") { $this->setAlgo("PASSWORD_BCRYPT"); return parent::setPassword(password_hash($password, PASSWORD_BCRYPT)); } return $this; } /** * {@inheritDoc} */ public function checkPassword($password) { return password_verify($password, $this->password); } /** * {@inheritDoc} */ public function getUsername() { return $this->getLogin(); } /** * {@inheritDoc} */ public function eraseCredentials() { $this->setPassword(null); } /** * {@inheritDoc} */ public function getRoles() { return array(new Role('ADMIN')); } /** * {@inheritDoc} */ public function getToken() { return $this->getRememberMeToken(); } /** * {@inheritDoc} */ public function setToken($token) { $this->setRememberMeToken($token)->save(); } /** * {@inheritDoc} */ public function getSerial() { return $this->getRememberMeSerial(); } /** * {@inheritDoc} */ public function setSerial($serial) { $this->setRememberMeSerial($serial)->save(); } }