80 lines
1.5 KiB
PHP
80 lines
1.5 KiB
PHP
<?php
|
|
|
|
/**
|
|
* default actions.
|
|
*
|
|
* @package pae
|
|
* @subpackage default
|
|
* @author Your name here
|
|
* @version SVN: $Id: actions.class.php 2692 2006-11-15 21:03:55Z fabien $
|
|
*/
|
|
class defaultActions extends sfActions
|
|
{
|
|
/**
|
|
* Executes index action
|
|
*
|
|
*/
|
|
public function executeIndex()
|
|
{
|
|
}
|
|
|
|
/**
|
|
* Login action
|
|
*
|
|
* @return void
|
|
* @author Benjamin Ramey <ben.ramey@gmail.com>
|
|
**/
|
|
public function executeLogin()
|
|
{
|
|
$request = $this->getRequest();
|
|
if($request->getMethod() != sfRequest::POST)
|
|
{
|
|
if($this->getUser()->isAuthenticated())
|
|
{
|
|
$this->redirect('default/index');
|
|
}
|
|
|
|
return sfView::SUCCESS;
|
|
}
|
|
else
|
|
{
|
|
$u = $this->getUser();
|
|
|
|
if($this->getRequestParameter('username') == 'admin'
|
|
&& $this->getRequestParameter('password') == 'gerard.1995')
|
|
{
|
|
$u->setAuthenticated(true);
|
|
$u->addCredential('admin');
|
|
$this->redirect('default/index');
|
|
}
|
|
else
|
|
{
|
|
$request->setError('Login failed', 'Username and/or password was not correct. Please try again.');
|
|
return sfView::SUCCESS;
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Logout action
|
|
*
|
|
* @return void
|
|
* @author Benjamin Ramey <ben.ramey@gmail.com>
|
|
**/
|
|
public function executeLogout()
|
|
{
|
|
$this->getUser()->setAuthenticated(false);
|
|
$this->redirect('default/login');
|
|
}
|
|
|
|
/**
|
|
* Secure action
|
|
*
|
|
* @return void
|
|
* @author Benjamin Ramey <ben.ramey@gmail.com>
|
|
**/
|
|
public function executeSecure()
|
|
{
|
|
}
|
|
}
|