diff options
author | Unknwon <u@gogs.io> | 2015-09-06 11:25:08 -0400 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2015-09-06 11:25:08 -0400 |
commit | 00767a0522606cd504d81d35fa1d9e9c1e34610c (patch) | |
tree | b3c02f128bd529e7f9b09ae8ffda2d9f51540094 /routers/org | |
parent | 4dbc32285925db0609dd6c2fc97808a63d8af08c (diff) | |
download | gitea-00767a0522606cd504d81d35fa1d9e9c1e34610c.tar.gz gitea-00767a0522606cd504d81d35fa1d9e9c1e34610c.zip |
finish new org settings page
Diffstat (limited to 'routers/org')
-rw-r--r-- | routers/org/setting.go | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/routers/org/setting.go b/routers/org/setting.go index c36bafee8c..c6d2db3d97 100644 --- a/routers/org/setting.go +++ b/routers/org/setting.go @@ -70,7 +70,7 @@ func SettingsPost(ctx *middleware.Context, form auth.UpdateOrgSettingForm) { } log.Trace("Organization setting updated: %s", org.Name) ctx.Flash.Success(ctx.Tr("org.settings.update_setting_success")) - ctx.Redirect(setting.AppSubUrl + "/org/" + org.Name + "/settings") + ctx.Redirect(org.HomeLink() + "/settings") } func SettingsDelete(ctx *middleware.Context) { @@ -79,11 +79,19 @@ func SettingsDelete(ctx *middleware.Context) { org := ctx.Org.Organization if ctx.Req.Method == "POST" { - // FIXME: validate password. + if _, err := models.UserSignIn(ctx.User.Name, ctx.Query("password")); err != nil { + if models.IsErrUserNotExist(err) { + ctx.RenderWithErr(ctx.Tr("form.enterred_invalid_password"), SETTINGS_DELETE, nil) + } else { + ctx.Handle(500, "UserSignIn", err) + } + return + } + if err := models.DeleteOrganization(org); err != nil { if models.IsErrUserOwnRepos(err) { ctx.Flash.Error(ctx.Tr("form.org_still_own_repo")) - ctx.Redirect(setting.AppSubUrl + "/org/" + org.LowerName + "/settings/delete") + ctx.Redirect(org.HomeLink() + "/settings/delete") } else { ctx.Handle(500, "DeleteOrganization", err) } |