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 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. "github.com/go-macaron/binding"
  7. "gopkg.in/macaron.v1"
  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 valideates 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(35)"`
  21. Email string `binding:"Required;Email;MaxSize(254)"`
  22. }
  23. // Validate valideates the fields
  24. func (f *SignUpOpenIDForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
  25. return validate(errs, ctx.Data, f, ctx.Locale)
  26. }
  27. // ConnectOpenIDForm form for connecting an existing account to an OpenID URI
  28. type ConnectOpenIDForm struct {
  29. UserName string `binding:"Required;MaxSize(254)"`
  30. Password string `binding:"Required;MaxSize(255)"`
  31. }
  32. // Validate valideates the fields
  33. func (f *ConnectOpenIDForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
  34. return validate(errs, ctx.Data, f, ctx.Locale)
  35. }