Validation for if all fields are required when an optional field has a value

I have a form that has an optional username/password input but when either the username or password has a value it causes them both to be required. Not sure how I should approach this? So far the validation looks a little wordy: enter image description here

I considered this kind of validation, but it gives an either/or impression:

enter image description here