diff --git a/app/user.go b/app/user.go index c84df4f4c6..60871dbe00 100644 --- a/app/user.go +++ b/app/user.go @@ -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 }