mirror of
https://github.com/h44z/wg-portal.git
synced 2026-03-03 06:46:23 +00:00
fix: ldap user creation when login in (#631)
Signed-off-by: Gwilherm Folliot <fl0w@3l0w.fr>
This commit is contained in:
@@ -351,7 +351,6 @@ func (a *Authenticator) passwordAuthentication(
|
|||||||
domain.SystemAdminContextUserInfo()) // switch to admin user context to check if user exists
|
domain.SystemAdminContextUserInfo()) // switch to admin user context to check if user exists
|
||||||
|
|
||||||
var ldapUserInfo *domain.AuthenticatorUserInfo
|
var ldapUserInfo *domain.AuthenticatorUserInfo
|
||||||
var ldapProvider AuthenticatorLdap
|
|
||||||
|
|
||||||
var userInDatabase = false
|
var userInDatabase = false
|
||||||
existingUser, err := a.users.GetUser(ctx, identifier)
|
existingUser, err := a.users.GetUser(ctx, identifier)
|
||||||
@@ -417,14 +416,14 @@ func (a *Authenticator) passwordAuthentication(
|
|||||||
"source", ldapAuth.GetName(), "identifier", identifier, "error", err)
|
"source", ldapAuth.GetName(), "identifier", identifier, "error", err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
user, err := a.processUserInfo(ctx, ldapUserInfo, domain.UserSourceLdap, ldapProvider.GetName(), true)
|
user, err := a.processUserInfo(ctx, ldapUserInfo, domain.UserSourceLdap, ldapAuth.GetName(), true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("unable to process user information: %w", err)
|
return nil, fmt.Errorf("unable to process user information: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
existingUser = user
|
existingUser = user
|
||||||
slog.Debug("created new LDAP user in db",
|
slog.Debug("created new LDAP user in db",
|
||||||
"identifier", user.Identifier, "provider", ldapProvider.GetName())
|
"identifier", user.Identifier, "provider", ldapAuth.GetName())
|
||||||
|
|
||||||
authOK = true
|
authOK = true
|
||||||
break
|
break
|
||||||
|
|||||||
Reference in New Issue
Block a user