You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.3 KiB

  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. "gopkg.in/macaron.v1"
  7. "github.com/go-macaron/binding"
  8. )
  9. type AdminCrateUserForm struct {
  10. LoginType string `binding:"Required"`
  11. LoginName string
  12. UserName string `binding:"Required;AlphaDashDot;MaxSize(35)"`
  13. Email string `binding:"Required;Email;MaxSize(254)"`
  14. Password string `binding:"MaxSize(255)"`
  15. SendNotify bool
  16. }
  17. func (f *AdminCrateUserForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
  18. return validate(errs, ctx.Data, f, ctx.Locale)
  19. }
  20. type AdminEditUserForm struct {
  21. LoginType string `binding:"Required"`
  22. LoginName string
  23. FullName string `binding:"MaxSize(100)"`
  24. Email string `binding:"Required;Email;MaxSize(254)"`
  25. Password string `binding:"MaxSize(255)"`
  26. Website string `binding:"MaxSize(50)"`
  27. Location string `binding:"MaxSize(50)"`
  28. MaxRepoCreation int
  29. Active bool
  30. Admin bool
  31. AllowGitHook bool
  32. AllowImportLocal bool
  33. }
  34. func (f *AdminEditUserForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
  35. return validate(errs, ctx.Data, f, ctx.Locale)
  36. }