diff options
Diffstat (limited to 'routers/admin')
-rw-r--r-- | routers/admin/admin.go | 4 | ||||
-rw-r--r-- | routers/admin/auths.go | 14 | ||||
-rw-r--r-- | routers/admin/users.go | 6 | ||||
-rw-r--r-- | routers/admin/users_test.go | 8 |
4 files changed, 16 insertions, 16 deletions
diff --git a/routers/admin/admin.go b/routers/admin/admin.go index 0ce3dfc05f..c2d94ab9c9 100644 --- a/routers/admin/admin.go +++ b/routers/admin/admin.go @@ -19,7 +19,6 @@ import ( "code.gitea.io/gitea/modules/base" "code.gitea.io/gitea/modules/context" "code.gitea.io/gitea/modules/cron" - auth "code.gitea.io/gitea/modules/forms" "code.gitea.io/gitea/modules/git" "code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/process" @@ -27,6 +26,7 @@ import ( "code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/timeutil" "code.gitea.io/gitea/modules/web" + "code.gitea.io/gitea/services/forms" "code.gitea.io/gitea/services/mailer" jsoniter "github.com/json-iterator/go" @@ -134,7 +134,7 @@ func Dashboard(ctx *context.Context) { // DashboardPost run an admin operation func DashboardPost(ctx *context.Context) { - form := web.GetForm(ctx).(*auth.AdminDashboardForm) + form := web.GetForm(ctx).(*forms.AdminDashboardForm) ctx.Data["Title"] = ctx.Tr("admin.dashboard") ctx.Data["PageIsAdmin"] = true ctx.Data["PageIsAdminDashboard"] = true diff --git a/routers/admin/auths.go b/routers/admin/auths.go index 790eecedb7..a0a20fa023 100644 --- a/routers/admin/auths.go +++ b/routers/admin/auths.go @@ -16,11 +16,11 @@ import ( "code.gitea.io/gitea/modules/auth/pam" "code.gitea.io/gitea/modules/base" "code.gitea.io/gitea/modules/context" - auth "code.gitea.io/gitea/modules/forms" "code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/util" "code.gitea.io/gitea/modules/web" + "code.gitea.io/gitea/services/forms" "xorm.io/xorm/convert" ) @@ -113,7 +113,7 @@ func NewAuthSource(ctx *context.Context) { ctx.HTML(http.StatusOK, tplAuthNew) } -func parseLDAPConfig(form auth.AuthenticationForm) *models.LDAPConfig { +func parseLDAPConfig(form forms.AuthenticationForm) *models.LDAPConfig { var pageSize uint32 if form.UsePagedSearch { pageSize = uint32(form.SearchPageSize) @@ -150,7 +150,7 @@ func parseLDAPConfig(form auth.AuthenticationForm) *models.LDAPConfig { } } -func parseSMTPConfig(form auth.AuthenticationForm) *models.SMTPConfig { +func parseSMTPConfig(form forms.AuthenticationForm) *models.SMTPConfig { return &models.SMTPConfig{ Auth: form.SMTPAuth, Host: form.SMTPHost, @@ -161,7 +161,7 @@ func parseSMTPConfig(form auth.AuthenticationForm) *models.SMTPConfig { } } -func parseOAuth2Config(form auth.AuthenticationForm) *models.OAuth2Config { +func parseOAuth2Config(form forms.AuthenticationForm) *models.OAuth2Config { var customURLMapping *oauth2.CustomURLMapping if form.Oauth2UseCustomURL { customURLMapping = &oauth2.CustomURLMapping{ @@ -183,7 +183,7 @@ func parseOAuth2Config(form auth.AuthenticationForm) *models.OAuth2Config { } } -func parseSSPIConfig(ctx *context.Context, form auth.AuthenticationForm) (*models.SSPIConfig, error) { +func parseSSPIConfig(ctx *context.Context, form forms.AuthenticationForm) (*models.SSPIConfig, error) { if util.IsEmptyString(form.SSPISeparatorReplacement) { ctx.Data["Err_SSPISeparatorReplacement"] = true return nil, errors.New(ctx.Tr("form.SSPISeparatorReplacement") + ctx.Tr("form.require_error")) @@ -209,7 +209,7 @@ func parseSSPIConfig(ctx *context.Context, form auth.AuthenticationForm) (*model // NewAuthSourcePost response for adding an auth source func NewAuthSourcePost(ctx *context.Context) { - form := *web.GetForm(ctx).(*auth.AuthenticationForm) + form := *web.GetForm(ctx).(*forms.AuthenticationForm) ctx.Data["Title"] = ctx.Tr("admin.auths.new") ctx.Data["PageIsAdmin"] = true ctx.Data["PageIsAdminAuthentications"] = true @@ -316,7 +316,7 @@ func EditAuthSource(ctx *context.Context) { // EditAuthSourcePost response for editing auth source func EditAuthSourcePost(ctx *context.Context) { - form := *web.GetForm(ctx).(*auth.AuthenticationForm) + form := *web.GetForm(ctx).(*forms.AuthenticationForm) ctx.Data["Title"] = ctx.Tr("admin.auths.edit") ctx.Data["PageIsAdmin"] = true ctx.Data["PageIsAdminAuthentications"] = true diff --git a/routers/admin/users.go b/routers/admin/users.go index 13609ac746..3b29eeefc1 100644 --- a/routers/admin/users.go +++ b/routers/admin/users.go @@ -14,13 +14,13 @@ import ( "code.gitea.io/gitea/models" "code.gitea.io/gitea/modules/base" "code.gitea.io/gitea/modules/context" - auth "code.gitea.io/gitea/modules/forms" "code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/password" "code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/web" "code.gitea.io/gitea/routers" router_user_setting "code.gitea.io/gitea/routers/user/setting" + "code.gitea.io/gitea/services/forms" "code.gitea.io/gitea/services/mailer" ) @@ -66,7 +66,7 @@ func NewUser(ctx *context.Context) { // NewUserPost response for adding a new user func NewUserPost(ctx *context.Context) { - form := web.GetForm(ctx).(*auth.AdminCreateUserForm) + form := web.GetForm(ctx).(*forms.AdminCreateUserForm) ctx.Data["Title"] = ctx.Tr("admin.users.new_account") ctx.Data["PageIsAdmin"] = true ctx.Data["PageIsAdminUsers"] = true @@ -218,7 +218,7 @@ func EditUser(ctx *context.Context) { // EditUserPost response for editting user func EditUserPost(ctx *context.Context) { - form := web.GetForm(ctx).(*auth.AdminEditUserForm) + form := web.GetForm(ctx).(*forms.AdminEditUserForm) ctx.Data["Title"] = ctx.Tr("admin.users.edit_account") ctx.Data["PageIsAdmin"] = true ctx.Data["PageIsAdminUsers"] = true diff --git a/routers/admin/users_test.go b/routers/admin/users_test.go index bd00bb2bf1..b19dcb886b 100644 --- a/routers/admin/users_test.go +++ b/routers/admin/users_test.go @@ -8,9 +8,9 @@ import ( "testing" "code.gitea.io/gitea/models" - auth "code.gitea.io/gitea/modules/forms" "code.gitea.io/gitea/modules/test" "code.gitea.io/gitea/modules/web" + "code.gitea.io/gitea/services/forms" "github.com/stretchr/testify/assert" ) @@ -30,7 +30,7 @@ func TestNewUserPost_MustChangePassword(t *testing.T) { username := "gitea" email := "gitea@gitea.io" - form := auth.AdminCreateUserForm{ + form := forms.AdminCreateUserForm{ LoginType: "local", LoginName: "local", UserName: username, @@ -68,7 +68,7 @@ func TestNewUserPost_MustChangePasswordFalse(t *testing.T) { username := "gitea" email := "gitea@gitea.io" - form := auth.AdminCreateUserForm{ + form := forms.AdminCreateUserForm{ LoginType: "local", LoginName: "local", UserName: username, @@ -106,7 +106,7 @@ func TestNewUserPost_InvalidEmail(t *testing.T) { username := "gitea" email := "gitea@gitea.io\r\n" - form := auth.AdminCreateUserForm{ + form := forms.AdminCreateUserForm{ LoginType: "local", LoginName: "local", UserName: username, |