This commit is contained in:
Unknwon 2015-11-23 20:43:04 -05:00
parent ffbeda077c
commit ec8d41765d
3 changed files with 5 additions and 5 deletions

View file

@ -6,7 +6,7 @@ github.com/bradfitz/gomemcache = commit:72a68649ba
github.com/codegangsta/cli = commit:0302d39 github.com/codegangsta/cli = commit:0302d39
github.com/go-macaron/binding = commit:864a5ce github.com/go-macaron/binding = commit:864a5ce
github.com/go-macaron/cache = commit:5617353 github.com/go-macaron/cache = commit:5617353
github.com/go-macaron/captcha = commit:875ff77 github.com/go-macaron/captcha =
github.com/go-macaron/csrf = commit:3372b25 github.com/go-macaron/csrf = commit:3372b25
github.com/go-macaron/gzip = commit:4938e9b github.com/go-macaron/gzip = commit:4938e9b
github.com/go-macaron/i18n = commit:5e728b6 github.com/go-macaron/i18n = commit:5e728b6

View file

@ -410,7 +410,7 @@ func LoginUserPAMSource(u *User, name, passwd string, sourceId int64, cfg *PAMCo
// fake a local user creation // fake a local user creation
u = &User{ u = &User{
LowerName: strings.ToLower(name), LowerName: strings.ToLower(name),
Name: strings.ToLower(name), Name: name,
LoginType: PAM, LoginType: PAM,
LoginSource: sourceId, LoginSource: sourceId,
LoginName: name, LoginName: name,
@ -418,8 +418,7 @@ func LoginUserPAMSource(u *User, name, passwd string, sourceId int64, cfg *PAMCo
Passwd: passwd, Passwd: passwd,
Email: name, Email: name,
} }
err := CreateUser(u) return u, CreateUser(u)
return u, err
} }
func ExternalUserLogin(u *User, name, passwd string, source *LoginSource, autoRegister bool) (*User, error) { func ExternalUserLogin(u *User, name, passwd string, source *LoginSource, autoRegister bool) (*User, error) {
@ -443,7 +442,7 @@ func ExternalUserLogin(u *User, name, passwd string, source *LoginSource, autoRe
func UserSignIn(uname, passwd string) (*User, error) { func UserSignIn(uname, passwd string) (*User, error) {
var u *User var u *User
if strings.Contains(uname, "@") { if strings.Contains(uname, "@") {
u = &User{Email: uname} u = &User{Email: strings.ToLower(uname)}
} else { } else {
u = &User{LowerName: strings.ToLower(uname)} u = &User{LowerName: strings.ToLower(uname)}
} }

View file

@ -433,6 +433,7 @@ func CreateUser(u *User) (err error) {
return ErrUserAlreadyExist{u.Name} return ErrUserAlreadyExist{u.Name}
} }
u.Email = strings.ToLower(u.Email)
isExist, err = IsEmailUsed(u.Email) isExist, err = IsEmailUsed(u.Email)
if err != nil { if err != nil {
return err return err