【问题标题】:Meteor Accounts.onEmailVerificationLink doesn’t workMeteor Accounts.onEmailVerificationLink 不起作用
【发布时间】:2017-05-27 01:49:20
【问题描述】:

我正在使用 Angular Meteor。

我希望用户通过Accounts.sendVerificationEmail () 验证他的电子邮件 (它将带有令牌的 URL 发送给点击用户) 我已经捕获了令牌,并且可以在console.log()中看到它

我的问题是 onEmailVerificationLink 没有运行,即使我传递了 token 参数。 这可以检查,因为它没有打印到console.log()

接下来我在客户端的代码

my-app\imports\ui\components\verifyMail\verifyMail.html

.

class VerifyMail {
    constructor($reactive, $scope, $stateParams) {
        'ngInject';
        $reactive(this).attach($scope);
        this.token = $stateParams.token;
        this.verifyLink();
    }

    verifyLink() {
        this.$bindToContext(
            Accounts.onEmailVerificationLink((token, done) => {
                console.log('CANT PRINT THIS CONSOLE LOG');
            })
        );
    }
}

【问题讨论】:

    标签: javascript angularjs meteor angular-meteor email-verification


    【解决方案1】:

    电子邮件验证回调发生在服务器上。

    或者,如果您使用集合挂钩 (https://atmospherejs.com/matb33/collection-hooks),您可以执行以下操作:

    Meteor.users.after.update(function (userId, doc, fieldNames, modifier, options) {
      if (!!modifier.$set) {
        //check if the email was verified
        if (modifier.$set['emails.$.verified'] === true) {
          //do something
        }
      }
    });
    

    【讨论】:

      猜你喜欢
      • 2019-04-10
      • 2016-08-09
      • 2019-01-31
      • 1970-01-01
      • 2015-02-14
      • 2016-12-18
      • 2015-06-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多