我必须混合使用Symfony2和ExtJS4。所有视图都需要使用ExtJS渲染,而不是树枝。ExtJS4&Symfony 2
所有的应用程序都在安全区域,只有成员才能访问它。
当用户启动应用程序时,主要视口与登录表单一起显示。连接后,显示整个应用程序。
事实上,/路径需要显示视口。它会调用一个ajax请求来检查用户是否连接。
如果是,如果不启动应用 ,显示登录表单
而且我不知道该怎么做,该/动作在我的控制器等待回应,我只想推出的JavaScript。
编辑:登录表单必须与ExtJS。
security.yml
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
login:
pattern: ^/login$
security: false
secured_area:
pattern: ^/
form_login:
check_path: /login_check
login_path: /login
logout:
path: /logout
target:/
和在loginAction
public function loginAction()
{
if ($this->get('request')->attributes->has(SecurityContext::AUTHENTICATION_ERROR)) {
$error = $this->get('request')->attributes->get(SecurityContext::AUTHENTICATION_ERROR);
} else {
$error = $this->get('request')->getSession()->get(SecurityContext::AUTHENTICATION_ERROR);
}
$json = json_encode(array(
'username' => $this->get('request')->getSession()->get(SecurityContext::LAST_USERNAME),
'error' => $error,
));
$response = new Response($json);
$response->headers->set('Content-Type', 'application/json');
return $response;
}
犯错,所以有什么问题,你尝试过什么?代码请。 – Amalea
编辑与安全和登录操作 –