Bunu çözdüm.
Orada çözümdür: How to disable redirection after login_check in Symfony 2
ve burada benim sorunu çözer kod şudur:
form_login:
check_path: /access/login_check
login_path:/
use_referer: true
failure_handler: authentication_handler
logout:
path: /access/logout
target:/
success_handler: authentication_handler
ve yapılandırma için:
<?php
namespace Acme\MainBundle\Handler;
use Symfony\Component\Security\Http\Logout\LogoutSuccessHandlerInterface;
use Symfony\Component\Security\Http\Authentication\AuthenticationFailureHandlerInterface;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RedirectResponse;
class AuthenticationHandler implements AuthenticationFailureHandlerInterface, LogoutSuccessHandlerInterface
{
public function onAuthenticationFailure(Request $request, AuthenticationException $exception)
{
$referer = $request->headers->get('referer');
$request->getSession()->setFlash('error', $exception->getMessage());
return new RedirectResponse($referer);
}
public function onLogoutSuccess(Request $request)
{
$referer = $request->headers->get('referer');
return new RedirectResponse($referer);
}
}
olaylar örneğin security.yml eklemek işlemek için .yml:
services:
authentication_handler:
class: Acme\MainBundle\Handler\AuthenticationHandler
neden başarısızlık yolu sadece giriş istemcisi değil miydi? – JamesHalsall
çünkü her alt sayfadan giriş yapabilirim. Belirtilen URL'de bir giriş formum yok. Bu nedenle, başka bir kullanıcı profili sayfasından giriş yaparken kullanıcıyı ana sayfaya yönlendirmek istemiyorum. –