php - In Laravel 5, how make sure a user is authed uniquely? -


i'm searching solution allow user logged in once @ same time. i'm new laravel , in case i'm using out of box (file session driver , default auth-handling custom views).

my idea 'reset' auth user after logs in second time, automatically make other active sessions invalid.

so primary question is: there way accomplish laravel magic or need invent feature myself?

what following:

in usertable, add 1 column:

sessionid (varchar or text) 

now want here following: when user logs in, store id of session in sessionid field. everytime user loads page, or makes request, check if sessionid value in db same sessionid of user logged in. if isn't, kill session , make him login again.

now, when user logs in, check usertable if sessionid value filled. if so, change new sessionid. result requests old sessionid invalid (because of check) , user can access webapp/website new session.

thus makes sure user authed uniquely.


Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -