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.

auth_form.go 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. "github.com/go-macaron/binding"
  7. "gopkg.in/macaron.v1"
  8. )
  9. // AuthenticationForm form for authentication
  10. type AuthenticationForm struct {
  11. ID int64
  12. Type int `binding:"Range(2,6)"`
  13. Name string `binding:"Required;MaxSize(30)"`
  14. Host string
  15. Port int
  16. BindDN string
  17. BindPassword string
  18. UserBase string
  19. UserDN string
  20. AttributeUsername string
  21. AttributeName string
  22. AttributeSurname string
  23. AttributeMail string
  24. AttributesInBind bool
  25. Filter string
  26. AdminFilter string
  27. IsActive bool
  28. SMTPAuth string
  29. SMTPHost string
  30. SMTPPort int
  31. AllowedDomains string
  32. SecurityProtocol int `binding:"Range(0,2)"`
  33. TLS bool
  34. SkipVerify bool
  35. PAMServiceName string
  36. Oauth2Provider string
  37. Oauth2Key string
  38. Oauth2Secret string
  39. }
  40. // Validate validates fields
  41. func (f *AuthenticationForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
  42. return validate(errs, ctx.Data, f, ctx.Locale)
  43. }