diff options
author | Unknwon <u@gogs.io> | 2015-04-24 05:21:10 -0400 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2015-04-24 05:21:10 -0400 |
commit | c08baee0855807d24a1b86adfcea86d0731e2a3a (patch) | |
tree | c033d0fd4a4c4104b0b6304ec9f2a26c6047ce10 /routers | |
parent | 7a7c096fd09035f759168800402389457648f47e (diff) | |
parent | f92bdf875b4ccb2a8eadaa571d112ebf653986d6 (diff) |
Merge branch 'develop' of github.com:gogits/gogs into develop
Diffstat (limited to 'routers')
-rw-r--r-- | routers/admin/auths.go | 8 | ||||
-rw-r--r-- | routers/api/v1/repo.go | 2 | ||||
-rw-r--r-- | routers/repo/http.go | 14 |
3 files changed, 16 insertions, 8 deletions
diff --git a/routers/admin/auths.go b/routers/admin/auths.go index b13b0bd1..2bec7da4 100644 --- a/routers/admin/auths.go +++ b/routers/admin/auths.go @@ -84,6 +84,10 @@ func NewAuthSourcePost(ctx *middleware.Context, form auth.AuthenticationForm) { Port: form.SMTPPort, TLS: form.TLS, } + case models.PAM: + u = &models.PAMConfig{ + ServiceName: form.PAMServiceName, + } default: ctx.Error(400) return @@ -166,6 +170,10 @@ func EditAuthSourcePost(ctx *middleware.Context, form auth.AuthenticationForm) { Port: form.SMTPPort, TLS: form.TLS, } + case models.PAM: + config = &models.PAMConfig{ + ServiceName: form.PAMServiceName, + } default: ctx.Error(400) return diff --git a/routers/api/v1/repo.go b/routers/api/v1/repo.go index 170c2e90..7da5f817 100644 --- a/routers/api/v1/repo.go +++ b/routers/api/v1/repo.go @@ -164,7 +164,7 @@ func MigrateRepo(ctx *middleware.Context, form auth.MigrateRepoForm) { } return } - if !u.ValidtePassword(ctx.Query("password")) { + if !u.ValidatePassword(ctx.Query("password")) { ctx.HandleAPI(422, "Username or password is not correct.") return } diff --git a/routers/repo/http.go b/routers/repo/http.go index 9165128a..8395d1c0 100644 --- a/routers/repo/http.go +++ b/routers/repo/http.go @@ -96,12 +96,12 @@ func Http(ctx *middleware.Context) { // FIXME: middlewares/context.go did basic auth check already, // maybe could use that one. if len(auths) != 2 || auths[0] != "Basic" { - ctx.Handle(401, "no basic auth and digit auth", nil) + ctx.HandleText(401, "no basic auth and digit auth") return } authUsername, authPasswd, err = base.BasicAuthDecode(auths[1]) if err != nil { - ctx.Handle(401, "no basic auth and digit auth", nil) + ctx.HandleText(401, "no basic auth and digit auth") return } @@ -116,7 +116,7 @@ func Http(ctx *middleware.Context) { token, err := models.GetAccessTokenBySha(authUsername) if err != nil { if err == models.ErrAccessTokenNotExist { - ctx.Handle(401, "invalid token", nil) + ctx.HandleText(401, "invalid token") } else { ctx.Handle(500, "GetAccessTokenBySha", err) } @@ -138,23 +138,23 @@ func Http(ctx *middleware.Context) { has, err := models.HasAccess(authUser, repo, tp) if err != nil { - ctx.Handle(401, "no basic auth and digit auth", nil) + ctx.HandleText(401, "no basic auth and digit auth") return } else if !has { if tp == models.ACCESS_MODE_READ { has, err = models.HasAccess(authUser, repo, models.ACCESS_MODE_WRITE) if err != nil || !has { - ctx.Handle(401, "no basic auth and digit auth", nil) + ctx.HandleText(401, "no basic auth and digit auth") return } } else { - ctx.Handle(401, "no basic auth and digit auth", nil) + ctx.HandleText(401, "no basic auth and digit auth") return } } if !isPull && repo.IsMirror { - ctx.Handle(401, "can't push to mirror", nil) + ctx.HandleText(401, "can't push to mirror") return } } |