admin.go 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. // Copyright 2015 - Present, The Gogs Authors. All rights reserved.
  2. // Copyright 2018 - Present, 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. Stackoverflow string `binding:"MaxSize(50)"`
  42. Twitch string `binding:"MaxSize(50)"`
  43. Telegram string `binding:"MaxSize(50)"`
  44. Codepen string `binding:"MaxSize(50)"`
  45. Gitlab string `binding:"MaxSize(50)"`
  46. Recognized string
  47. Certified string
  48. MaxRepoCreation int
  49. Active bool
  50. Admin bool
  51. AllowGitHook bool
  52. AllowImportLocal bool
  53. Suspended bool
  54. IsVerified bool
  55. IsMaker bool
  56. IsBugHunter bool
  57. GitoteDeveloper bool
  58. PrivateProfile bool
  59. IsBeta bool
  60. IsStaff bool
  61. IsIntern bool
  62. }
  63. // Validate validates form fields
  64. func (f *AdminEditUser) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
  65. return validate(errs, ctx.Data, f, ctx.Locale)
  66. }