freenet-router |
Subversion Repositories: |
[/] [trunk/] [freenet-router/] [var/] [www/] [freenet-router/] [Framework/] [Controllers/] [DispatcherController.php] - Rev 2
Compare with Previous -
Blame
- Download
<?php
namespace Phem\Controllers;
use Phem\Environment\Application;
use Phem\Environment\ApplicationException;
use Phem\Environment\EnvironmentManager;
use Phem\Environment\Message;
/**
*
* @author kubapet
*/
class DispatcherController extends SimpleViewController
{
public function login($username, $password)
{
if (($username != null) && ($password != null))
{
$ap = EnvironmentManager::getAuthenticationProvider();
$user = $ap->authenticate($username, $password);
if ($user != null)
{
EnvironmentManager::getSession()->setVar(ROOT_NAMESPACE . ".loggedUser", $user->getUsername());
/*$msg = new Message();
$msg->setFromUsr($user->getUsername());
$msg->setSubject('PĹĂchod uĹživatele ' . $user->getUsername());
try
{
Application::notify($msg);
}
catch (ApplicationException $ex)
{
}*/
$this->redirectToController = DEFAULT_CONTROLLER;
$this->redirectToTask = DEFAULT_TASK;
return;
}
}
$lb = EnvironmentManager::getLinkBuilder();
$this->getModel()->set("formAction", $lb->link(array("controller" => "Dispatcher", "task" => "login")));
$this->template = "@Phem/login.twig";
}
public function logout()
{
EnvironmentManager::getSession()->setVar(ROOT_NAMESPACE . ".loggedUser", null);
$this->renderTemplate = false;
$this->redirectToController = "Disparcher";
$this->redirectToTask = "login";
return;
}
public function showAccessDenied()
{
}
}
Powered by WebSVN 2.2.1