{{.i18n.Tr "org.settings.delete_org_desc"}}
+{{.i18n.Tr "org.settings.delete_account"}}
-{{.i18n.Tr "org.settings.delete_org_title"}}
-{{.i18n.Tr "org.settings.delete_org_desc"}}
-- - -
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) } diff --git a/templates/base/delete_modal_actions.tmpl b/templates/base/delete_modal_actions.tmpl new file mode 100644 index 0000000000..6e9e256cb9 --- /dev/null +++ b/templates/base/delete_modal_actions.tmpl @@ -0,0 +1,10 @@ +
{{.i18n.Tr "org.settings.delete_account"}}
-{{.i18n.Tr "org.settings.delete_org_desc"}}
-{{.i18n.Tr "org.settings.delete_org_desc"}}
+