Implemented "Remember Me" feature on admin. Started template management
This commit is contained in:
@@ -6,6 +6,7 @@ use Thelia\Core\Security\User\UserInterface;
|
||||
use Thelia\Core\Security\Role\Role;
|
||||
|
||||
use Thelia\Model\Base\Admin as BaseAdmin;
|
||||
use Propel\Runtime\Connection\ConnectionInterface;
|
||||
|
||||
/**
|
||||
* Skeleton subclass for representing a row from the 'admin' table.
|
||||
@@ -20,6 +21,16 @@ use Thelia\Model\Base\Admin as BaseAdmin;
|
||||
*/
|
||||
class Admin extends BaseAdmin implements UserInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function preInsert(ConnectionInterface $con = null)
|
||||
{
|
||||
// Set the serial number (for auto-login)
|
||||
$this->setRememberMeSerial(uniqid());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function setPassword($password)
|
||||
{
|
||||
@@ -65,4 +76,32 @@ class Admin extends BaseAdmin implements UserInterface
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user