Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

admin.go 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. // 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(35)"`
  14. Email string `binding:"Required;Email;MaxSize(254)"`
  15. Password string `binding:"MaxSize(255)"`
  16. SendNotify bool
  17. }
  18. // Validate validates form fields
  19. func (f *AdminCreateUserForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
  20. return validate(errs, ctx.Data, f, ctx.Locale)
  21. }
  22. // AdminEditUserForm form for admin to create user
  23. type AdminEditUserForm struct {
  24. LoginType string `binding:"Required"`
  25. LoginName string
  26. FullName string `binding:"MaxSize(100)"`
  27. Email string `binding:"Required;Email;MaxSize(254)"`
  28. Password string `binding:"MaxSize(255)"`
  29. Website string `binding:"ValidUrl;MaxSize(255)"`
  30. Location string `binding:"MaxSize(50)"`
  31. MaxRepoCreation int
  32. Active bool
  33. Admin bool
  34. AllowGitHook bool
  35. AllowImportLocal bool
  36. AllowCreateOrganization bool
  37. ProhibitLogin bool
  38. }
  39. // Validate validates form fields
  40. func (f *AdminEditUserForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
  41. return validate(errs, ctx.Data, f, ctx.Locale)
  42. }