Reputation: 3
Lately having this issue when i create a new user using the Accounts.create() , it creates the new user and logs in automatically by that username. It should just create the user and not login
Upvotes: 0
Views: 191
Reputation: 8013
This is the intended behavior. To create a new user without logging the client in, I'd write a Meteor.methods
which calls Accounts.createUser
from the server side and call this method from the client, which will not result in the client being logged in.
UPDATE
To expand that a little, something like this:
Meteor.methods({
createUser: function(options) {
Accounts.createUser(options);
}
});
Meteor.call('createUser', options, callback);
// THIS SHOULD REPLACE:
// Accounts.createUser(options, callback); on the client (callback is optional)
As per the link above, if you create a user from the server side it won't automatically log them in, as it doesn't know which client they're being created from.
Upvotes: 1