I create default users on a server with the Meteor launch feature. I want to create a user and also check his / her email at startup (I assume that you can only do this after creating an account).
Here is what I have:
Meteor.startup(function() {
if(!Meteor.users.find().count()) {
var barry = {
username: 'barrydoyle18',
password: '123456',
email: 'myemail@gmail.com',
profile: {
firstName: 'Barry',
lastName: 'Doyle'
},
roles: ['webmaster', 'admin']
};
Accounts.createUser(barry);
Meteor.users.update(<user Id goes here>, {$set: {"emails.0.verified": true}});
}
});
As I said, I assume that the user must be created first before setting the check flag as true (if this statement is false, please show the solution to make the flag true when creating the user).
To set the email authentication flag, I know that I can update the user after creating with Meteor.users.update(userId, {$set: {"emails.0.verified": true}});.
, , , ?