One other way to do it is when the user logs in, store his username as a
session variable:

$this->getUser()->setAttribute('username', $username);

Then when the user is redirected to the action that produces the login page
when his session times out, check to see if that session variable exists and
if so, then his session has timed out:

if ($this->getUser()->hasAttribute('username'))
{
  $session_timed_out = true;
}
else
{
  $session_timed_out = false;
}

If the username exists as a session variable it means he must have logged in
before as only after login do you create that session variable. If the
username variable is NOT set, then obviously he is logging in he first time.

On Wed, Apr 13, 2011 at 2:35 AM, benze <ebenza...@gmail.com> wrote:

> Hi,
>
> I'm using symfony 1.4 and am relatively new to it.  I'm looking for a
> way to inform the user that his session has timed out.
>
> Right now, what is happening, is that a user is logging into the site,
> waiting an extended period of time, and then clicking on an action.
> Given that his session is expired, he is redirected to the home page.
>
> Is there a way that I can instead redirect the user to a "We're sorry,
> but your session has timed out due to inactivity.  Please log in
> again." page?  I've looked through the docs, but can't seem to find
> the place where it discusses this issue.
>
> Thanks!
>
> Eric
>
> --
> If you want to report a vulnerability issue on symfony, please send it to
> security at symfony-project.com
>
> You received this message because you are subscribed to the Google
> Groups "symfony users" group.
> To post to this group, send email to symfony-users@googlegroups.com
> To unsubscribe from this group, send email to
> symfony-users+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/symfony-users?hl=en
>



-- 
Gareth McCumskey
http://garethmccumskey.blogspot.com
twitter: @garethmcc
identi.ca: @garethmcc

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to