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.

44 lines
1.4 KiB

  1. // Copyright 2017 The Gitea 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. // SignInOpenIDForm form for signing in with OpenID
  10. type SignInOpenIDForm struct {
  11. Openid string `binding:"Required;MaxSize(256)"`
  12. Remember bool
  13. }
  14. // Validate validates the fields
  15. func (f *SignInOpenIDForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
  16. return validate(errs, ctx.Data, f, ctx.Locale)
  17. }
  18. // SignUpOpenIDForm form for signin up with OpenID
  19. type SignUpOpenIDForm struct {
  20. UserName string `binding:"Required;AlphaDashDot;MaxSize(40)"`
  21. Email string `binding:"Required;Email;MaxSize(254)"`
  22. GRecaptchaResponse string `form:"g-recaptcha-response"`
  23. }
  24. // Validate validates the fields
  25. func (f *SignUpOpenIDForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
  26. return validate(errs, ctx.Data, f, ctx.Locale)
  27. }
  28. // ConnectOpenIDForm form for connecting an existing account to an OpenID URI
  29. type ConnectOpenIDForm struct {
  30. UserName string `binding:"Required;MaxSize(254)"`
  31. Password string `binding:"Required;MaxSize(255)"`
  32. }
  33. // Validate validates the fields
  34. func (f *ConnectOpenIDForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
  35. return validate(errs, ctx.Data, f, ctx.Locale)
  36. }