diff options
author | Paweł Bogusławski <pawel.boguslawski@ib.pl> | 2021-03-01 15:33:05 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-01 16:33:05 +0200 |
commit | 85e6e07346fd408451d69f6ecc3d06c2b46bbb25 (patch) | |
tree | bf2d6eebb0e4613b8aa692da30c8793e5214e266 /routers | |
parent | 6cf97df9fd6aba59104dba41a2eabd64542f68b9 (diff) | |
download | gitea-85e6e07346fd408451d69f6ecc3d06c2b46bbb25.tar.gz gitea-85e6e07346fd408451d69f6ecc3d06c2b46bbb25.zip |
Organization removal confirmation using name not password (#14738)
* Organization removal confirmation using name not password
Gitea is asking for user password to confirm organization
removal so this operation cannot be done in systems with
SSO authentication (where no user passwords are used).
This mod changes the way gitea confirms organization
removal - user must enter organization name (not user
password) to confirm operation (similar to repository
removal confirmation).
Author-Change-Id: IB#1107219
* Translation removed
Translation removed from PR - will be restored using Crowdin
after pull got merged.
Fixes: 95ddcdd8bd8097a952894556d42641d5ec269288
Related: https://github.com/go-gitea/gitea/pull/14738
Author-Change-Id: IB#1107219
Diffstat (limited to 'routers')
-rw-r--r-- | routers/org/setting.go | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/routers/org/setting.go b/routers/org/setting.go index ac12066258..a01b2c862a 100644 --- a/routers/org/setting.go +++ b/routers/org/setting.go @@ -145,12 +145,9 @@ func SettingsDelete(ctx *context.Context) { org := ctx.Org.Organization if ctx.Req.Method == "POST" { - if _, err := models.UserSignIn(ctx.User.Name, ctx.Query("password")); err != nil { - if models.IsErrUserNotExist(err) { - ctx.RenderWithErr(ctx.Tr("form.enterred_invalid_password"), tplSettingsDelete, nil) - } else { - ctx.ServerError("UserSignIn", err) - } + if org.Name != ctx.Query("org_name") { + ctx.Data["Err_OrgName"] = true + ctx.RenderWithErr(ctx.Tr("form.enterred_invalid_org_name"), tplSettingsDelete, nil) return } |