You could just add a Model/ViewModel to handle this for you.
public class LoginViewModel
{
[Required(ErrorMessage="*")]
[StringLength(20, MinimumLength=5)]
public string UserName { get; set; }
[DataType(DataType.Password)]
public string Password { get; set; }
}
This way, in your view, you can notify the user that the length etc does not match.
Check out DataAnnotations here
EDIT
Is this what you are trying to do? I have not tested this code!
public class ApplicationUser : IdentityUser
{
public string UserName
{
get;
set
{
//your validation here
}
}
}