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

@@ -100,16 +100,7 @@ func (c *client) URL() string {
// Login authenticates the session and returns the forge user details.
func (c *client) Login(ctx context.Context, req *forge_types.OAuthRequest) (*model.User, string, error) {
config := c.newConfig()
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 {
@@ -662,9 +653,6 @@ func (c *client) getTagCommitSHA(ctx context.Context, repo *model.Repo, tagName
}
gh := c.newClientToken(ctx, user.Token)
if err != nil {
return "", err
}
page := 1
var tag *github.RepositoryTag