aboutsummaryrefslogtreecommitdiffhomepage
path: root/ui
diff options
context:
space:
mode:
authorGravatar Frédéric Guillot <fred@miniflux.net>2018-10-22 20:49:10 -0700
committerGravatar Frédéric Guillot <fred@miniflux.net>2018-10-22 20:49:10 -0700
commitdc8668b9040ad99d30dd32ae7fe5b51b68ec8e99 (patch)
tree32c13a71804410838222139510a79fc84e93b88b /ui
parentf06a19814bde280277d7e7309d83a4ac538840f2 (diff)
Improve logging for OAuth2 callback
Diffstat (limited to 'ui')
-rw-r--r--ui/oauth2_callback.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/ui/oauth2_callback.go b/ui/oauth2_callback.go
index feaccc4..0aecd1c 100644
--- a/ui/oauth2_callback.go
+++ b/ui/oauth2_callback.go
@@ -19,6 +19,7 @@ import (
// OAuth2Callback receives the authorization code and create a new session.
func (c *Controller) OAuth2Callback(w http.ResponseWriter, r *http.Request) {
+ clientIP := request.ClientIP(r)
printer := locale.NewPrinter(request.UserLanguage(r))
sess := session.New(c.store, request.SessionID(r))
@@ -57,6 +58,8 @@ func (c *Controller) OAuth2Callback(w http.ResponseWriter, r *http.Request) {
return
}
+ logger.Info("[OAuth2] [ClientIP=%s] Successful auth for %s", clientIP, profile)
+
if request.IsAuthenticated(r) {
user, err := c.store.UserByExtraField(profile.Key, profile.ID)
if err != nil {
@@ -104,13 +107,14 @@ func (c *Controller) OAuth2Callback(w http.ResponseWriter, r *http.Request) {
}
}
- sessionToken, _, err := c.store.CreateUserSession(user.Username, r.UserAgent(), request.ClientIP(r))
+ sessionToken, _, err := c.store.CreateUserSession(user.Username, r.UserAgent(), clientIP)
if err != nil {
html.ServerError(w, r, err)
return
}
- logger.Info("[Controller:OAuth2Callback] username=%s just logged in", user.Username)
+ logger.Info("[OAuth2] [ClientIP=%s] username=%s (%s) just logged in", clientIP, user.Username, profile)
+
c.store.SetLastLogin(user.ID)
sess.SetLanguage(user.Language)
sess.SetTheme(user.Theme)