title: accounts-ui with meteor cluster
body: <p>I am having 2 applications 'service[server-app]' and 'website[client-app]' connected with meteor cluster and I connected 'service' application with mongodb. I am using accounts-ui for login and signup through 'website' application. Below provided is my code and is this the right way to do so </p>
  
  <p>website application</p>
  
  <pre><code>Accounts.onCreateUser(function(options, user) {  
          var usr = ddpconn.call('CreateUser', user); // ddp cluster connection to the service app
          return usr;
   });
  </code></pre>
  
  <p>service application</p>
  
  <pre><code>Meteor.methods({
    CreateUser: function (user) {
      var invited = Invitations.findOne({"user_id":user._id});
      if(invited){ 
  
              // Updates the subdoc of invited user
              Meteor.users.update({"_id": invited.user_id,"rules._id":usr.rules[0]._id},{ $inc:
                  {"rules.$.lineup": 1} });
  
              Invitations.update({"user_id":invited.user_id},{$set:{"updated_at":new Date()}});
  
              // Adds a rules subdoc to the user which creates an account
              user.rules = [ { "_id" : new Mongo.ObjectID()._str, "lineup" :1} ]
              return user;
          }
      } else {
  
          // Adds a rules subdoc to the user which creates an account
          user.rules = [ { "_id" : new Mongo.ObjectID()._str, "lineup" : 1} ]
         return user;
      }
    }
  });
  </code></pre>