Reputation: 448
Having a strange problem that others don't seem to have. I can't get the "remember me" function working on my Symfony 2.1 app.
I've tried local and deployed on a server, I've tried with and without the FOS User Bundle and I just can't seem to get it working.
It's a basic setup from composer and nothing is missing, the security is working fine and I can login, logout, create new users, etc, etc.
It's creating the session cookie fine (checked that) but I think there is meant to be a second cookie that it's not creating?
# app/config/security.yml
security:
encoders:
FOS\UserBundle\Model\UserInterface: sha512
role_hierarchy:
ROLE_ADMIN: ROLE_USER
ROLE_SUPER_ADMIN: ROLE_ADMIN
providers:
fos_userbundle:
id: fos_user.user_provider.username
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
login_firewall:
pattern: ^/login$
anonymous: ~
main:
remember_me:
key: "%secret%"
lifetime: 31536000 # 365 days in seconds
path: /
domain: ~ # Defaults to the current domain from $_SERVER
pattern: ^/
form_login:
provider: fos_userbundle
csrf_provider: form.csrf_provider
logout: true
anonymous: true
access_control:
- { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/register, role: ROLE_ADMIN }
- { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/, role: ROLE_ADMIN }
Upvotes: 1
Views: 5031
Reputation: 44831
Try adding the settings from here:
security:
# ...
form_login:
# ...
remember_me: true
remember_me:
# ...
always_remember_me: true
Upvotes: 3