diff options
author | Lanre Adelowo <adelowomailbox@gmail.com> | 2018-09-10 15:31:08 +0100 |
---|---|---|
committer | techknowlogick <techknowlogick@users.noreply.github.com> | 2018-09-10 10:31:08 -0400 |
commit | be48397945c77748d412baad3493bb5bd1c95e2a (patch) | |
tree | d53dc2e78052588b6985400b762e994227183e76 /modules/auth/repo_form.go | |
parent | 6e03390aa8fa096206457962db1955d642860b57 (diff) | |
download | gitea-be48397945c77748d412baad3493bb5bd1c95e2a.tar.gz gitea-be48397945c77748d412baad3493bb5bd1c95e2a.zip |
Slack webhook channel name cannot be empty or just contain an hashtag (#4786)
Diffstat (limited to 'modules/auth/repo_form.go')
-rw-r--r-- | modules/auth/repo_form.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/modules/auth/repo_form.go b/modules/auth/repo_form.go index 3c7940afce..a819a60491 100644 --- a/modules/auth/repo_form.go +++ b/modules/auth/repo_form.go @@ -10,6 +10,8 @@ import ( "strings" "code.gitea.io/gitea/models" + "code.gitea.io/gitea/routers/utils" + "github.com/Unknwon/com" "github.com/go-macaron/binding" "gopkg.in/macaron.v1" @@ -225,6 +227,11 @@ func (f *NewSlackHookForm) Validate(ctx *macaron.Context, errs binding.Errors) b return validate(errs, ctx.Data, f, ctx.Locale) } +// HasInvalidChannel validates the channel name is in the right format +func (f NewSlackHookForm) HasInvalidChannel() bool { + return !utils.IsValidSlackChannel(f.Channel) +} + // NewDiscordHookForm form for creating discord hook type NewDiscordHookForm struct { PayloadURL string `binding:"Required;ValidUrl"` |