admin.go 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. Telegram string `binding:"MaxSize(50)"`
  43. Codepen string `binding:"MaxSize(50)"`
  44. Gitlab string `binding:"MaxSize(50)"`
  45. MaxRepoCreation int
  46. Active bool
  47. Admin bool
  48. AllowGitHook bool
  49. AllowImportLocal bool
  50. Suspended bool
  51. IsVerified bool
  52. GitoteDeveloper bool
  53. PrivateProfile bool
  54. IsBeta bool
  55. IsStaff bool
  56. }
  57. // Validate validates form fields
  58. func (f *AdminEditUser) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
  59. return validate(errs, ctx.Data, f, ctx.Locale)
  60. }