diff --git a/api4/user.go b/api4/user.go index 51eb1f846c..acedcf262c 100644 --- a/api4/user.go +++ b/api4/user.go @@ -1109,9 +1109,10 @@ func sendPasswordReset(c *Context, w http.ResponseWriter, r *http.Request) { } func login(c *Context, w http.ResponseWriter, r *http.Request) { - // For hardened mode, translate all login errors to generic. + // For hardened mode, translate all login errors to generic. MFA error being an exception, since it's required for + // the login flow itself. defer func() { - if *c.App.Config().ServiceSettings.ExperimentalEnableHardenedMode && c.Err != nil { + if *c.App.Config().ServiceSettings.ExperimentalEnableHardenedMode && c.Err != nil && c.Err.Id != "mfa.validate_token.authenticate.app_error" { c.Err = model.NewAppError("login", "api.user.login.invalid_credentials", nil, "", http.StatusUnauthorized) } }()