diff --git a/routers/web/repo/setting/setting.go b/routers/web/repo/setting/setting.go index 624ae89b9c..524eebb64d 100644 --- a/routers/web/repo/setting/setting.go +++ b/routers/web/repo/setting/setting.go @@ -193,10 +193,12 @@ func SettingsPost(ctx *context.Context) { } // ToDo: Use Federated Repo Struct & Update Federated Repo Table + // TODO: move as much functions to some kind of service in order to keep controller clean an simple switch { // Allow clearing the field case form.FederationRepos == "": repo.FederationRepos = "" + // Validate case !validation.IsOfValidLength(form.FederationRepos): // ToDo: Use for public testing only. In production we might need longer strings. ctx.Data["ERR_FederationRepos"] = true @@ -204,6 +206,7 @@ func SettingsPost(ctx *context.Context) { ctx.Redirect(repo.Link() + "/settings") return case validation.IsValidFederatedRepoURL(form.FederationRepos): + // TODO: Move this validation to Domain!! repo.FederationRepos = form.FederationRepos default: ctx.Data["ERR_FederationRepos"] = true