forked from casdoor/casdoor
feat: fix DeleteSession to handle missing sessions gracefully (#4979)
This commit is contained in:
@@ -175,8 +175,10 @@ func DeleteSession(id, curSessionId string) (bool, error) {
|
||||
return false, err
|
||||
}
|
||||
|
||||
// If session doesn't exist, return success with no rows affected
|
||||
// This is a valid state (e.g., when a user has no active session)
|
||||
if session == nil {
|
||||
return false, fmt.Errorf("session is nil")
|
||||
return false, nil
|
||||
}
|
||||
|
||||
if slices.Contains(session.SessionId, curSessionId) {
|
||||
|
||||
Reference in New Issue
Block a user