summaryrefslogtreecommitdiffstats
path: root/routers/repo/setting.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-03-05 19:20:27 -0500
committerUnknwon <u@gogs.io>2015-03-05 19:20:27 -0500
commit18c06973292a3d20b8ad72575c819fbe3287a9ad (patch)
treeaee9bcfd564a76fb2b81951d7725e9847e53f8f1 /routers/repo/setting.go
parente3d73d9b244174def7c5c73289c2c141fe6f652a (diff)
downloadgitea-18c06973292a3d20b8ad72575c819fbe3287a9ad.tar.gz
gitea-18c06973292a3d20b8ad72575c819fbe3287a9ad.zip
routers/repo/setting.go: fix LDAP cannot validate password #1006
Diffstat (limited to 'routers/repo/setting.go')
-rw-r--r--routers/repo/setting.go28
1 files changed, 18 insertions, 10 deletions
diff --git a/routers/repo/setting.go b/routers/repo/setting.go
index 5cd39ada2c..5b9b672c04 100644
--- a/routers/repo/setting.go
+++ b/routers/repo/setting.go
@@ -111,10 +111,18 @@ func SettingsPost(ctx *middleware.Context, form auth.RepoSettingForm) {
} else if !isExist {
ctx.RenderWithErr(ctx.Tr("form.enterred_invalid_owner_name"), SETTINGS_OPTIONS, nil)
return
- } else if !ctx.User.ValidtePassword(ctx.Query("password")) {
- ctx.RenderWithErr(ctx.Tr("form.enterred_invalid_password"), SETTINGS_OPTIONS, nil)
+ }
+
+ if _, err = models.UserSignIn(ctx.User.Name, ctx.Query("password")); err != nil {
+ if err == models.ErrUserNotExist {
+ ctx.RenderWithErr(ctx.Tr("form.enterred_invalid_password"), SETTINGS_OPTIONS, nil)
+ } else {
+ ctx.Handle(500, "UserSignIn", err)
+ }
return
- } else if err = models.TransferOwnership(ctx.User, newOwner, ctx.Repo.Repository); err != nil {
+ }
+
+ if err = models.TransferOwnership(ctx.User, newOwner, ctx.Repo.Repository); err != nil {
if err == models.ErrRepoAlreadyExist {
ctx.RenderWithErr(ctx.Tr("repo.settings.new_owner_has_same_repo"), SETTINGS_OPTIONS, nil)
} else {
@@ -136,15 +144,15 @@ func SettingsPost(ctx *middleware.Context, form auth.RepoSettingForm) {
ctx.Error(404)
return
}
- if !ctx.User.ValidtePassword(ctx.Query("password")) {
- ctx.RenderWithErr(ctx.Tr("form.enterred_invalid_password"), SETTINGS_OPTIONS, nil)
- return
- }
- } else {
- if !ctx.Repo.Owner.ValidtePassword(ctx.Query("password")) {
+ }
+
+ if _, err := models.UserSignIn(ctx.User.Name, ctx.Query("password")); err != nil {
+ if err == models.ErrUserNotExist {
ctx.RenderWithErr(ctx.Tr("form.enterred_invalid_password"), SETTINGS_OPTIONS, nil)
- return
+ } else {
+ ctx.Handle(500, "UserSignIn", err)
}
+ return
}
if err := models.DeleteRepository(ctx.Repo.Owner.Id, ctx.Repo.Repository.Id, ctx.Repo.Owner.Name); err != nil {