流星帐户电子邮件验证失败两种方式 [英] Meteor account email verify fails two ways

查看:303
本文介绍了流星帐户电子邮件验证失败两种方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的开发箱上挂了电子邮件,创建用户后收到验证电子邮件.我可以单击包含的链接,它将带我到我的主页.

I have email hooked up on my dev box, and get a verification email after creating a user. I can click on the included link, and it will bring me to my main page.

1)单击链接似乎进行了一些处理,因为它重定向到/,但不会更改用户帐户上的已验证标志.

1) Clicking on the link seems to do some processing, because it redirects to /, but it does not change the verified flag on the user account.

2)似乎忽略了我的Accounts.config设置,仅在我明确调用

2) It seems to ignore my Accounts.config setting, and only works when I explicitly call

token = Accounts.sendVerificationEmail(userId)

详细信息:

mrt --version
Meteorite version 0.6.11
Release 0.6.5.1

mrt list --using

standard-app-packages
preserve-inputs
less
coffeescript
iron-router
foundation
http
moment
email
spin
roles
accounts-base
accounts-password
accounts-ui

Server/lib/account.coffee

Server/lib/account.coffee

Accounts.config
  sendVerificationEmail: true          
  forbidClientAccountCreation: true

服务器方法:

Meteor.startup ->
  create_user = (options) ->
    console.log('create_user: ' + options.username)
    userId = Accounts.createUser options

    # should not be necessary, but I get email only when included
    token = Accounts.sendVerificationEmail(userId)


  Meteor.methods({ create_user: create_user })  

在上述调用之后,mongo显示:

After above called, mongo shows:

emails: [ { "address" : "jim@less2do.com" , "verified" : false}]

and

email: { "verificationTokens" : [ { "token" : "N3sLEDMsutTbjxyzX" , "address" : "jim@less2do.com" , "when" : 1.380616343673E12}]}

获取默认电子邮件:

Hello,    
To verify your account email, simply click the link below.    
http://localhost:3000/#/verify-email/N3sLEDMsutTbjxyzX        
Thanks.    

点击上面的链接即可转到:

Clicking above link gets me to:

http://localhost:3000/

但是对mongo数据库没有任何更改.

But no changes to the mongo db.

我期望帐户密码处理的/#/verify-email/N3sLEDMsutTbjxyzX能够带来一些好处,并会更新用户文档.

I was expecting something pulled in by accounts-password processed /#/verify-email/N3sLEDMsutTbjxyzX and would update the user document.

accounts-base.js尝试

accounts-base.js tries, with

match = window.location.hash.match(/^\#\/verify-email\/(.*)$/);

但此时位置哈希为空.

我错过了一些需要手动设置路线的地方吗?我使用铁皮路由器会毁了东西吗?以防万一,

Am I missing something where I need to manually set up routes? Is my use of iron router ruining things? Just in case,

Router.map ->
  this.route 'home',
    path: '/'

  this.route 'inboxes'
  this.route 'availability'
  this.route 'find-agent'
  this.route 'inbox-tour'
  this.route 'availability-tour'
  this.route 'find-agent-tour'

  this.route 'inbox', 
    path: '/inbox/:_id'
    data: () ->

      m = Messages.findOne this.params._id
      m._markRead()
      fixed = _.map m.history.versions, (msg) =>
        msg.left = (msg.author is 'offer')
        msg.body = msg.body.replace( /[\r\n]+/g, "<br>")
        msg
      m.history.versions = fixed
      Session.set  'messageVersions', fixed
      m

    waitOn: db.subscriptions.messages
    loadingTemplate: 'loading'
    notFoundTemplate: 'notFound'

  this.route 'register',
  this.route 'requested',
  this.route 'blog',
  this.route 'test',
  this.route 'aboutUs'        

Router.configure
  layout: 'layout'

  notFoundTemplate: 'notFound'

  loadingTemplate: 'loading'

  renderTemplates: 
    'footer': { to: 'footer' }
    'sidebar': { to: 'sidebar' }



  ### Commented to rule out this routine
  before: ->
    routeName = @context.route.name
    debugger

    # no need to check at these URLs
    #, etc 
    return  if _.include(["request", "passwordReset","register", "tour"], routeName)
    return  if _.intersection(routeName.split('-'), ["tour"]).length > 0
    return if routeName.indexOf('verify-email') != -'' 
    user = Meteor.user()
    unless user
      #@render (if Meteor.loggingIn() then @loadingTemplate else "/")
      if Meteor.loggingIn()
        console.log('still logging in, no user, to ' + @loadingTemplate)
        @render @loadingTemplate
        console.log('!render ' + @loadingTemplate + ' completed' )
      else
        console.log('no user, / from router over ' + @loadingTemplate)
        @render "home"
      @stop()
  ###

谢谢!

推荐答案

我确认,现在可以正常使用了.重定向到应用程序的根目录后,这就是我要做的事情.

I confirm, this is now perfectly working. Here is what I do once I'm redirect to the root of the application.

阅读更多: 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆