You need two booleans, isColidingWithGround and isJumping
When the user presses the jump button, if isColidingWithGround is true, and isJumping is false, then call jump() which sets isJumping to true
If the player's y velocity is positive then isJumping equals false
If the player is coliding with the ground, then isColidingWithGround equals true, else isColidingWithGround equals false.
Sometimes the player is still in contact with the ground after the initial jump impulse, and I find that with using these two flags, it prevents jump() from being called multiple times when jump is pressed.