diff options
author | 2018-06-01 07:22:18 -0700 | |
---|---|---|
committer | 2018-06-01 07:22:31 -0700 | |
commit | 3b39f0883c60b6978c6c6df2c0029bd4c96613fe (patch) | |
tree | f601e0fc314da8cee5001f208b46482262f5be14 /ui | |
parent | cf7a7e25fbf94c16ca08ff3e889bdd4373751e2c (diff) | |
download | v2-3b39f0883c60b6978c6c6df2c0029bd4c96613fe.tar.gz v2-3b39f0883c60b6978c6c6df2c0029bd4c96613fe.tar.zst v2-3b39f0883c60b6978c6c6df2c0029bd4c96613fe.zip |
Rewrite RealIP() to avoid returning an empty string
Diffstat (limited to 'ui')
-rw-r--r-- | ui/login_check.go | 4 | ||||
-rw-r--r-- | ui/oauth2_callback.go | 4 |
2 files changed, 3 insertions, 5 deletions
diff --git a/ui/login_check.go b/ui/login_check.go index bc49c8d1..7cd63b7e 100644 --- a/ui/login_check.go +++ b/ui/login_check.go @@ -5,6 +5,7 @@ import ( "github.com/miniflux/miniflux/http/context" "github.com/miniflux/miniflux/http/cookie" + "github.com/miniflux/miniflux/http/request" "github.com/miniflux/miniflux/http/response" "github.com/miniflux/miniflux/http/response/html" "github.com/miniflux/miniflux/http/route" @@ -12,7 +13,6 @@ import ( "github.com/miniflux/miniflux/ui/form" "github.com/miniflux/miniflux/ui/session" "github.com/miniflux/miniflux/ui/view" - "github.com/tomasen/realip" ) // CheckLogin validates the username/password and redirects the user to the unread page. @@ -38,7 +38,7 @@ func (c *Controller) CheckLogin(w http.ResponseWriter, r *http.Request) { return } - sessionToken, userID, err := c.store.CreateUserSession(authForm.Username, r.UserAgent(), realip.RealIP(r)) + sessionToken, userID, err := c.store.CreateUserSession(authForm.Username, r.UserAgent(), request.RealIP(r)) if err != nil { html.ServerError(w, err) return diff --git a/ui/oauth2_callback.go b/ui/oauth2_callback.go index f564c7ef..23e379b2 100644 --- a/ui/oauth2_callback.go +++ b/ui/oauth2_callback.go @@ -16,8 +16,6 @@ import ( "github.com/miniflux/miniflux/logger" "github.com/miniflux/miniflux/model" "github.com/miniflux/miniflux/ui/session" - - "github.com/tomasen/realip" ) // OAuth2Callback receives the authorization code and create a new session. @@ -107,7 +105,7 @@ func (c *Controller) OAuth2Callback(w http.ResponseWriter, r *http.Request) { } } - sessionToken, _, err := c.store.CreateUserSession(user.Username, r.UserAgent(), realip.RealIP(r)) + sessionToken, _, err := c.store.CreateUserSession(user.Username, r.UserAgent(), request.RealIP(r)) if err != nil { html.ServerError(w, err) return |