How to invalidate an user session when he logs twice with the same credentials

后端 未结 3 1865
粉色の甜心
粉色の甜心 2020-11-27 17:00

I\'m using JSF 1.2 with Richfaces and Facelets.

I have an application with many session-scoped beans and some application beans.

The user logs in with, let\'

3条回答
  •  广开言路
    2020-11-27 17:56

    1. create an integer field in the databse userLoggedInCount
    2. On each login increment that flag and store the result in the session.
    3. On each request check the value in the database and the one in the session, and if the one in the session is less than the one in the DB, invalidate() the session and decrement the value in the database
    4. whenever a session is destroyed decrement the value as well.

提交回复
热议问题