2016-03-15 262 views
1

我有運行的應用程序發送電子郵件/帳戶名稱創建的情況下驗證電子郵件,但它不會發送驗證電子郵件,如果我登錄谷歌/臉譜;這可能是由於services.google.email中的電子郵件地址;如果存在,我如何在Accounts.emailTemplates中將字段'設置爲'。驗證電子郵件與帳戶谷歌,帳戶Facebook的

configureAccounts = function() { 
    setMailVerification(enableMailVerification); 
}; 

setMailVerification = function() { 
    Accounts.emailTemplates.from = '[email protected]'; 
    Accounts.emailTemplates.verifyEmail = { 
     subject : function(user) { 
      return "Confirmation" 
     }, 
     text : function(user, url) { 
      var greeting = (user.profile && user.profile.nick) ? ("Hello " + user.profile.nick + ",") : "Hello,"; 
      return greeting + 
       "\n\n" + "Thank you for registration."+ 
       "\n" + "To confirm click the following link:" + url + 
       "\n\n" + "thank you." 
     } 
    }; 

    Accounts.config({ 
     sendVerificationEmail : true, 
     forbidClientAccountCreation : false 
    }); 
}; 

請讓我知道,如果你在那裏我應該把... services.google.email在谷歌的登錄名和同爲Facebook的情況下...

換句話說

我怎麼能發送的驗證電子郵件Meteor.user()services.google.email ..(甚至回顧sendUserVerificationEmail與電子郵件不工作,因爲它是不是在「電子郵件」)

回答

0

我修改.email財產onCreateUser如下:

if(user.services != undefined) { 
    console.log('services in onCreateUser'); 
    user.sentVerificationEmail = false; 
    user.emails =[]; 

    var emailServices = user.services.google != undefined ? 
     user.services.google.email : 
     user.services.facebook.email; 
    user.emails.push({ 
     address : emailServices, 
     verified : false 
    }); 
} 

if (options.profile) 
    user.profile = options.profile; 

return user; 

然後我調用Accounts.sentVerificationEmail然後onLogin ..它工作;

謝謝大家看看