It is, in fact, quite common and legal in most states (including California, and I have reason to know that) for a bonus to be only payable to those who are still on the payroll on the day it was awarded. I agree that you should have the bonus agreement looked at by a lawyer to see if it's enforceable after the fact, but such a policy is generally SOP.