webhook: sourcehut_builds: ask for access_token instead of authorization_header
This commit is contained in:
parent
3155e21cbb
commit
36f05e6f4e
6 changed files with 37 additions and 24 deletions
|
@ -49,6 +49,7 @@ type buildsForm struct {
|
|||
ManifestPath string `binding:"Required"`
|
||||
Visibility string `binding:"Required;In(PUBLIC,UNLISTED,PRIVATE)"`
|
||||
Secrets bool
|
||||
AccessToken string `binding:"Required"`
|
||||
}
|
||||
|
||||
var _ binding.Validator = &buildsForm{}
|
||||
|
@ -63,13 +64,7 @@ func (f *buildsForm) Validate(req *http.Request, errs binding.Errors) binding.Er
|
|||
Message: ctx.Locale.TrString("repo.settings.add_webhook.invalid_path"),
|
||||
})
|
||||
}
|
||||
if !strings.HasPrefix(f.AuthorizationHeader, "Bearer ") {
|
||||
errs = append(errs, binding.Error{
|
||||
FieldNames: []string{"AuthorizationHeader"},
|
||||
Classification: "",
|
||||
Message: ctx.Locale.TrString("form.required_prefix", "Bearer "),
|
||||
})
|
||||
}
|
||||
f.AuthorizationHeader = "Bearer " + strings.TrimSpace(f.AccessToken)
|
||||
return errs
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue