Browse Source

Change basic authentication to use the models/login.go UserSignIn, to permit checkout using non-local users

pull/909/head
Karl Southern 10 years ago
parent
commit
b6cb5f0283
  1. 7
      modules/auth/auth.go

7
modules/auth/auth.go

@ -108,19 +108,14 @@ 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)
}
return nil, false
}
if u.ValidtePassword(passwd) {
return u, true
}
}
}
return nil, false
}

Loading…
Cancel
Save