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.

68 lines
2.4 KiB

  1. // Copyright 2014 The Gogs Authors. All rights reserved.
  2. // Copyright 2019 The Gitea Authors. All rights reserved.
  3. // Use of this source code is governed by a MIT-style
  4. // license that can be found in the LICENSE file.
  5. package auth
  6. import (
  7. "code.gitea.io/gitea/models"
  8. "code.gitea.io/gitea/modules/structs"
  9. "github.com/go-macaron/binding"
  10. "gopkg.in/macaron.v1"
  11. )
  12. // ________ .__ __ .__
  13. // \_____ \_______ _________ ____ |__|____________ _/ |_|__| ____ ____
  14. // / | \_ __ \/ ___\__ \ / \| \___ /\__ \\ __\ |/ _ \ / \
  15. // / | \ | \/ /_/ > __ \| | \ |/ / / __ \| | | ( <_> ) | \
  16. // \_______ /__| \___ (____ /___| /__/_____ \(____ /__| |__|\____/|___| /
  17. // \/ /_____/ \/ \/ \/ \/ \/
  18. // CreateOrgForm form for creating organization
  19. type CreateOrgForm struct {
  20. OrgName string `binding:"Required;AlphaDashDot;MaxSize(40)" locale:"org.org_name_holder"`
  21. Visibility structs.VisibleType
  22. }
  23. // Validate validates the fields
  24. func (f *CreateOrgForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
  25. return validate(errs, ctx.Data, f, ctx.Locale)
  26. }
  27. // UpdateOrgSettingForm form for updating organization settings
  28. type UpdateOrgSettingForm struct {
  29. Name string `binding:"Required;AlphaDashDot;MaxSize(40)" locale:"org.org_name_holder"`
  30. FullName string `binding:"MaxSize(100)"`
  31. Description string `binding:"MaxSize(255)"`
  32. Website string `binding:"ValidUrl;MaxSize(255)"`
  33. Location string `binding:"MaxSize(50)"`
  34. Visibility structs.VisibleType
  35. MaxRepoCreation int
  36. }
  37. // Validate validates the fields
  38. func (f *UpdateOrgSettingForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
  39. return validate(errs, ctx.Data, f, ctx.Locale)
  40. }
  41. // ___________
  42. // \__ ___/___ _____ _____
  43. // | |_/ __ \\__ \ / \
  44. // | |\ ___/ / __ \| Y Y \
  45. // |____| \___ >____ /__|_| /
  46. // \/ \/ \/
  47. // CreateTeamForm form for creating team
  48. type CreateTeamForm struct {
  49. TeamName string `binding:"Required;AlphaDashDot;MaxSize(30)"`
  50. Description string `binding:"MaxSize(255)"`
  51. Permission string
  52. Units []models.UnitType
  53. }
  54. // Validate validates the fields
  55. func (f *CreateTeamForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
  56. return validate(errs, ctx.Data, f, ctx.Locale)
  57. }