This is a variation of a frequently asked question.
The user login form for Drupal is built using Drupal Form API.
In Drupal 7 core, the user login form is declared in user.module:
// Display login form:
$form['name'] = array('#type' => 'textfield',
'#title' => t('...
will always return TRUE, since the form element exists, and therefore a value is always passed to the submit hander, even when the value is empty.
You likely want this: