1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-23 02:38:35 +00:00

Reset Session ID on login (#18018) (#18041)

Backport #18018

When logging in the SessionID should be reset and the session cleaned up.

Also logs the user in on completion of linking account

Signed-off-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
zeripath
2021-12-20 20:06:54 +00:00
committed by GitHub
parent 148a417774
commit 76e1c130fb
11 changed files with 148 additions and 31 deletions

View File

@@ -4,9 +4,21 @@
package session
import (
"net/http"
"gitea.com/go-chi/session"
)
// Store represents a session store
type Store interface {
Get(interface{}) interface{}
Set(interface{}, interface{}) error
Delete(interface{}) error
}
// RegenerateSession regenerates the underlying session and returns the new store
func RegenerateSession(resp http.ResponseWriter, req *http.Request) (Store, error) {
s, err := session.RegenerateSession(resp, req)
return s, err
}