Sleep mode and password

When in sleep mode. Is it possible to have the password input only when the laptop is closed, but not when the laptop is open?