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.
52 lines
1.6 KiB
52 lines
1.6 KiB
8 years ago
|
// Copyright 2017 The Gitea Authors. All rights reserved.
|
||
|
// Use of this source code is governed by a MIT-style
|
||
|
// license that can be found in the LICENSE file.
|
||
|
|
||
4 years ago
|
package forms
|
||
8 years ago
|
|
||
|
import (
|
||
4 years ago
|
"net/http"
|
||
|
|
||
|
"code.gitea.io/gitea/modules/context"
|
||
4 years ago
|
"code.gitea.io/gitea/modules/web/middleware"
|
||
4 years ago
|
"gitea.com/go-chi/binding"
|
||
8 years ago
|
)
|
||
|
|
||
|
// SignInOpenIDForm form for signing in with OpenID
|
||
|
type SignInOpenIDForm struct {
|
||
8 years ago
|
Openid string `binding:"Required;MaxSize(256)"`
|
||
8 years ago
|
Remember bool
|
||
|
}
|
||
|
|
||
4 years ago
|
// Validate validates the fields
|
||
4 years ago
|
func (f *SignInOpenIDForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||
|
ctx := context.GetContext(req)
|
||
4 years ago
|
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||
8 years ago
|
}
|
||
|
|
||
|
// SignUpOpenIDForm form for signin up with OpenID
|
||
|
type SignUpOpenIDForm struct {
|
||
6 years ago
|
UserName string `binding:"Required;AlphaDashDot;MaxSize(40)"`
|
||
6 years ago
|
Email string `binding:"Required;Email;MaxSize(254)"`
|
||
|
GRecaptchaResponse string `form:"g-recaptcha-response"`
|
||
4 years ago
|
HcaptchaResponse string `form:"h-captcha-response"`
|
||
8 years ago
|
}
|
||
|
|
||
4 years ago
|
// Validate validates the fields
|
||
4 years ago
|
func (f *SignUpOpenIDForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||
|
ctx := context.GetContext(req)
|
||
4 years ago
|
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||
8 years ago
|
}
|
||
|
|
||
|
// ConnectOpenIDForm form for connecting an existing account to an OpenID URI
|
||
|
type ConnectOpenIDForm struct {
|
||
|
UserName string `binding:"Required;MaxSize(254)"`
|
||
|
Password string `binding:"Required;MaxSize(255)"`
|
||
|
}
|
||
|
|
||
4 years ago
|
// Validate validates the fields
|
||
4 years ago
|
func (f *ConnectOpenIDForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||
|
ctx := context.GetContext(req)
|
||
4 years ago
|
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||
8 years ago
|
}
|