Reputation: 5023
I have to create a verified account on seeding. The below user object creates user.email[0].verified = 'false'
But it should be in true
.
user = {
name: 'Admin',
email: '[email protected]',
password: 'password',
}
Meteor.startup(function() {
if (Meteor.users.find().count() < 2) {
Accounts.createUser(user); // It create user verification as false. How to make them true
}
});
I tried the below object but no use.
user = {
name: 'Admin',
email: [address:'[email protected]',verified:true],
password: 'password',
}
Meteor packages:
accounts-password
ian:accounts-ui-bootstrap-3
Upvotes: 2
Views: 332
Reputation: 1998
It seems that Accounts.addEmail allows to programatically set the verified property. According to the documentation it should overwrite these settings if the user already has that email registered. Worth giving it a try
Accounts.addEmail(userId, newEmail, [verified])
http://docs.meteor.com/#/full/Accounts-addEmail
In your case (on the server):
user = {
name: 'Admin',
email: '[email protected]',
password: 'password',
}
Meteor.startup(function() {
if (Meteor.users.find().count() < 2) {
userId = Accounts.createUser(user);
Accounts.addEmail(userId, user.email, true);
}
});
Upvotes: 3