Blame view

server/admin/startup.coffee 675 Bytes
39d39619c   Ryan Glover   Add automatic acc...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
  ###
    Startup
    Collection of methods and functions to run on server startup.
  ###
  
  # Generate Test Accounts
  # Creates a collection of test accounts automatically on startup.
  
  # Create an array of user accounts.
  users = [
    { name: "Admin", email: "admin@admin.com", password: "password" }
  ]
  
  # Loop through array of user accounts.
  for user in users
  
    # Check if the user already exists in the DB.
    checkUser = Meteor.users.findOne({"emails.address": user.email});
  
    # If an existing user is not found, create the account.
    if not checkUser
  
      id = Accounts.createUser(
        email: user.email
        password: user.password
        profile:
          name: user.name
      )