mirror of
https://github.com/go-gitea/gitea.git
synced 2026-09-08 14:03:24 +09:00
feat: admin impersonates a user (#38614)
* fix #3631 * fix #21599 by the way, refactored the "profile avatar card" to simplify the code.
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
||||
user_model "gitea.dev/models/user"
|
||||
"gitea.dev/modules/log"
|
||||
"gitea.dev/modules/optional"
|
||||
"gitea.dev/modules/session"
|
||||
"gitea.dev/modules/setting"
|
||||
|
||||
gouuid "github.com/google/uuid"
|
||||
@@ -117,8 +118,9 @@ func (r *ReverseProxy) Verify(req *http.Request, w http.ResponseWriter, store Da
|
||||
}
|
||||
}
|
||||
|
||||
if r.CreateSession {
|
||||
if sess != nil && (sess.Get("uid") == nil || sess.Get("uid").(int64) != user.ID) {
|
||||
if r.CreateSession && sess != nil {
|
||||
sessionUID, ok := sess.Get(session.KeyUID).(int64)
|
||||
if !ok || sessionUID != user.ID {
|
||||
handleSignIn(w, req, sess, user)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user