Reputation: 10658
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)...
For my login I have the following function:
Meteor.loginWithPassword(username, password, function(err) {/* error feedback */});
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.
Is there a way to login with username OR email address?
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.
Upvotes: 1
Views: 1240
Reputation: 3779
You can just do something like this
Meteor.loginWithPassword(email, password, function(err) {/* error feedback */});
Upvotes: 5