简体   繁体   English

流星在服务器上调用Accounts.verifyEmail?

[英]Meteor call Accounts.verifyEmail on server?

Using Meteor, is it possible to call Accounts.verifyEmail( token ) on the server? 使用Meteor,是否可以在服务器上调用Accounts.verifyEmail( token ) I want to verify a users email without logging them in. I have created a method and called it on the client as I have written above but it fails silently. 我想验证用户的电子邮件而不登录他们。如上所述,我创建了一个方法并在客户端上调用了它,但是它无声地失败了。

If there is a way to accomplish this from the client I would be interested to know this also. 如果有办法从客户那里做到这一点,我也很想知道这一点。

Many thanks in advance. 提前谢谢了。

If you don't want your users to be logged in after submitting their token without having to override Meteor's methods, instead of calling Accounts.verifyEmail( token ) in your route, you can call a method on the server which will confront the given token with the services.email.verificationTokens items. 如果您不希望用户在提交令牌后不必覆盖Meteor的方法而登录,而不是在路由中调用Accounts.verifyEmail( token ) ,则可以在服务器上调用将面对给定令牌的方法与services.email.verificationTokens项一起使用。 If one of them matches, you can then update the verified field of the email attached and then remove the token field from services.email.verificationTokens . 如果其中之一匹配,则可以更新附件电子邮件的verified字段,然后从services.email.verificationTokens删除令牌字段。

You should get from: 您应该从:

verificationTokens: [
 {
  token: '523uL7XUvlMji-yv48ErEAe8Fq2VvAuMf_oY8lJSPfJ',
  address: 'qwe@dew.dewee',
  when: Thu Dec 10 2015 19:00:52 GMT+0100 (CET)
 } 
]

to an empty array (given you had only one token to verify). 到一个空数组(假设您只有一个令牌可以验证)。

verificationTokens: []

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

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