Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a user with a verified email address in Meteor?

Tags:

meteor

In my server fixture, I'm populating the database with some test users using the Accounts.createUser function. Now, I'm trying to figure out how to flag the email of the created user as verified.

I've tried to set the verified flag directly but it doesn't work:

Meteor.users.findOne(userId).emails[0].verified = true
like image 521
Dejan Avatar asked Mar 23 '23 15:03

Dejan


1 Answers

If you want to update your user and set the verified flag to true. Try this.

Meteor.users.update(userId, {$set: {"emails.0.verified" :true}});

This will update the first email in the emails: [] array.

like image 59
Warz Avatar answered Apr 25 '23 09:04

Warz