Thursday, 15 September 2011

php - Laravel 5 - Checking if the user session has expired -


I'm trying to implement a way to check that the user session has ended and then the user has the address A model walker.

Even so far I have.

Root

  Root :: find ('auth-check', uses '' gt; 'user controller @ authCheck', 'like' = & Gt; auth.check ']);  

User Controller

  Use illumination \ Contracts \\\ ' Classroom UsersController Controller {Expands Public Function __ Composition (Guard $ auth) {$ this- & gt; Auth = $ auth; } ... / * * Return (Status: False) or {Status: true} * / Public Function Writer Check () {Return response (['Status' = & gt; $ this- & gt; auth- & gt; Check ()]) - & gt; Header ('content-type', 'app / jason'); }}  

Master Blade (hence it can be checked on any page)

   

JS

  @if (at :: check ()) $ .fn.timer = function () {$ .get ("{{route} ('Show.check')}}, function {data.status == false? $ ('# Session-expired'). {{Show: true, backdrop: 'static'}): $ ( '# Session has ended'). Modal ('hide');}); }; Window.setInterval (function () {$ ('# timedOutSession'). Timer ();}, 10000); @endif  

This works a bit, when I log in it returns {status: true} . But after 5-10 requests upon checking the auth user, the session dies due to some reason and it returns {status: false} . Like making so many author checks, the session kills the security measures or as a few things.

Does any user know that anybody can make a mistake after their session has expired? The reason for this is that the application is very form based and the user can open a form page and come back the next day and the session is over, but they will go through the process of filling long form and only to find out Submit will not be logged.

Any ideas or better ways to do this will be quite welcome.


No comments:

Post a Comment