You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.2 KiB
43 lines
1.2 KiB
<?php
|
|
/* For licensing terms, see /license.txt */
|
|
|
|
namespace Chamilo\ThemeBundle\Controller;
|
|
|
|
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
|
use Symfony\Component\HttpFoundation\Request;
|
|
use Symfony\Component\Security\Core\SecurityContext;
|
|
|
|
/**
|
|
* Class SecurityController.
|
|
* @package Chamilo\ThemeBundle\Controller
|
|
*/
|
|
class SecurityController extends Controller
|
|
{
|
|
/**
|
|
* @param Request $request
|
|
*
|
|
* @return \Symfony\Component\HttpFoundation\Response
|
|
*/
|
|
public function loginAction(Request $request)
|
|
{
|
|
$session = $request->getSession();
|
|
|
|
// get the login error if there is one
|
|
if ($request->attributes->has(SecurityContext::AUTHENTICATION_ERROR)) {
|
|
$error = $request->attributes->get(SecurityContext::AUTHENTICATION_ERROR);
|
|
} else {
|
|
$error = $session->get(SecurityContext::AUTHENTICATION_ERROR);
|
|
$session->remove(SecurityContext::AUTHENTICATION_ERROR);
|
|
}
|
|
|
|
return $this->render(
|
|
'ChamiloThemeBundle:Security:login.html.twig',
|
|
[
|
|
'last_username' => $session->get(
|
|
SecurityContext::LAST_USERNAME
|
|
),
|
|
'error' => $error,
|
|
]
|
|
);
|
|
}
|
|
}
|
|
|