I guess this is more a feature request than an issue.
It would be great to have by default or as a configuration the ability to make login work with username or email. As uniqueness is checked for both field, it may not imply that much change.
I think it should auto detect if email is used with an email regex. And then check the email/password combination. If the regex is not valid, then username/password combination should be checked.
I know there is a workaround for using email for login (putting email address in the username field and email field). But I don't think there is anything easy for accepting both at the same time.
Is there any plan to implement something like this ?
do you want to take a crack at it?
I'd love to ! But I would need a whole lot of explanations because I'm completely lost in the project. If you have time to explain things to me, I could try to dig into it. Why not a Skype ? I've been wanting to collaborate on Parse Server or Parse iOS SDK for a long time.
@AmbroiseCollon I'll plan something out before the end of the week, like a hangout with other contributors so we can onboard you and others correctly.
@flovilmart I'd be interested in getting a more in depth overview of the project as well if you don't mind another listening in!
let's sync up on Gitter https://gitter.im/ParsePlatform/Chat
Is there any news? :)
I just found this issue since I'm looking for a way to allow users to log in using username or email. If this hasn't been touched yet, I'd love to jump on it and possibly have this included in a future (next?) release.
@AmbroiseCollon, did you start working on this yet?
Thanks
I'm going to grab this issue as it doesn't seem to have been worked on yet (no update since February 13th) and I need it for my app. I'll submit a PR soon.
There's already 2 PR open for supporting that, with 2 approaches. Let's discuss pros/cons of those approaches on the PR's
Oh, good to know! Thanks for saving me the trouble. I'll take a look at the PRs.
Any updates?
I haven't yet looked at the PRs, but here's what I'm about to do:
This is back of the napkin code, but should be nearly functional, if not just working.
var userQuery = new Parse.Query(Parse.User);
userQuery.equalTo('email', '[email protected]');
userQuery.first().then(function(_user) {
var username = _user.toJSON().username;
Parse.User.logIn(username, password).then(function(_user) {
console.info("Logged in via email");
}, function(_error) {
console.error("There was an error", _error);
})
}, function(_error) {
console.error("There was an error", _error);
});
Worked. Here's the code put into a function for reusability:
/**
Is there any update on this?
You should be able to either pass email or username to the JS login method, and it would work with the latest parse server version
Most helpful comment
You should be able to either pass email or username to the JS login method, and it would work with the latest parse server version