admin.go 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. // Copyright 2015 The Gogs Authors. All rights reserved.
  2. // Copyright 2018 Gitote. All rights reserved.
  3. //
  4. // This source code is licensed under the MIT license found in the
  5. // LICENSE file in the root directory of this source tree.
  6. package form
  7. import (
  8. "github.com/go-macaron/binding"
  9. "gopkg.in/macaron.v1"
  10. )
  11. // AdminCreateUser form for admin to create user
  12. type AdminCreateUser struct {
  13. LoginType string `binding:"Required"`
  14. LoginName string
  15. UserName string `binding:"Required;AlphaDashDot;MaxSize(35)"`
  16. Email string `binding:"Required;Email;MaxSize(254)"`
  17. Password string `binding:"MaxSize(255)"`
  18. SendNotify bool
  19. }
  20. // Validate validates form fields
  21. func (f *AdminCreateUser) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
  22. return validate(errs, ctx.Data, f, ctx.Locale)
  23. }
  24. // AdminEditUser form for admin to create user
  25. type AdminEditUser struct {
  26. LoginType string `binding:"Required"`
  27. LoginName string
  28. FullName string `binding:"MaxSize(100)"`
  29. Company string
  30. Description string
  31. ThemeColor string
  32. Email string `binding:"Required;Email;MaxSize(254)"`
  33. Password string `binding:"MaxSize(255)"`
  34. Website string `binding:"MaxSize(50)"`
  35. Location string `binding:"MaxSize(50)"`
  36. Status string `binding:"MaxSize(50)"`
  37. StaffNotes string `binding:"MaxSize(255)"`
  38. Twitter string `binding:"MaxSize(50)"`
  39. Linkedin string `binding:"MaxSize(50)"`
  40. Github string `binding:"MaxSize(50)"`
  41. Makerlog string `binding:"MaxSize(50)"`
  42. Stackoverflow string `binding:"MaxSize(50)"`
  43. Reddit string `binding:"MaxSize(50)"`
  44. Telegram string `binding:"MaxSize(50)"`
  45. Codepen string `binding:"MaxSize(50)"`
  46. Gitlab string `binding:"MaxSize(50)"`
  47. Recognized string
  48. Certified string
  49. MaxRepoCreation int
  50. Active bool
  51. Admin bool
  52. AllowGitHook bool
  53. AllowImportLocal bool
  54. Suspended bool
  55. IsVerified bool
  56. IsMaker bool
  57. IsStreamer bool
  58. IsBugHunter bool
  59. GitoteDeveloper bool
  60. PrivateProfile bool
  61. IsBeta bool
  62. IsStaff bool
  63. IsIntern bool
  64. }
  65. // Validate validates form fields
  66. func (f *AdminEditUser) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
  67. return validate(errs, ctx.Data, f, ctx.Locale)
  68. }