|
@@ -292,8 +292,8 @@ func composeFullName(firstname, surname, username string) string {
|
|
|
|
|
|
// LoginViaLDAP queries if login/password is valid against the LDAP directory pool,
|
|
// LoginViaLDAP queries if login/password is valid against the LDAP directory pool,
|
|
// and create a local user if success when enabled.
|
|
// and create a local user if success when enabled.
|
|
-func LoginViaLDAP(user *User, login, passowrd string, source *LoginSource, autoRegister bool) (*User, error) {
|
|
|
|
- username, fn, sn, mail, isAdmin, succeed := source.Cfg.(*LDAPConfig).SearchEntry(login, passowrd, source.Type == LOGIN_DLDAP)
|
|
|
|
|
|
+func LoginViaLDAP(user *User, login, password string, source *LoginSource, autoRegister bool) (*User, error) {
|
|
|
|
+ username, fn, sn, mail, isAdmin, succeed := source.Cfg.(*LDAPConfig).SearchEntry(login, password, source.Type == LOGIN_DLDAP)
|
|
if !succeed {
|
|
if !succeed {
|
|
// User not in LDAP, do nothing
|
|
// User not in LDAP, do nothing
|
|
return nil, ErrUserNotExist{0, login}
|
|
return nil, ErrUserNotExist{0, login}
|
|
@@ -505,7 +505,7 @@ func ExternalUserLogin(user *User, login, password string, source *LoginSource,
|
|
}
|
|
}
|
|
|
|
|
|
// UserSignIn validates user name and password.
|
|
// UserSignIn validates user name and password.
|
|
-func UserSignIn(username, passowrd string) (*User, error) {
|
|
|
|
|
|
+func UserSignIn(username, password string) (*User, error) {
|
|
var user *User
|
|
var user *User
|
|
if strings.Contains(username, "@") {
|
|
if strings.Contains(username, "@") {
|
|
user = &User{Email: strings.ToLower(username)}
|
|
user = &User{Email: strings.ToLower(username)}
|
|
@@ -521,7 +521,7 @@ func UserSignIn(username, passowrd string) (*User, error) {
|
|
if hasUser {
|
|
if hasUser {
|
|
switch user.LoginType {
|
|
switch user.LoginType {
|
|
case LOGIN_NOTYPE, LOGIN_PLAIN:
|
|
case LOGIN_NOTYPE, LOGIN_PLAIN:
|
|
- if user.ValidatePassword(passowrd) {
|
|
|
|
|
|
+ if user.ValidatePassword(password) {
|
|
return user, nil
|
|
return user, nil
|
|
}
|
|
}
|
|
|
|
|
|
@@ -536,7 +536,7 @@ func UserSignIn(username, passowrd string) (*User, error) {
|
|
return nil, ErrLoginSourceNotExist{user.LoginSource}
|
|
return nil, ErrLoginSourceNotExist{user.LoginSource}
|
|
}
|
|
}
|
|
|
|
|
|
- return ExternalUserLogin(user, user.LoginName, passowrd, &source, false)
|
|
|
|
|
|
+ return ExternalUserLogin(user, user.LoginName, password, &source, false)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -546,7 +546,7 @@ func UserSignIn(username, passowrd string) (*User, error) {
|
|
}
|
|
}
|
|
|
|
|
|
for _, source := range sources {
|
|
for _, source := range sources {
|
|
- authUser, err := ExternalUserLogin(nil, username, passowrd, source, true)
|
|
|
|
|
|
+ authUser, err := ExternalUserLogin(nil, username, password, source, true)
|
|
if err == nil {
|
|
if err == nil {
|
|
return authUser, nil
|
|
return authUser, nil
|
|
}
|
|
}
|