From b6cb5f0283b08c65ba143a4272b7b6aee71e4002 Mon Sep 17 00:00:00 2001 From: Karl Southern Date: Thu, 5 Feb 2015 20:44:43 +0000 Subject: [PATCH] Change basic authentication to use the models/login.go UserSignIn, to permit checkout using non-local users --- modules/auth/auth.go | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/modules/auth/auth.go b/modules/auth/auth.go index ad7ce5b9a..2f9fa3f96 100644 --- a/modules/auth/auth.go +++ b/modules/auth/auth.go @@ -108,17 +108,12 @@ func SignedInUser(req *http.Request, sess session.Store) (*models.User, bool) { auths := strings.Fields(baHead) if len(auths) == 2 && auths[0] == "Basic" { uname, passwd, _ := base.BasicAuthDecode(auths[1]) - u, err := models.GetUserByName(uname) + u, err := models.UserSignIn(uname, passwd) if err != nil { - if err != models.ErrUserNotExist { - log.Error(4, "GetUserByName: %v", err) - } + log.Error(4, "GetUserByName: %v", err) return nil, false } - - if u.ValidtePassword(passwd) { - return u, true - } + return u, true } } return nil, false