Taieb
Taieb

Reputation: 920

Meteor create user without verification

I want to create a user without doing the verification, it’s set on false as soon as i create a user.

Is there a way that when i does the register the emails.verified will be set on TRUE and not false ?

Upvotes: 0

Views: 68

Answers (2)

Ivo
Ivo

Reputation: 2518

This code on server side should do the trick:

   Accounts.onCreateUser(function(options, user) {
      user.emails[0].verified = true;
      return user;
   })

Upvotes: 1

Abhishek Maurya
Abhishek Maurya

Reputation: 1863

Place this code on the server, assuming you have only one email

AccountsTemplates.configure({postSignUpHook: postSignUp});

const postSignUp = function postSignUp(userId, info) {
  Meteor.users.update(userId, {
        $set: {
          "emails.0.verified": true
        }
      });  
}

Upvotes: 1

Related Questions