mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
MM-29107: Fix race in LDAP login (#16239)
* MM-29107: Fix race in LDAP login We remove the goroutine to make things synchronous. This removes the race and makes things more reliable. It is already tested by TestLogin in ldap_test.go in -race mode. https://mattermost.atlassian.net/browse/MM-29107 ```release-note NONE ``` * Address review comments Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
This commit is contained in:
@@ -217,8 +217,10 @@ func (a *App) DoLogin(w http.ResponseWriter, r *http.Request, user *model.User,
|
||||
a.SetSession(session)
|
||||
|
||||
if a.Srv().License() != nil && *a.Srv().License().Features.LDAP && a.Ldap() != nil {
|
||||
userVal := *user
|
||||
sessionVal := *session
|
||||
a.Srv().Go(func() {
|
||||
a.Ldap().UpdateProfilePictureIfNecessary(*user, session)
|
||||
a.Ldap().UpdateProfilePictureIfNecessary(userVal, sessionVal)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,6 @@ type LdapInterface interface {
|
||||
GetGroup(groupUID string) (*model.Group, *model.AppError)
|
||||
GetAllGroupsPage(page int, perPage int, opts model.LdapGroupSearchOpts) ([]*model.Group, int, *model.AppError)
|
||||
FirstLoginSync(user *model.User, userAuthService, userAuthData, email string) *model.AppError
|
||||
UpdateProfilePictureIfNecessary(model.User, *model.Session)
|
||||
UpdateProfilePictureIfNecessary(model.User, model.Session)
|
||||
GetADLdapIdFromSAMLId(authData string) string
|
||||
}
|
||||
|
||||
@@ -305,6 +305,6 @@ func (_m *LdapInterface) SwitchToLdap(userId string, ldapId string, ldapPassword
|
||||
}
|
||||
|
||||
// UpdateProfilePictureIfNecessary provides a mock function with given fields: _a0, _a1
|
||||
func (_m *LdapInterface) UpdateProfilePictureIfNecessary(_a0 model.User, _a1 *model.Session) {
|
||||
func (_m *LdapInterface) UpdateProfilePictureIfNecessary(_a0 model.User, _a1 model.Session) {
|
||||
_m.Called(_a0, _a1)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user