本站源代码
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

50 Zeilen
1.7KB

  1. // Copyright 2014 The Gogs Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package auth
  5. import (
  6. "gitea.com/macaron/binding"
  7. "gitea.com/macaron/macaron"
  8. )
  9. // AdminCreateUserForm form for admin to create user
  10. type AdminCreateUserForm struct {
  11. LoginType string `binding:"Required"`
  12. LoginName string
  13. UserName string `binding:"Required;AlphaDashDot;MaxSize(40)"`
  14. Email string `binding:"Required;Email;MaxSize(254)"`
  15. Password string `binding:"MaxSize(255)"`
  16. SendNotify bool
  17. MustChangePassword bool
  18. }
  19. // Validate validates form fields
  20. func (f *AdminCreateUserForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
  21. return validate(errs, ctx.Data, f, ctx.Locale)
  22. }
  23. // AdminEditUserForm form for admin to create user
  24. type AdminEditUserForm struct {
  25. LoginType string `binding:"Required"`
  26. LoginName string
  27. FullName string `binding:"MaxSize(100)"`
  28. Email string `binding:"Required;Email;MaxSize(254)"`
  29. Password string `binding:"MaxSize(255)"`
  30. Website string `binding:"ValidUrl;MaxSize(255)"`
  31. Location string `binding:"MaxSize(50)"`
  32. MaxRepoCreation int
  33. Active bool
  34. Admin bool
  35. AllowGitHook bool
  36. AllowImportLocal bool
  37. AllowCreateOrganization bool
  38. ProhibitLogin bool
  39. }
  40. // Validate validates form fields
  41. func (f *AdminEditUserForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
  42. return validate(errs, ctx.Data, f, ctx.Locale)
  43. }
上海开阖软件有限公司 沪ICP备12045867号-1