Implemented "Remember Me" feature on admin. Started template management

This commit is contained in:
franck
2013-09-16 09:23:44 +02:00
parent 9cdf1a0376
commit 71c1cee66d
91 changed files with 16722 additions and 3088 deletions

View File

@@ -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();
}
}