mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-24 14:25:02 +02: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:
1 parent
470d34b1de
commit
a3caf21440
18 files changed
+278
-238
No files matched your search
@@ -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