admin.go 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. Makerlog string `binding:"MaxSize(50)"`
  42. Stackoverflow string `binding:"MaxSize(50)"`
  43. Twitch 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. IsBugHunter bool
  58. GitoteDeveloper bool
  59. PrivateProfile bool
  60. IsBeta bool
  61. IsStaff bool
  62. IsIntern bool
  63. }
  64. // Validate validates form fields
  65. func (f *AdminEditUser) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
  66. return validate(errs, ctx.Data, f, ctx.Locale)
  67. }