From bb3b90fcd640f8b80c70a87ec110acba3d3d9c68 Mon Sep 17 00:00:00 2001 From: Unknwon Date: Fri, 28 Aug 2015 18:33:09 +0800 Subject: #1487 Readme Template --- modules/auth/auth.go | 6 ++++++ modules/auth/repo_form.go | 21 ++++++++++----------- 2 files changed, 16 insertions(+), 11 deletions(-) (limited to 'modules/auth') diff --git a/modules/auth/auth.go b/modules/auth/auth.go index 825bbd3c9c..71cb2bb28b 100644 --- a/modules/auth/auth.go +++ b/modules/auth/auth.go @@ -194,6 +194,12 @@ func GetMaxSize(field reflect.StructField) string { return getSize(field, "MaxSize(") } +// FIXME: struct contains a struct +func validateStruct(obj interface{}) binding.Errors { + + return nil +} + func validate(errs binding.Errors, data map[string]interface{}, f Form, l macaron.Locale) binding.Errors { if errs.Len() == 0 { return errs diff --git a/modules/auth/repo_form.go b/modules/auth/repo_form.go index bdfa412c03..748bfa6111 100644 --- a/modules/auth/repo_form.go +++ b/modules/auth/repo_form.go @@ -16,19 +16,15 @@ import ( // |____|_ /_______ / |____| \_______ /_______ /|___| |____| \_______ /____|_ // ______| // \/ \/ \/ \/ \/ \/ \/ -type RepoForm struct { +type CreateRepoForm struct { Uid int64 `binding:"Required"` RepoName string `binding:"Required;AlphaDashDot;MaxSize(100)"` Private bool Description string `binding:"MaxSize(255)"` -} - -type CreateRepoForm struct { - RepoForm - AutoInit bool - Gitignores string - License string - Readme string + AutoInit bool + Gitignores string + License string + Readme string } func (f *CreateRepoForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors { @@ -39,8 +35,11 @@ type MigrateRepoForm struct { CloneAddr string `binding:"Required"` AuthUsername string AuthPassword string - RepoForm - Mirror bool + Mirror bool + Uid int64 `binding:"Required"` + RepoName string `binding:"Required;AlphaDashDot;MaxSize(100)"` + Private bool + Description string `binding:"MaxSize(255)"` } func (f *MigrateRepoForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors { -- cgit v1.2.3