admin.go 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. MaxRepoCreation int
  47. Active bool
  48. Admin bool
  49. AllowGitHook bool
  50. AllowImportLocal bool
  51. Suspended bool
  52. IsVerified bool
  53. IsMaker bool
  54. IsBugHunter bool
  55. GitoteDeveloper bool
  56. PrivateProfile bool
  57. IsBeta bool
  58. IsStaff bool
  59. }
  60. // Validate validates form fields
  61. func (f *AdminEditUser) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
  62. return validate(errs, ctx.Data, f, ctx.Locale)
  63. }