mirror of
https://github.com/mattermost/mattermost.git
synced 2026-09-24 16:05:00 +08:00
MM-24217 ensure updating Mfa secret and status invalidates cache (#14334)
This commit is contained in:
@@ -625,6 +625,9 @@ func (a *App) GenerateMfaSecret(userId string) (*model.MfaSecret, *model.AppErro
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Make sure the old secret is not cached on any cluster nodes.
|
||||
a.InvalidateCacheForUser(user.Id)
|
||||
|
||||
mfaSecret := &model.MfaSecret{Secret: secret, QRCode: b64.StdEncoding.EncodeToString(img)}
|
||||
return mfaSecret, nil
|
||||
}
|
||||
@@ -644,6 +647,9 @@ func (a *App) ActivateMfa(userId, token string) *model.AppError {
|
||||
return err
|
||||
}
|
||||
|
||||
// Make sure old MFA status is not cached locally or in cluster nodes.
|
||||
a.InvalidateCacheForUser(userId)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -653,6 +659,9 @@ func (a *App) DeactivateMfa(userId string) *model.AppError {
|
||||
return err
|
||||
}
|
||||
|
||||
// Make sure old MFA status is not cached locally or in cluster nodes.
|
||||
a.InvalidateCacheForUser(userId)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user