diff options
author | 2022-10-08 13:49:56 +0200 | |
---|---|---|
committer | 2022-10-08 13:49:56 +0200 | |
commit | 3bb45b71796cc4e7010a6ba89c27760877084d71 (patch) | |
tree | 1cdd737963482daab1c99636dc8f25205d628f09 /internal/api/client/auth/signin.go | |
parent | [bugfix] Fix new domain block date (#893) (diff) | |
download | gotosocial-3bb45b71796cc4e7010a6ba89c27760877084d71.tar.xz |
[feature] `oob` oauth token support (#889)
* move helpful advice into oauth server
* rewrite HandleAuthorizeRequest to allow oob
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 06b601b10..73a5de398 100644 --- a/internal/api/client/auth/signin.go +++ b/internal/api/client/auth/signin.go @@ -29,6 +29,7 @@ import ( "github.com/superseriousbusiness/gotosocial/internal/api" "github.com/superseriousbusiness/gotosocial/internal/config" "github.com/superseriousbusiness/gotosocial/internal/gtserror" + "github.com/superseriousbusiness/gotosocial/internal/oauth" "golang.org/x/crypto/bcrypt" ) @@ -86,7 +87,7 @@ func (m *Module) SignInPOSTHandler(c *gin.Context) { form := &login{} if err := c.ShouldBind(form); err != nil { m.clearSession(s) - api.ErrorHandler(c, gtserror.NewErrorBadRequest(err, helpfulAdvice), m.processor.InstanceGet) + api.ErrorHandler(c, gtserror.NewErrorBadRequest(err, oauth.HelpfulAdvice), m.processor.InstanceGet) return } @@ -101,7 +102,7 @@ func (m *Module) SignInPOSTHandler(c *gin.Context) { s.Set(sessionUserID, userid) if err := s.Save(); err != nil { err := fmt.Errorf("error saving user id onto session: %s", err) - api.ErrorHandler(c, gtserror.NewErrorInternalError(err, helpfulAdvice), m.processor.InstanceGet) + api.ErrorHandler(c, gtserror.NewErrorInternalError(err, oauth.HelpfulAdvice), m.processor.InstanceGet) } c.Redirect(http.StatusFound, OauthAuthorizePath) @@ -140,5 +141,5 @@ func (m *Module) ValidatePassword(ctx context.Context, email string, password st // only a generic 'safe' error message to the user, to not give any info away. func incorrectPassword(err error) (string, gtserror.WithCode) { safeErr := fmt.Errorf("password/email combination was incorrect") - return "", gtserror.NewErrorUnauthorized(err, safeErr.Error(), helpfulAdvice) + return "", gtserror.NewErrorUnauthorized(err, safeErr.Error(), oauth.HelpfulAdvice) } |