Why are the admin email and meteor.user().email not equal when logged in as admin?


#1

Currently it is supposed to check if the user has the admin email before being able to post. It instead does not allow the any user to post. I think I set the useremail variable wrong as it returns a error that the admin user does not have the right email when logged in as the admin. Why is this not working and how can it be fixed?

The error being returned .

if (post.useremail!="admin@gmail.com")
  errors.useremail =  "Please sign into a admin account to post";

Where useremail is set.

 var post = _.extend(postAttributes, {
   useremail: user.email,
   author: user.username,
   submitted: new Date(),
   commentsCount: 0
 });

Where the admin user is created the first time the server starts.

 Accounts.createUser({
     username: 'admin',
     email: 'admin@gmail.com',
     password: 'admin'
 });

#2

http://docs.meteor.com/#/full/meteor_users
-> user.emails is an array