Witam
Zrobiłem logowanie z pomocą dokumentacji i później przerobiłem żeby działało przy pomocy ajax, i teraz mam problem bo jak wyśle bez ajax to loguje i mogę wejść na stronę gdzie może wejść tylko zalogowany użytkownik, a gdy wyśle ajaxem to wtedy gdy przejde na inną stronę to wykrywa ze jestem wylogowany
$.ajax({
method: 'POST',
url: urlPath,
dataType: 'JSON',
data: {
_username: usernameLogin,
_password: passwordLogin
},
success: function (json) {
if(json.loginError === true) {
$('#errorResult').html('Wprowadzone dane są nieprawidłowe!');
} else {
window.location.href = json.redirectPath;
console.log('test');
}
},
error: function (error) {
console.log(error);
}
});
public function login(Request $request, AuthenticationUtils $authUtils)
{
$error = $authUtils->getLastAuthenticationError();
$json = array(
'redirectPath' => 'portal',
);
return new JsonResponse($json);
}