Re: How to display a session timeout message to the user
I once wrote a non-cake application with a secure login. As soon as we went live, the primary user complained that she was unexpectedly logged out all the time blah, blah, blah. So I wrote a simple java script timer that displayed a countdown to the next time-out. That way the user could see exactly when they will be timed out. The js was very simple, all you need from cake is the length of the session timeout. Although I thought the complaint was quite trivial, I really liked the visible count-down. I'm sure with script.aculo.us, you could make something like this very easily. cook On Jun 2, 1:55 am, uk_maul <[EMAIL PROTECTED]> wrote: > Hi > > I see that my Cake session security default is set to MEDIUM - which > logs out a user after 20 minutes of inactivity. I want to display an > error message to the user saying that "You have been logged out due to > session timeout, please login again". Please let me know how I can do > this in CakePHP. > > Regards --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How to display a session timeout message to the user
I was trying to do something similar in an application of mine. What I ended up with came about somewhat accidentally. A lot of actions in my application require checking different attributes of the user, so I was grabbing the user by the username to get the current user by a session variable, but before grabbing the user I was checking that the session variable even existed: $this->Session->check($variable); I may be wrong, and I hope someone will correct me if I am, but if the session variable wasn't there I assumed that the session timed out, at which point I did a $this->flash("You session has timed out, please login again.", "/ controller/login/", 5); I informed the user, and redirected them to the login page. HTH theperk On Jun 6, 4:19 pm, "Gonzalo Servat" <[EMAIL PROTECTED]> wrote: > On 6/6/07, Penfold <[EMAIL PROTECTED]> wrote: > > > > > Hi > > > You can you check to see if the session is valid $this-session- > > >valid() (i think) if the session is has timed out, it will be > > invalid. > > Hi, > > I looked into this topic quite a bit as well, as I wanted to display a > similar message to the user. I tried using $this->Session->valid() but it > didn't work out for me. It was a while ago, but I think it *always* > displayed the error message for me instead of only doing it when the session > timed out. > > The only solution I can see is to modify the session handling code to take > into consideration that the session may have simply timed out, and not > consider it "hijacked" just because it timed out. However, if anyone knows > if a better solution, I'll be happy to hear it ! > > - Gonzalo --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How to display a session timeout message to the user
On 6/6/07, Penfold <[EMAIL PROTECTED]> wrote: > > > Hi > > You can you check to see if the session is valid $this-session- > >valid() (i think) if the session is has timed out, it will be > invalid. Hi, I looked into this topic quite a bit as well, as I wanted to display a similar message to the user. I tried using $this->Session->valid() but it didn't work out for me. It was a while ago, but I think it *always* displayed the error message for me instead of only doing it when the session timed out. The only solution I can see is to modify the session handling code to take into consideration that the session may have simply timed out, and not consider it "hijacked" just because it timed out. However, if anyone knows if a better solution, I'll be happy to hear it ! - Gonzalo --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How to display a session timeout message to the user
Hi You can you check to see if the session is valid $this-session- >valid() (i think) if the session is has timed out, it will be invalid. Penfold On 2 Jun, 06:55, uk_maul <[EMAIL PROTECTED]> wrote: > Hi > > I see that my Cake session security default is set to MEDIUM - which > logs out a user after 20 minutes of inactivity. I want to display an > error message to the user saying that "You have been logged out due to > session timeout, please login again". Please let me know how I can do > this in CakePHP. > > Regards --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How to display a session timeout message to the user
There's no way to do that with the built-in Session component in Cake. At least, not directly. You'll find that your solution will involve a User model, and probably some work with the beforeFilter in AppController. The concept would be to store some form of timestamp in the session, if it's older than (now - 20 minutes) you automatically log the user out and display the message. I can't be more helpful than this because I haven't implemented such a system myself, and it may be more complex than I think. On Jun 6, 3:03 pm, uk_maul <[EMAIL PROTECTED]> wrote: > Hello > > I have been searching on the cakephp group and on the internet but I > still haven't found a way to display a "You have been logged out due > to X minutes due to inactivity" message to the user. Please let me > know if anyone has done something similar in Cake. My Session security > is set to low now meaning 60 minutes of inactivity before we logout > the user. > > Regards > > -- Forwarded message -- > From: uk_maul <[EMAIL PROTECTED]> > Date: Jun 2, 10:55 am > Subject: How to display a session timeout message to the user > To: Cake PHP > > Hi > > I see that my Cake session security default is set to MEDIUM - which > logs out a user after 20 minutes of inactivity. I want to display an > error message to the user saying that "You have been logged out due to > sessiontimeout, please login again". Please let me know how I can do > this in CakePHP. > > Regards --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How to display a session timeout message to the user
Hello I have been searching on the cakephp group and on the internet but I still haven't found a way to display a "You have been logged out due to X minutes due to inactivity" message to the user. Please let me know if anyone has done something similar in Cake. My Session security is set to low now meaning 60 minutes of inactivity before we logout the user. Regards -- Forwarded message -- From: uk_maul <[EMAIL PROTECTED]> Date: Jun 2, 10:55 am Subject: How to display a session timeout message to the user To: Cake PHP Hi I see that my Cake session security default is set to MEDIUM - which logs out a user after 20 minutes of inactivity. I want to display an error message to the user saying that "You have been logged out due to sessiontimeout, please login again". Please let me know how I can do this in CakePHP. Regards --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---