diff --git a/routers/org/setting.go b/routers/org/setting.go index c36bafee8..c6d2db3d9 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 000000000..6e9e256cb --- /dev/null +++ b/templates/base/delete_modal_actions.tmpl @@ -0,0 +1,10 @@ +
+
+ + {{.i18n.Tr "modal.no"}} +
+
+ + {{.i18n.Tr "modal.yes"}} +
+
\ No newline at end of file diff --git a/templates/org/settings/delete.tmpl b/templates/org/settings/delete.tmpl index a929fabfe..707d6f88b 100644 --- a/templates/org/settings/delete.tmpl +++ b/templates/org/settings/delete.tmpl @@ -1,36 +1,43 @@ -{{template "ng/base/head" .}} -{{template "ng/base/header" .}} -{{template "org/base/header" .}} -
-
- {{template "org/settings/nav" .}} -
-
- {{template "ng/base/alert" .}} -
-
-

{{.i18n.Tr "org.settings.delete_account"}}

-
- {{.i18n.Tr "org.settings.delete_prompt" | Str2html}} -
- {{.CsrfTokenHtml}} -

- - -

-
-
-

{{.i18n.Tr "org.settings.delete_org_title"}}

-

{{.i18n.Tr "org.settings.delete_org_desc"}}

-
- - -
-
-
-
+{{template "base/head" .}} +
+ {{template "org/header" .}} +
+
+ {{template "org/settings/navbar" .}} +
+ {{template "base/alert" .}} +

+ {{.i18n.Tr "org.settings.delete_account"}} +

+
+
+

{{.i18n.Tr "org.settings.delete_prompt" | Str2html}}

+
+
+ {{.CsrfTokenHtml}} + +
+ +
+
+ {{.i18n.Tr "org.settings.confirm_delete_account"}} +
+
+
+
-{{template "ng/base/footer" .}} \ No newline at end of file + + +{{template "base/footer" .}} \ No newline at end of file diff --git a/templates/org/settings/nav.tmpl b/templates/org/settings/nav.tmpl deleted file mode 100644 index 28af4d29a..000000000 --- a/templates/org/settings/nav.tmpl +++ /dev/null @@ -1,12 +0,0 @@ - diff --git a/templates/user/settings/delete.tmpl b/templates/user/settings/delete.tmpl index d9a0837b5..6b490ad29 100644 --- a/templates/user/settings/delete.tmpl +++ b/templates/user/settings/delete.tmpl @@ -1,5 +1,5 @@ {{template "base/head" .}} -
+
{{template "user/settings/navbar" .}} @@ -10,7 +10,7 @@
-

{{.i18n.Tr "settings.delete_prompt" | Str2html}}

+

{{.i18n.Tr "settings.delete_prompt" | Str2html}}

{{.CsrfTokenHtml}} @@ -37,15 +37,6 @@

{{.i18n.Tr "settings.delete_account_desc"}}

-
-
- - {{.i18n.Tr "modal.no"}} -
-
- - {{.i18n.Tr "modal.yes"}} -
-
+ {{template "base/delete_modal_actions" .}}
{{template "base/footer" .}} \ No newline at end of file