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.

user_form_auth_openid.go 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. GRecaptchaResponse string `form:"g-recaptcha-response"`
  23. }
  24. // Validate valideates 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 valideates 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. }