All pastes #816016 Raw Edit

Someone

public text v1 · immutable
·published 2007-12-14 16:06 UTC
rendered paste body
<?php

class securityActions extends sfActions
{
  public function executeLogin()
  {
    if ($this->getRequest()->getMethod() == sfRequest::POST)
    {
      $this->getUser()->getAuthenticated(true);
      $this->redirect('@homepage');
    }
  }

  public function validateLogin()
  {
    if ($this->getRequest()->getMethod() == sfRequest::POST)
    {
      $username = $this->getRequestParameter('username');
      $password = $this->getRequestParameter('password');
      if ($username != 'moo' && $password != 'cow')
      {
        $this->getRequest()->setError('username', 'Invalid username/password combination');
        return false;
      }
    }
    return true;
  }

  public function handleErrorLogin()
  {
    return sfView::SUCCESS;
  }

  public function executeLogout()
  {
    $this->getUser()->setAuthenciated(false);
    $this->redirect('@homepage');
  }

}