mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-24 08:20:31 +08:00
Add removeExtraSessionIds()
This commit is contained in:
parent
eedcde3aa5
commit
c9b990a319
@ -98,6 +98,12 @@ func UpdateSession(id string, session *Session) bool {
|
||||
return affected != 0
|
||||
}
|
||||
|
||||
func removeExtraSessionIds(session *Session) {
|
||||
if len(session.SessionId) > 100 {
|
||||
session.SessionId = session.SessionId[(len(session.SessionId) - 100):]
|
||||
}
|
||||
}
|
||||
|
||||
func AddSession(session *Session) bool {
|
||||
dbSession := GetSingleSession(session.GetId())
|
||||
if dbSession == nil {
|
||||
@ -120,6 +126,8 @@ func AddSession(session *Session) bool {
|
||||
}
|
||||
}
|
||||
|
||||
removeExtraSessionIds(session)
|
||||
|
||||
return UpdateSession(dbSession.GetId(), dbSession)
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user