title: Meteor - Account.createUser in client and server
body: <p>I understand the reason to have the business logic in both client and server, but I don't understand well how to do that in some situations. Here for example:</p>
  
  <pre class="lang-js prettyprint-override"><code>// client/client.js
  // hnadling click event on the Create Accounts button
  Template.homecontent.events({
    'click #btnCreateAccount': function (event, template) {
      var userEmail = template.find('#email').value,
        userName  = template.find('#newusername').value,
        password  = template.find('#newpassword').value,
        password2 = template.find('#password2').value,
        name      = template.find('#fullname').value;
  
      validates = true;
     //do some validation here
     if(password != password2) {
        validates = false;
     }
  
      if(validates === true) {
        Accounts.createUser({
          username: userName,
          email:    userEmail,
          password: password,
          profile: {
            name: name
          }
        }, function (error) {
          if (error) {
            console.log("Cannot create user");
          }
        });
      }
    }
  });
  </code></pre>
  
  <p>Since the validation is on the client only, it can easily be bypassed.
  But there's a problem here: this is triggered by a user event, so I'm not sure what's the best way to have this code running on client &amp; server.</p>