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.

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