Ask your Symfony questions! Pay money and get answers fast! (more info)

Why would Remember Me not work with sfDoctrineGuardPlugin? Symfony

  • SOLVED

On a new site with Symfony 1.4 I've installed sfDoctrineGuardPlugin. I tried to enable the "Remember Me" function, but it does not work. I've followed the directions carefully. I'm wondering if I missed something obvious?

In app.yml I have:

all:
sf_guard_plugin:
remember_key_expiration_age: 25920000 # 30 days in seconds
remember_cookie_name: myAppRememberMe


In myUser.class.php I have:

class myUser extends sfGuardSecurityUser
{
}



In filters.yml I have:


rendering: ~

remember_me:
class: sfGuardRememberMeFilter

security: ~

# insert your own filters here

cache: ~
execution: ~


The cookie gets set with the correct value -- see the screenshot.

So what did I miss?

I've done all this, yet I still get logged out after about 15 minutes.

Answers (2)

2011-03-08

Gergely Szilagyi answers:

Hi Lawrence!

I had same problem a month ago, and it takes many time, but the problem solved finally.
Sadly the cookie expire is not enougth... you need configure your php ini settings, cause the GC collect the session, before if expire at the client..
This is for sf1.2, but i'm sure, it works under 1.4 too ....
Anyway , the apache config will help!!!

The following configuration solved my problem ( check the attachement its absolutle necessary!!! )

PLUS :


###########
# myUser.class.php - in your application/lib dir

class myUser extends sfGuardSecurityUser
{
public function initialize(sfEventDispatcher $dispatcher, sfStorage $storage, $options = array())
{
// disable timeout anyway, doesn't matter, what user checked
$options['timeout'] = false;
parent::initialize($dispatcher, $storage, $options);
}
.....
}



###############
# cache.yml - in your application/config dir
default:
enabled: off
with_layout: false
lifetime: 86400



############
#factories.yml - in your application/config dir

all:
routing:
class: sfPatternRouting
param:
generate_shortest_url: true
extra_parameters_as_query_string: true

user:
class: myUser
param:
timeout: 864000
logging: %SF_LOGGING_ENABLED%
use_flash: true
default_culture: %SF_DEFAULT_CULTURE%
storage:
class: sfSessionStorage
param:
session_name: symfony
session_cookie_lifetime: 864000


Lawrence Krubner comments:

Thanks, but why this in cache.yml:

default:
enabled: off


Is enabled supposed to be off?


Lawrence Krubner comments:

Nevermind, I see that is standard here:

[[LINK href="http://www.symfony-project.org/reference/1_4/en/09-Cache"]]http://www.symfony-project.org/reference/1_4/en/09-Cache[[/LINK]]

2011-03-08

Arturo Linares answers:

The first things I would check:
- are to cookies enabled in the browser?
- clear the symfony cache. ($ php symfony cc)


Lawrence Krubner comments:

Arturo,

Please look at the screenshot. It shows the output I get in FireFox on a Mac, regarding the cookie that I get.

I've clear-cache many, many times.