First, focus on the first field of the form when it loads. This allows the user to start typing right away, go through the form with the TAB key, and sign in faster. I see a lot of forms that don’t do that, and don’t even allow you to jump to the first field with the TAB key, forcing you to perform an additional action by grabbing the mouse and clicking inside the field.
Second, don’t clear the entire form when the user does not authenticate successfully. If I typed my password incorrectly, I should not have to retype my email address as well. When the user does not authenticate completely, leave all information except for the password intact, and focus on the first field.