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.

57 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/Unknwon/macaron"
  7. "github.com/macaron-contrib/binding"
  8. )
  9. // ________ .__ __ .__
  10. // \_____ \_______ _________ ____ |__|____________ _/ |_|__| ____ ____
  11. // / | \_ __ \/ ___\__ \ / \| \___ /\__ \\ __\ |/ _ \ / \
  12. // / | \ | \/ /_/ > __ \| | \ |/ / / __ \| | | ( <_> ) | \
  13. // \_______ /__| \___ (____ /___| /__/_____ \(____ /__| |__|\____/|___| /
  14. // \/ /_____/ \/ \/ \/ \/ \/
  15. type CreateOrgForm struct {
  16. OrgName string `form:"org_name" binding:"Required;AlphaDashDot;MaxSize(30)"`
  17. Email string `form:"email" binding:"Required;Email;MaxSize(50)"`
  18. }
  19. func (f *CreateOrgForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
  20. return validate(errs, ctx.Data, f, ctx.Locale)
  21. }
  22. type UpdateOrgSettingForm struct {
  23. OrgUserName string `form:"uname" binding:"Required;MaxSize(35)"`
  24. OrgFullName string `form:"fullname" binding:"MaxSize(100)"`
  25. Email string `form:"email" binding:"Required;Email;MaxSize(50)"`
  26. Description string `form:"desc" binding:"MaxSize(255)"`
  27. Website string `form:"website" binding:"Url;MaxSize(100)"`
  28. Location string `form:"location" binding:"MaxSize(50)"`
  29. Avatar string `form:"avatar" binding:"Required;Email;MaxSize(50)"`
  30. }
  31. func (f *UpdateOrgSettingForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
  32. return validate(errs, ctx.Data, f, ctx.Locale)
  33. }
  34. // ___________
  35. // \__ ___/___ _____ _____
  36. // | |_/ __ \\__ \ / \
  37. // | |\ ___/ / __ \| Y Y \
  38. // |____| \___ >____ /__|_| /
  39. // \/ \/ \/
  40. type CreateTeamForm struct {
  41. TeamName string `form:"team_name" binding:"Required;AlphaDashDot;MaxSize(30)"`
  42. Description string `form:"desc" binding:"MaxSize(255)"`
  43. Permission string `form:"permission"`
  44. }
  45. func (f *CreateTeamForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
  46. return validate(errs, ctx.Data, f, ctx.Locale)
  47. }