Hello!
In OS X Lion, you can enter the two-factor authentication code following your password in the password field.
From Two-factor authentication for Apple ID - Apple Support:
If you use two-factor authentication with devices running older OS versions—like an Apple TV (2nd or 3rd generation)—you might be asked to add your six-digit verification code to the end of your password when signing in. Get your verification code from a trusted device running iOS 9 and later or OS X El Capitan and later, or have it sent to your trusted phone number. Then type your password followed by the six-digit verification code directly into the password field.
For example, if your Apple ID password is "MyPassword", and the two-factor authentication code is 123456, you enter "MyPassword123456".
Jack