aboutsummaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorjuju2013 <cahterinedesienne@gmail.com>2014-04-22 18:55:27 +0200
committerjuju2013 <catherinedesienne@gmail.com>2014-04-23 23:07:54 +0200
commitefc05ea1dec5a60c95763fc5158d60b45ef46d8f (patch)
treec50ebba5664215d010835bbbd7234c0fa50a87d7 /routers
parentdbdaf934e1b8fab06361266268bb55d30b352f37 (diff)
downloadgitea-efc05ea1dec5a60c95763fc5158d60b45ef46d8f.tar.gz
gitea-efc05ea1dec5a60c95763fc5158d60b45ef46d8f.zip
initial support for LDAP authentication/MSAD
Diffstat (limited to 'routers')
-rw-r--r--routers/user/user.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/routers/user/user.go b/routers/user/user.go
index 7decd72d4e..75314237dd 100644
--- a/routers/user/user.go
+++ b/routers/user/user.go
@@ -89,7 +89,16 @@ func SignInPost(ctx *middleware.Context, form auth.LogInForm) {
return
}
- user, err := models.LoginUserPlain(form.UserName, form.Password)
+ var user *models.User
+ var err error
+ // try to login against LDAP if defined
+ if base.LdapAuth {
+ user, err = models.LoginUserLdap(form.UserName, form.Password)
+ }
+ // try local if not LDAP or it's failed
+ if (!base.LdapAuth) || (err != nil) {
+ user, err = models.LoginUserPlain(form.UserName, form.Password)
+ }
if err != nil {
if err == models.ErrUserNotExist {
log.Trace("%s Log in failed: %s/%s", ctx.Req.RequestURI, form.UserName, form.Password)