diff --git a/login_page.php b/login_page.php
index e00aee9..e32f195 100644
--- a/login_page.php
+++ b/login_page.php
@@ -102,6 +102,11 @@ if ( $t_session_validation ) {
 	}
 }
 
+# Check username is valid if provided
+if( !user_is_name_valid( $f_username ) ) {
+	$f_username = '';
+}
+
 # Determine whether the username or password field should receive automatic focus.
 $t_username_field_autofocus = 'autofocus';
 $t_password_field_autofocus = '';
