Enhance authentication UX (#3807)

This commit is contained in:
Anbraten
2024-06-21 09:55:30 +02:00
committed by GitHub
parent fbb96ff8f5
commit 1a39d57f71
18 changed files with 116 additions and 187 deletions

View File

@@ -111,16 +111,7 @@ func (c *Forgejo) oauth2Config(ctx context.Context) (*oauth2.Config, context.Con
// Forgejo account details are returned when the user is successfully authenticated.
func (c *Forgejo) Login(ctx context.Context, req *forge_types.OAuthRequest) (*model.User, string, error) {
config, oauth2Ctx := c.oauth2Config(ctx)
redirectURL := config.AuthCodeURL("woodpecker")
// check the OAuth errors
if req.Error != "" {
return nil, redirectURL, &forge_types.AuthError{
Err: req.Error,
Description: req.ErrorDescription,
URI: req.ErrorURI,
}
}
redirectURL := config.AuthCodeURL(req.State)
// check the OAuth code
if len(req.Code) == 0 {