Adding proper air control to RigidbodyFirstPersonController

Unity’s provided RigidbodyFirstPersonController moves like this:

if (m_RigidBody.velocity.sqrMagnitude < (movementSettings.CurrentTargetSpeed * movementSettings.CurrentTargetSpeed)) {
  m_RigidBody.AddForce (desiredMove * SlopeMultiplier (), ForceMode.Impulse);
}

This means that if the body is moving at max speed (in air), you’re unable to control yourself. I’d like to continue being able to control myself while still clamping the speed - How can I do this? I thought about checking the magnitude after adding a force, but I don’t believe there’s a way to do that in the same frame.

I was mostly able to solve it using this:

else if (!m_IsGrounded) {
  Vector3 desVel = desiredMove;
  desVel.y = m_RigidBody.velocity.y;
  m_RigidBody.velocity = m_RigidBody.velocity.magnitude * desVel.normalized;
}