title: Meteor: How to log user in using username OR password
body: <p>I have set up a custom login system with my Meteor applications where a created user has a username, email, password, profile (with many other non-important fields there)...</p>
  
  <p>For my login I have the following function:</p>
  
  <pre><code>Meteor.loginWithPassword(username, password, function(err) {/* error feedback */});
  </code></pre>
  
  <p>At the moment this works perfectly for logging in with the username but I'd like to be able to log in with email address.</p>
  
  <p>Is there a way to login with username OR email address?</p>
  
  <p>Note that I've added validation on creating a username where the username cannot be an email so I am able to perform an "if isEmail" condition before applying this login function.  Therefore the username and email won't be the same so that factor is not an issue.</p>