Rails w / Devise,确认令牌不能用于生产

时间:2014-07-14 01:47:03

标签: ruby-on-rails ruby ruby-on-rails-3 heroku devise

我有一个使用带有可确认电子邮件的Devise的rails应用程序。电子邮件发送正常,确认链接在开发中完美运行。但是在Heroku的制作中,它根本不起作用。

同样,电子邮件在生产时发送正常,生成令牌,但点击后,页面只会重定向到重新发送确认说明'页。生产中是否缺少使这项工作的东西?有什么建议或帮助吗?

这是我的开发日志:

Started GET "/users/confirmation?confirmation_token=SusKNC1PyZ4ayJxL9asR" for 127.0.0.1 at 2014-07-13 21:32:02 -0400
Processing by Devise::ConfirmationsController#show as HTML
  Parameters: {"confirmation_token"=>"SusKNC1PyZ4ayJxL9asR"}
  User Load (0.9ms)  SELECT  "users".* FROM "users"  WHERE "users"."confirmation_token" = '28535b0ce6b4cb809463749ccad8ae0c8e92f6e7ce6ea2b9262dc6be87eb1fff'  ORDER BY "users"."id" ASC LIMIT 1
   (0.1ms)  BEGIN
  SQL (0.9ms)  UPDATE "users" SET "confirmation_token" = $1, "confirmed_at" = $2, "updated_at" = $3 WHERE "users"."id" = 3  [["confirmation_token", nil], ["confirmed_at", "2014-07-14 01:32:02.960080"], ["updated_at", "2014-07-14 01:32:02.960674"]]
   (0.5ms)  COMMIT
Redirected to http://localhost:3000/users/sign_in

这是来自Heroku的日志

2014-07-14T01:36:05.606623+00:00 heroku[router]: at=info method=GET path="/users/confirmation" host=www.———.— request_id=76de591e-0948-4b89-93b1-eeb9431b2b9c fwd="72.229.255.68" dyno=web.1 connect=2 service=18 status=304 bytes=1218
2014-07-14T01:36:05.585691+00:00 app[web.1]: Started GET "/users/confirmation" for 72.229.255.68 at 2014-07-14 01:36:05 +0000
2014-07-14T01:36:05.594512+00:00 app[web.1]:   Rendered devise/shared/_links.html.haml (0.5ms)
2014-07-14T01:36:05.594570+00:00 app[web.1]:   Rendered devise/confirmations/new.html.haml within layouts/application (3.1ms)
2014-07-14T01:36:05.596841+00:00 app[web.1]:   Rendered layouts/_header.html.haml (1.1ms)
2014-07-14T01:36:05.588617+00:00 app[web.1]: Processing by Devise::ConfirmationsController#show as HTML
2014-07-14T01:36:05.597479+00:00 app[web.1]: Completed 200 OK in 9ms (Views: 6.3ms | ActiveRecord: 0.0ms)

2 个答案:

答案 0 :(得分:1)

我遇到了同样的错误:“生产中确认不能为空”,即使它在我的本地机器上运行。对我来说,问题是WWWhisper的免费帐户不允许未经授权的访问,并将电子邮件确认链接视为未经授权。

答案 1 :(得分:0)

我太笨了,我提交后就修好了。问题出在我的网址上。我在我的production.rb文件中输入了smtp设置的根域。但我实际上有一个www域名根域重定向。唉