loading up the forgejo repo on tangled to test page performance
1// Copyright 2017 The Gitea Authors. All rights reserved.
2// SPDX-License-Identifier: MIT
3
4package forms
5
6import (
7 "net/http"
8
9 "forgejo.org/modules/web/middleware"
10 "forgejo.org/services/context"
11
12 "code.forgejo.org/go-chi/binding"
13)
14
15// SignInOpenIDForm form for signing in with OpenID
16type SignInOpenIDForm struct {
17 Openid string `binding:"Required;MaxSize(256)"`
18 Remember bool
19}
20
21// Validate validates the fields
22func (f *SignInOpenIDForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
23 ctx := context.GetValidateContext(req)
24 return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
25}
26
27// SignUpOpenIDForm form for signin up with OpenID
28type SignUpOpenIDForm struct {
29 UserName string `binding:"Required;Username;MaxSize(40)"`
30 Email string `binding:"Required;EmailWithAllowedDomain;MaxSize(254)"`
31}
32
33// Validate validates the fields
34func (f *SignUpOpenIDForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
35 ctx := context.GetValidateContext(req)
36 return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
37}
38
39// ConnectOpenIDForm form for connecting an existing account to an OpenID URI
40type ConnectOpenIDForm struct {
41 UserName string `binding:"Required;MaxSize(254)"`
42 Password string `binding:"Required;MaxSize(255)"`
43}
44
45// Validate validates the fields
46func (f *ConnectOpenIDForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
47 ctx := context.GetValidateContext(req)
48 return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
49}