diff --git a/models/login_source.go b/models/login_source.go index 54ddd6826988b..bced2bcee3f0c 100644 --- a/models/login_source.go +++ b/models/login_source.go @@ -417,10 +417,7 @@ func LoginViaLDAP(user *User, login, password string, source *LoginSource, autoR if len(source.LDAP().AdminFilter) > 0 { user.IsAdmin = sr.IsAdmin } - if err := UpdateUserCols(user, "full_name", "email", "is_admin"); err != nil { - return nil, err - } - + go UpdateLdapUserAtLogin(user) } if !autoRegister { diff --git a/models/user.go b/models/user.go index 7aa1e143e835b..fddd3109ced1a 100644 --- a/models/user.go +++ b/models/user.go @@ -1827,3 +1827,10 @@ func SyncExternalUsers() { } } } + +func UpdateLdapUserAtLogin(user *User) (err error) { + if err := UpdateUserCols(user, "full_name", "email", "is_admin"); err != nil { + return err + } + return nil +}