   # TODO: Our error messages end with a dot, but client-side (Meteor's) do not
 
   # Check username unless onCreateUser is called because user has been invited
-  checkUsername user.username unless options.secret
+  validateUsername user.username unless options.secret
 
   throw new Meteor.Error 400, "Invalid email address." unless user.username is 'admin' or EMAIL_REGEX.test user.emails?[0]?.address
 


    invited._id

  'validate-username': (username) ->
    check username, String
    checkUsername username
    return # Make sure CoffeeScript does not return anything

  'set-username': (username) ->
    check username, String
    checkUsername username

    user = User.documents.findOne
      _id: Meteor.userId()
    throw new Meteor.Error 400, "Username already set" if user.username

    Meteor.users.update
      _id: Meteor.userId()

        username: username

    return # Make sure CoffeeScript does not return anything


Accounts.onCreateUser (options, user) ->
