mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-27 00:32:14 +01:00
Fix auth issue on #80
This commit is contained in:
parent
6277f8497c
commit
2dc0329c5f
1 changed files with 19 additions and 17 deletions
|
@ -58,7 +58,8 @@ func Http(ctx *middleware.Context, params martini.Params) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// only public pull don't need auth
|
// only public pull don't need auth
|
||||||
var askAuth = !(!repo.IsPrivate && isPull) || base.Service.RequireSignInView
|
isPublicPull := !repo.IsPrivate && isPull
|
||||||
|
var askAuth = !isPublicPull || base.Service.RequireSignInView
|
||||||
|
|
||||||
var authUser *models.User
|
var authUser *models.User
|
||||||
|
|
||||||
|
@ -91,13 +92,13 @@ func Http(ctx *middleware.Context, params martini.Params) {
|
||||||
}
|
}
|
||||||
|
|
||||||
newUser := &models.User{Passwd: passwd, Salt: authUser.Salt}
|
newUser := &models.User{Passwd: passwd, Salt: authUser.Salt}
|
||||||
|
|
||||||
newUser.EncodePasswd()
|
newUser.EncodePasswd()
|
||||||
if authUser.Passwd != newUser.Passwd {
|
if authUser.Passwd != newUser.Passwd {
|
||||||
ctx.Handle(401, "no basic auth and digit auth", nil)
|
ctx.Handle(401, "no basic auth and digit auth", nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !isPublicPull {
|
||||||
var tp = models.AU_WRITABLE
|
var tp = models.AU_WRITABLE
|
||||||
if isPull {
|
if isPull {
|
||||||
tp = models.AU_READABLE
|
tp = models.AU_READABLE
|
||||||
|
@ -120,6 +121,7 @@ func Http(ctx *middleware.Context, params martini.Params) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
config := Config{base.RepoRootPath, "git", true, true, func(rpc string, input []byte) {
|
config := Config{base.RepoRootPath, "git", true, true, func(rpc string, input []byte) {
|
||||||
if rpc == "receive-pack" {
|
if rpc == "receive-pack" {
|
||||||
|
|
Loading…
Reference in a new issue