mirror of
https://codeberg.org/davrot/forgejo.git
synced 2025-05-31 21:00:02 +02:00
Make "/user/login" page redirect if the current user has signed in (#29583)
Fix #29582 and maybe more. Maybe fix #29116 (cherry picked from commit df1268ca08aaacae54c775a8eec34006dfe365e0)
This commit is contained in:
parent
f6c62cd07f
commit
9482b023a8
4 changed files with 66 additions and 12 deletions
|
@ -7,6 +7,7 @@ package contexttest
|
|||
import (
|
||||
gocontext "context"
|
||||
"io"
|
||||
"maps"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"net/url"
|
||||
|
@ -36,7 +37,7 @@ func mockRequest(t *testing.T, reqPath string) *http.Request {
|
|||
}
|
||||
requestURL, err := url.Parse(path)
|
||||
assert.NoError(t, err)
|
||||
req := &http.Request{Method: method, URL: requestURL, Form: url.Values{}}
|
||||
req := &http.Request{Method: method, URL: requestURL, Form: maps.Clone(requestURL.Query()), Header: http.Header{}}
|
||||
req = req.WithContext(middleware.WithContextData(req.Context()))
|
||||
return req
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue