简体   繁体   English

流星用户电子邮件验证不验证电子邮件

[英]Meteor user email verification not verify the email

i create an user signup and send verification email, in email that user received : 我创建用户注册并发送验证电子邮件,用户收到的电子邮件为:

Hello Derp,
To verify your account email, simply click the link below.
http://sijie.meteor.com/#/verify-email/pd65W2yQ8tKTd6XbF
Thanks.

after i click that link, i think the email address must be verified but i check on mongo, still verify : false 单击该链接后,我认为必须验证电子邮件地址,但是我在mongo上进行检查,仍然验证:false

"emails" : [
        {
            "address" : "derp@yahoo.com",
            "verified" : false
        }
    ],

why this happened? 为什么会这样? how to verify user after he click on the link? 用户单击链接后如何验证?

thanks 谢谢

The url will work automatically if you are using the accounts-ui or accounts-ui-unstyled packages.. other wise you have to call Accounts.verifyEmail with the token which is stored in Accounts._verifyEmailToken on the client side. 如果您使用accounts-ui或accounts-ui-unstyle包,则该URL将自动工作。否则,您必须使用存储在客户端Accounts._verifyEmailToken中的令牌来调用Accounts.verifyEmail。

They way they do this in accounts ui is to check on start up if Accounts._verifyEmailToken exists and if so call Accounts.verifyEmail. 他们在帐户ui中执行此操作的方式是检查启动是否存在Accounts._verifyEmailToken,如果存在,则调用Accounts.verifyEmail。

From: https://github.com/meteor/meteor/blob/4d45f2426057d882a225fe7fc57eba45f1d4cd26/packages/accounts-ui-unstyled/login_buttons_dialogs.js#L23 来自: https : //github.com/meteor/meteor/blob/4d45f2426057d882a225fe7fc57eba45f1d4cd26/packages/accounts-ui-unstyled/login_buttons_dialogs.js#L23

Meteor.startup(function () {
  if (Accounts._verifyEmailToken) {
    Accounts.verifyEmail(Accounts._verifyEmailToken, function(error) {
      Accounts._enableAutoLogin();
      if (!error)
        loginButtonsSession.set('justVerifiedEmail', true);
      // XXX show something if there was an error.
    });
  }
});

You probably need to use this method manually: Accounts.verifyEmail 您可能需要手动使用此方法: Accounts.verifyEmail
You can do it in your onBeforeAction if you use IronRouter. 如果使用IronRouter,则可以在onBeforeAction中完成。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM