You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

org.go 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // Copyright 2014 The Gogs Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package auth
  5. import (
  6. "github.com/Unknwon/macaron"
  7. "github.com/macaron-contrib/i18n"
  8. "github.com/gogits/gogs/modules/middleware/binding"
  9. )
  10. // ________ .__ __ .__
  11. // \_____ \_______ _________ ____ |__|____________ _/ |_|__| ____ ____
  12. // / | \_ __ \/ ___\__ \ / \| \___ /\__ \\ __\ |/ _ \ / \
  13. // / | \ | \/ /_/ > __ \| | \ |/ / / __ \| | | ( <_> ) | \
  14. // \_______ /__| \___ (____ /___| /__/_____ \(____ /__| |__|\____/|___| /
  15. // \/ /_____/ \/ \/ \/ \/ \/
  16. type CreateOrgForm struct {
  17. OrgName string `form:"orgname" binding:"Required;AlphaDashDot;MaxSize(30)"`
  18. Email string `form:"email" binding:"Required;Email;MaxSize(50)"`
  19. }
  20. func (f *CreateOrgForm) Validate(ctx *macaron.Context, errs *binding.Errors, l i18n.Locale) {
  21. validate(errs, ctx.Data, f, l)
  22. }
  23. type OrgSettingForm struct {
  24. DisplayName string `form:"display_name" binding:"Required;MaxSize(100)"`
  25. Email string `form:"email" binding:"Required;Email;MaxSize(50)"`
  26. Description string `form:"desc" binding:"MaxSize(255)"`
  27. Website string `form:"site" binding:"Url;MaxSize(100)"`
  28. Location string `form:"location" binding:"MaxSize(50)"`
  29. }
  30. func (f *OrgSettingForm) Validate(ctx *macaron.Context, errs *binding.Errors, l i18n.Locale) {
  31. validate(errs, ctx.Data, f, l)
  32. }
  33. // ___________
  34. // \__ ___/___ _____ _____
  35. // | |_/ __ \\__ \ / \
  36. // | |\ ___/ / __ \| Y Y \
  37. // |____| \___ >____ /__|_| /
  38. // \/ \/ \/
  39. type CreateTeamForm struct {
  40. TeamName string `form:"name" binding:"Required;AlphaDashDot;MaxSize(30)"`
  41. Description string `form:"desc" binding:"MaxSize(255)"`
  42. Permission string `form:"permission"`
  43. }
  44. func (f *CreateTeamForm) Validate(ctx *macaron.Context, errs *binding.Errors, l i18n.Locale) {
  45. validate(errs, ctx.Data, f, l)
  46. }