diff options
author | 2021-10-11 05:37:33 -0700 | |
---|---|---|
committer | 2021-10-11 14:37:33 +0200 | |
commit | 083099a9575f8b2fac22c1d4a51a9dd0e2201243 (patch) | |
tree | d1787aa544679c433f797d2313ce532250fe574f /internal/api/client/auth/signin.go | |
parent | Handle forwarded messages (#273) (diff) | |
download | gotosocial-083099a9575f8b2fac22c1d4a51a9dd0e2201243.tar.xz |
reference global logrus (#274)
* reference logrus' global logger instead of passing and storing a logger reference everywhere
* always directly use global logrus logger instead of referencing an instance
* test suites should also directly use the global logrus logger
* rename gin logging function to clarify that it's middleware
* correct comments which erroneously referenced removed logger parameter
* setting log level for tests now uses logrus' exported type instead of the string value, to guarantee error isn't possible
Diffstat (limited to 'internal/api/client/auth/signin.go')
-rw-r--r-- | internal/api/client/auth/signin.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/internal/api/client/auth/signin.go b/internal/api/client/auth/signin.go index 6b8bb93db..68944226f 100644 --- a/internal/api/client/auth/signin.go +++ b/internal/api/client/auth/signin.go @@ -21,6 +21,7 @@ package auth import ( "context" "errors" + "github.com/sirupsen/logrus" "net/http" "github.com/gin-contrib/sessions" @@ -40,7 +41,7 @@ type login struct { // The idea is to present a sign in page to the user, where they can enter their username and password. // The form will then POST to the sign in page, which will be handled by SignInPOSTHandler func (m *Module) SignInGETHandler(c *gin.Context) { - l := m.log.WithField("func", "SignInGETHandler") + l := logrus.WithField("func", "SignInGETHandler") l.Trace("entering sign in handler") if m.idp != nil { s := sessions.Default(c) @@ -65,7 +66,7 @@ func (m *Module) SignInGETHandler(c *gin.Context) { // The idea is to present a sign in page to the user, where they can enter their username and password. // The handler will then redirect to the auth handler served at /auth func (m *Module) SignInPOSTHandler(c *gin.Context) { - l := m.log.WithField("func", "SignInPOSTHandler") + l := logrus.WithField("func", "SignInPOSTHandler") s := sessions.Default(c) form := &login{} if err := c.ShouldBind(form); err != nil { @@ -98,7 +99,7 @@ func (m *Module) SignInPOSTHandler(c *gin.Context) { // address stored in the database. If OK, we return the userid (a ulid) for that user, // so that it can be used in further Oauth flows to generate a token/retreieve an oauth client from the db. func (m *Module) ValidatePassword(ctx context.Context, email string, password string) (userid string, err error) { - l := m.log.WithField("func", "ValidatePassword") + l := logrus.WithField("func", "ValidatePassword") // make sure an email/password was provided and bail if not if email == "" || password == "" { |