org.go 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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:"org_name" 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 UpdateOrgSettingForm struct {
  24. OrgUserName string `form:"uname" binding:"Required;MaxSize(35)"`
  25. OrgFullName string `form:"fullname" binding:"MaxSize(100)"`
  26. Email string `form:"email" binding:"Required;Email;MaxSize(50)"`
  27. Description string `form:"desc" binding:"MaxSize(255)"`
  28. Website string `form:"website" binding:"Url;MaxSize(100)"`
  29. Location string `form:"location" binding:"MaxSize(50)"`
  30. Avatar string `form:"avatar" binding:"Required;Email;MaxSize(50)"`
  31. }
  32. func (f *UpdateOrgSettingForm) Validate(ctx *macaron.Context, errs *binding.Errors, l i18n.Locale) {
  33. validate(errs, ctx.Data, f, l)
  34. }
  35. // ___________
  36. // \__ ___/___ _____ _____
  37. // | |_/ __ \\__ \ / \
  38. // | |\ ___/ / __ \| Y Y \
  39. // |____| \___ >____ /__|_| /
  40. // \/ \/ \/
  41. type CreateTeamForm struct {
  42. TeamName string `form:"team_name" binding:"Required;AlphaDashDot;MaxSize(30)"`
  43. Description string `form:"desc" binding:"MaxSize(255)"`
  44. Permission string `form:"permission"`
  45. }
  46. func (f *CreateTeamForm) Validate(ctx *macaron.Context, errs *binding.Errors, l i18n.Locale) {
  47. validate(errs, ctx.Data, f, l)
  48. }