cb1985
cb1985

Reputation: 3

Meteor.js automatically logs in when i create a custom user

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

Answers (1)

richsilv
richsilv

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:

server

Meteor.methods({
  createUser: function(options) {
    Accounts.createUser(options);
  }
});

client

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

Related Questions