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.

61 lines
2.2 KiB

  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/go-macaron/binding"
  7. "gopkg.in/macaron.v1"
  8. )
  9. // ________ .__ __ .__
  10. // \_____ \_______ _________ ____ |__|____________ _/ |_|__| ____ ____
  11. // / | \_ __ \/ ___\__ \ / \| \___ /\__ \\ __\ |/ _ \ / \
  12. // / | \ | \/ /_/ > __ \| | \ |/ / / __ \| | | ( <_> ) | \
  13. // \_______ /__| \___ (____ /___| /__/_____ \(____ /__| |__|\____/|___| /
  14. // \/ /_____/ \/ \/ \/ \/ \/
  15. // CreateOrgForm form for creating organization
  16. type CreateOrgForm struct {
  17. OrgName string `binding:"Required;AlphaDashDot;MaxSize(35)" locale:"org.org_name_holder"`
  18. }
  19. // Validate valideates the fields
  20. func (f *CreateOrgForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
  21. return validate(errs, ctx.Data, f, ctx.Locale)
  22. }
  23. // UpdateOrgSettingForm form for updating organization settings
  24. type UpdateOrgSettingForm struct {
  25. Name string `binding:"Required;AlphaDashDot;MaxSize(35)" locale:"org.org_name_holder"`
  26. FullName string `binding:"MaxSize(100)"`
  27. Description string `binding:"MaxSize(255)"`
  28. Website string `binding:"Url;MaxSize(255)"`
  29. Location string `binding:"MaxSize(50)"`
  30. MaxRepoCreation int
  31. }
  32. // Validate valideates the fields
  33. func (f *UpdateOrgSettingForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
  34. return validate(errs, ctx.Data, f, ctx.Locale)
  35. }
  36. // ___________
  37. // \__ ___/___ _____ _____
  38. // | |_/ __ \\__ \ / \
  39. // | |\ ___/ / __ \| Y Y \
  40. // |____| \___ >____ /__|_| /
  41. // \/ \/ \/
  42. // CreateTeamForm form for creating team
  43. type CreateTeamForm struct {
  44. TeamName string `binding:"Required;AlphaDashDot;MaxSize(30)"`
  45. Description string `binding:"MaxSize(255)"`
  46. Permission string
  47. }
  48. // Validate valideates the fields
  49. func (f *CreateTeamForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
  50. return validate(errs, ctx.Data, f, ctx.Locale)
  51. }