From f4486f3eec1856559f52291c283fe076352fccfe Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Thu, 15 May 2014 22:34:36 +0800 Subject: [PATCH] bug fixed #193 --- models/login.go | 10 +++++++--- routers/admin/auths.go | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/models/login.go b/models/login.go index be185488..aa82eb00 100644 --- a/models/login.go +++ b/models/login.go @@ -16,6 +16,7 @@ import ( "github.com/go-xorm/xorm" "github.com/gogits/gogs/modules/auth/ldap" + "github.com/gogits/gogs/modules/log" ) // Login types. @@ -194,14 +195,17 @@ func LoginUser(uname, passwd string) (*User, error) { u, err := LoginUserLdapSource(nil, uname, passwd, source.Id, source.Cfg.(*LDAPConfig), true) if err == nil { - return u, err + return u, nil + } else { + log.Warn("try ldap login", source.Name, "by", uname, "error:", err) } } else if source.Type == LT_SMTP { u, err := LoginUserSMTPSource(nil, uname, passwd, source.Id, source.Cfg.(*SMTPConfig), true) - if err == nil { - return u, err + return u, nil + } else { + log.Warn("try smtp login", source.Name, "by", uname, "error:", err) } } } diff --git a/routers/admin/auths.go b/routers/admin/auths.go index b7b382cd..bf4bade1 100644 --- a/routers/admin/auths.go +++ b/routers/admin/auths.go @@ -144,6 +144,7 @@ func EditAuthSourcePost(ctx *middleware.Context, form auth.AuthenticationForm) { } u := models.LoginSource{ + Id: form.Id, Name: form.AuthName, IsActived: form.IsActived, Type: form.Type,