summaryrefslogtreecommitdiff
path: root/internal/api/auth/signin.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2023-02-02 14:08:13 +0100
committerLibravatar GitHub <noreply@github.com>2023-02-02 14:08:13 +0100
commit382512a5a6cc3f13576bbde8d607098d019f4063 (patch)
treedc2ccd1d30cd65b3f3d576a8d2a6910bbecc593a /internal/api/auth/signin.go
parent[chore/performance] use only 1 sqlite db connection regardless of multiplier ... (diff)
downloadgotosocial-382512a5a6cc3f13576bbde8d607098d019f4063.tar.xz
[feature] Implement `/api/v2/instance` endpoint (#1409)
* interim: start adding /api/v2/instance * finish up
Diffstat (limited to 'internal/api/auth/signin.go')
-rw-r--r--internal/api/auth/signin.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/internal/api/auth/signin.go b/internal/api/auth/signin.go
index cf5bd4c84..42eed9476 100644
--- a/internal/api/auth/signin.go
+++ b/internal/api/auth/signin.go
@@ -45,14 +45,14 @@ type login struct {
// If an idp provider is set, then the user will be redirected to that to do their sign in.
func (m *Module) SignInGETHandler(c *gin.Context) {
if _, err := apiutil.NegotiateAccept(c, apiutil.HTMLAcceptHeaders...); err != nil {
- apiutil.ErrorHandler(c, gtserror.NewErrorNotAcceptable(err, err.Error()), m.processor.InstanceGet)
+ apiutil.ErrorHandler(c, gtserror.NewErrorNotAcceptable(err, err.Error()), m.processor.InstanceGetV1)
return
}
if !config.GetOIDCEnabled() {
- instance, errWithCode := m.processor.InstanceGet(c.Request.Context(), config.GetHost())
+ instance, errWithCode := m.processor.InstanceGetV1(c.Request.Context())
if errWithCode != nil {
- apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGet)
+ apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
return
}
@@ -71,7 +71,7 @@ func (m *Module) SignInGETHandler(c *gin.Context) {
if !ok {
m.clearSession(s)
err := fmt.Errorf("key %s was not found in session", sessionInternalState)
- apiutil.ErrorHandler(c, gtserror.NewErrorBadRequest(err, err.Error()), m.processor.InstanceGet)
+ apiutil.ErrorHandler(c, gtserror.NewErrorBadRequest(err, err.Error()), m.processor.InstanceGetV1)
return
}
@@ -87,7 +87,7 @@ func (m *Module) SignInPOSTHandler(c *gin.Context) {
form := &login{}
if err := c.ShouldBind(form); err != nil {
m.clearSession(s)
- apiutil.ErrorHandler(c, gtserror.NewErrorBadRequest(err, oauth.HelpfulAdvice), m.processor.InstanceGet)
+ apiutil.ErrorHandler(c, gtserror.NewErrorBadRequest(err, oauth.HelpfulAdvice), m.processor.InstanceGetV1)
return
}
@@ -95,14 +95,14 @@ func (m *Module) SignInPOSTHandler(c *gin.Context) {
if errWithCode != nil {
// don't clear session here, so the user can just press back and try again
// if they accidentally gave the wrong password or something
- apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGet)
+ apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
return
}
s.Set(sessionUserID, userid)
if err := s.Save(); err != nil {
err := fmt.Errorf("error saving user id onto session: %s", err)
- apiutil.ErrorHandler(c, gtserror.NewErrorInternalError(err, oauth.HelpfulAdvice), m.processor.InstanceGet)
+ apiutil.ErrorHandler(c, gtserror.NewErrorInternalError(err, oauth.HelpfulAdvice), m.processor.InstanceGetV1)
}
c.Redirect(http.StatusFound, "/oauth"+OauthAuthorizePath)