mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-04 13:20:19 +08:00
fix: some bugs in session module when testing single-log-in (#1547)
Co-authored-by: Zayn Xie <84443886+xiaoniuren99@users.noreply.github.com>
This commit is contained in:
@ -75,11 +75,15 @@ func GetSessionCount(owner, field, value string) int {
|
||||
func GetSingleSession(id string) *Session {
|
||||
owner, name, application := util.GetOwnerAndNameAndOtherFromId(id)
|
||||
session := Session{Owner: owner, Name: name, Application: application}
|
||||
_, err := adapter.Engine.Get(session)
|
||||
get, err := adapter.Engine.Get(&session)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
if !get {
|
||||
return nil
|
||||
}
|
||||
|
||||
return &session
|
||||
}
|
||||
|
||||
@ -126,7 +130,7 @@ func AddSession(session *Session) bool {
|
||||
}
|
||||
}
|
||||
|
||||
removeExtraSessionIds(session)
|
||||
removeExtraSessionIds(dbSession)
|
||||
|
||||
return UpdateSession(dbSession.GetId(), dbSession)
|
||||
}
|
||||
|
Reference in New Issue
Block a user