Symfony 3 + php7 nie działają cookies |
Symfony 3 + php7 nie działają cookies |
18.02.2018, 00:57:07
Post
#1
|
|
Grupa: Zarejestrowani Postów: 11 Pomógł: 0 Dołączył: 9.07.2015 Ostrzeżenie: (0%) |
Witam mam taki problem ponieważ nie chcą mi wgl działać cookies przykładowo:
$cookie = new Cookie('foo', 'bar', strtotime('now + 10 minutes')); dump($cookie); i dump: Cookie {#3487 ▼ #name: "foo" #value: "bar" #domain: null #expire: 1518912200 #path: "/" #secure: false #httpOnly: true -raw: false -sameSite: null } a kiedy sprawdzam w zbadaj element-> application->cookies nic tam nie mam, za to jak ustawie cookies standardowo w czystym php(bez frameworka) wszystko działa, ustawiałem cookie_domain na localhost etc ale i tak nic nie pomagało, jakieś rady? |
|
|
18.02.2018, 12:24:01
Post
#2
|
|
Grupa: Zarejestrowani Postów: 8 Pomógł: 0 Dołączył: 28.09.2017 Ostrzeżenie: (0%) |
Możesz pokazać cały kod? Dodałeś ciasteczko do nagłówków?
$response->headers->setCookie(new Cookie('foo', 'bar')); |
|
|
18.02.2018, 12:42:52
Post
#3
|
|
Grupa: Zarejestrowani Postów: 11 Pomógł: 0 Dołączył: 9.07.2015 Ostrzeżenie: (0%) |
Nie zabardzo wiem jak ci odpowiedzieć ponieważ w symfony używałem:
https://symfony.com/doc/current/security/fo...ogin_setup.html dokładnie tego tutoriala a mój testowy cookies ustawiłem: w tej funckji: public function login(Request $request, AuthenticationUtils $authUtils) { // get the login error if there is one $error = $authUtils->getLastAuthenticationError(); // last username entered by the user $lastUsername = $authUtils->getLastUsername(); return $this->render('security/login.html.twig', array( 'last_username' => $lastUsername, 'error' => $error, )); } na samej górze |
|
|
18.02.2018, 13:28:01
Post
#4
|
|
Grupa: Zarejestrowani Postów: 8 Pomógł: 0 Dołączył: 28.09.2017 Ostrzeżenie: (0%) |
Jeśli problem dotyczy zapamiętania zalogowanego użytkownika, sprawdź ten link:
https://symfony.com/doc/3.3/security/remember_me.html
|
|
|
18.02.2018, 13:40:53
Post
#5
|
|
Grupa: Zarejestrowani Postów: 11 Pomógł: 0 Dołączył: 9.07.2015 Ostrzeżenie: (0%) |
Problem dotyczy tego dokładnie że podając dobre login/hasło tak jakby formularz nie wysłał danych tylko ktoś kliknał F5, sprawdze ten link do podałeś i edytuje jeśli coś zadziała
EDit: tak wygląda mój security.yaml firewalls: dev: pattern: ^/(_(profiler|wdt)|css|images|js)/ security: false main: anonymous: ~ remember_me: secret: '%env(APP_SECRET)%' lifetime: 604800 path: '/' token_provider: App\Repository\UserRemembermeTokenRepository form_login: login_path: auth_login check_path: auth_login csrf_token_generator: security.csrf.token_manager default_target_path: panel_dashboard logout: path: auth_logout invalidate_session: true target: auth_login handlers: [App\Service\UserActionLogger] guard: authenticators: - App\Security\Authenticator\OauthConnectAuthenticator i nadal po wpisaniu danych nic się nie dzieje nawet złe dane nie wywołują błedu żadnego Ten post edytował dekros 18.02.2018, 13:45:13 |
|
|
Wersja Lo-Fi | Aktualny czas: 28.03.2024 - 22:29 |