From 24f614f6db13e5c6720efa518641ffcdcb0d8947 Mon Sep 17 00:00:00 2001 From: Unknown Date: Mon, 5 May 2014 20:52:25 -0400 Subject: Finish add web hook --- modules/auth/repo.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'modules/auth/repo.go') diff --git a/modules/auth/repo.go b/modules/auth/repo.go index 54fa99c8..37b9f1d1 100644 --- a/modules/auth/repo.go +++ b/modules/auth/repo.go @@ -83,3 +83,24 @@ func (f *RepoSettingForm) Validate(errors *binding.BindingErrors, req *http.Requ data := context.Get(reflect.TypeOf(base.TmplData{})).Interface().(base.TmplData) validate(errors, data, f) } + +type NewWebhookForm struct { + Url string `form:"url" binding:"Required;Url"` + ContentType string `form:"content_type" binding:"Required"` + Secret string `form:"secret""` + PushOnly bool `form:"push_only"` + Active bool `form:"active"` +} + +func (f *NewWebhookForm) Name(field string) string { + names := map[string]string{ + "Url": "Payload URL", + "ContentType": "Content type", + } + return names[field] +} + +func (f *NewWebhookForm) Validate(errors *binding.BindingErrors, req *http.Request, context martini.Context) { + data := context.Get(reflect.TypeOf(base.TmplData{})).Interface().(base.TmplData) + validate(errors, data, f) +} -- cgit v1.2.3