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.
71 lines
2.3 KiB
71 lines
2.3 KiB
11 years ago
|
// Copyright 2014 The Gogs 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
|
||
11 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"
|
||
11 years ago
|
)
|
||
|
|
||
8 years ago
|
// AdminCreateUserForm form for admin to create user
|
||
|
type AdminCreateUserForm struct {
|
||
6 years ago
|
LoginType string `binding:"Required"`
|
||
|
LoginName string
|
||
6 years ago
|
UserName string `binding:"Required;AlphaDashDot;MaxSize(40)"`
|
||
6 years ago
|
Email string `binding:"Required;Email;MaxSize(254)"`
|
||
|
Password string `binding:"MaxSize(255)"`
|
||
|
SendNotify bool
|
||
|
MustChangePassword bool
|
||
9 years ago
|
}
|
||
|
|
||
8 years ago
|
// Validate validates form fields
|
||
4 years ago
|
func (f *AdminCreateUserForm) 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)
|
||
9 years ago
|
}
|
||
|
|
||
8 years ago
|
// AdminEditUserForm form for admin to create user
|
||
11 years ago
|
type AdminEditUserForm struct {
|
||
8 years ago
|
LoginType string `binding:"Required"`
|
||
4 years ago
|
UserName string `binding:"AlphaDashDot;MaxSize(40)"`
|
||
8 years ago
|
LoginName string
|
||
|
FullName string `binding:"MaxSize(100)"`
|
||
|
Email string `binding:"Required;Email;MaxSize(254)"`
|
||
|
Password string `binding:"MaxSize(255)"`
|
||
8 years ago
|
Website string `binding:"ValidUrl;MaxSize(255)"`
|
||
8 years ago
|
Location string `binding:"MaxSize(50)"`
|
||
|
MaxRepoCreation int
|
||
|
Active bool
|
||
|
Admin bool
|
||
5 years ago
|
Restricted bool
|
||
8 years ago
|
AllowGitHook bool
|
||
|
AllowImportLocal bool
|
||
|
AllowCreateOrganization bool
|
||
|
ProhibitLogin bool
|
||
4 years ago
|
Reset2FA bool `form:"reset_2fa"`
|
||
11 years ago
|
}
|
||
|
|
||
8 years ago
|
// Validate validates form fields
|
||
4 years ago
|
func (f *AdminEditUserForm) 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)
|
||
11 years ago
|
}
|
||
5 years ago
|
|
||
|
// AdminDashboardForm form for admin dashboard operations
|
||
|
type AdminDashboardForm struct {
|
||
4 years ago
|
Op string `binding:"required"`
|
||
|
From string
|
||
5 years ago
|
}
|
||
|
|
||
|
// Validate validates form fields
|
||
4 years ago
|
func (f *AdminDashboardForm) 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)
|
||
5 years ago
|
}
|