无法使用 Devise gem 在 Heroku 中登录 Rails 5 应用程序
Unable to log into Rails 5 app in Heroku with the Devise gem
一时发疯,我决定制作一个 Rails 5 应用程序,它使用 Devise gem 和 Omniauth。一切似乎都在开发环境中工作(尽管我没有将它配置为从那里发送电子邮件......cukes 正在通过!=D)但是当我将它推送到 Heroku 并迁移时(甚至当我尝试重新启动 dyno ),我无法使用有效的电子邮件和密码登录(或通过 omniauth,但这是预料之中的),当我尝试注册时,帐户已创建,但从未发送过身份验证电子邮件。我无法重新发送确认电子邮件,当我尝试通过 Heroku 中的 rails 控制台确认现有帐户时,我无法在应用程序上使用忘记的密码 link 重置帐户密码。无论我做什么,我都会收到一般的 500 错误,建议我检查我的日志。据我所知,问题似乎出在 Devise 或 ActionMailer 上,因为网站的其余部分加载正确。
我已尝试在以下页面上更改我的 Gmail 设置:
Less Secure Apps (which I haven't had to use for my Rails 4 apps recently)
我已经尝试对配置文件等进行各种调整,但到目前为止没有任何效果。
Heroku 的日志(当我试图从网站发送忘记密码的电子邮件时)
2016-08-27T08:22:49.275213+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:232:in `block in conditional'
2016-08-27T08:22:49.275273+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:456:in `block in call'
2016-08-27T08:22:49.275332+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:456:in `call'
2016-08-27T08:22:49.275302+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:456:in `each'
2016-08-27T08:22:49.275656+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activerecord-5.0.0.1/lib/active_record/transactions.rb:334:in `rollback_active_record_state!'
2016-08-27T08:22:49.275713+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activerecord-5.0.0.1/lib/active_record/suppressor.rb:41:in `save'
2016-08-27T08:22:49.275774+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/bundler/gems/devise-4c3838bb759e/lib/devise/models/recoverable.rb:45:in `send_reset_password_instructions'
2016-08-27T08:22:49.275362+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:101:in `__run_callbacks__'
2016-08-27T08:22:49.275509+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/transaction.rb:202:in `within_new_transaction'
2016-08-27T08:22:49.275391+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:750:in `_run_commit_callbacks'
2016-08-27T08:22:49.275155+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:382:in `block in make_lambda'
2016-08-27T08:22:49.275420+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activerecord-5.0.0.1/lib/active_record/transactions.rb:354:in `committed!'
2016-08-27T08:22:49.275451+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/transaction.rb:87:in `commit_records'
2016-08-27T08:22:49.275684+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activerecord-5.0.0.1/lib/active_record/transactions.rb:318:in `save'
2016-08-27T08:22:49.276127+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:101:in `__run_callbacks__'
2016-08-27T08:22:49.276268+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
2016-08-27T08:22:49.275479+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/transaction.rb:178:in `commit_transaction'
2016-08-27T08:22:49.276857+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_controller/metal.rb:262:in `dispatch'
2016-08-27T08:22:49.276997+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/routing/mapper.rb:46:in `serve'
2016-08-27T08:22:49.275241+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:456:in `call'
2016-08-27T08:22:49.277110+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/routing/route_set.rb:725:in `call'
2016-08-27T08:22:49.277194+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/omniauth-1.3.1/lib/omniauth/strategy.rb:186:in `call!'
2016-08-27T08:22:49.277251+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/omniauth-1.3.1/lib/omniauth/strategy.rb:186:in `call!'
2016-08-27T08:22:49.277279+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/omniauth-1.3.1/lib/omniauth/strategy.rb:164:in `call'
2016-08-27T08:22:49.277307+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/warden-1.2.6/lib/warden/manager.rb:35:in `block in call'
2016-08-27T08:22:49.277447+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/rack-2.0.1/lib/rack/head.rb:12:in `call'
2016-08-27T08:22:49.277630+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:750:in `_run_call_callbacks'
2016-08-27T08:22:49.277658+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:90:in `run_callbacks'
2016-08-27T08:22:49.277856+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/tagged_logging.rb:70:in `block in tagged'
2016-08-27T08:22:49.278095+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/executor.rb:12:in `call'
2016-08-27T08:22:49.275538+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/database_statements.rb:232:in `transaction'
2016-08-27T08:22:49.275567+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activerecord-5.0.0.1/lib/active_record/transactions.rb:211:in `transaction'
2016-08-27T08:22:49.275597+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activerecord-5.0.0.1/lib/active_record/transactions.rb:392:in `with_transaction_returning_status'
2016-08-27T08:22:49.275859+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_controller/metal/basic_implicit_render.rb:4:in `send_action'
2016-08-27T08:22:49.275927+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_controller/metal/rendering.rb:30:in `process_action'
2016-08-27T08:22:49.276069+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:455:in `call'
2016-08-27T08:22:49.276211+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/abstract_controller/callbacks.rb:19:in `process_action'
2016-08-27T08:22:49.276296+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/notifications.rb:164:in `block in instrument'
2016-08-27T08:22:49.276800+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionview-5.0.0.1/lib/action_view/rendering.rb:30:in `process'
2016-08-27T08:22:49.277223+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/omniauth-1.3.1/lib/omniauth/strategy.rb:164:in `call'
2016-08-27T08:22:49.277587+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:97:in `__run_callbacks__'
2016-08-27T08:22:49.277799+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/rack/logger.rb:36:in `call_app'
2016-08-27T08:22:49.278008+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/rack-2.0.1/lib/rack/method_override.rb:22:in `call'
2016-08-27T08:22:49.278133+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/static.rb:136:in `call'
2016-08-27T08:22:49.275626+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activerecord-5.0.0.1/lib/active_record/transactions.rb:319:in `block in save'
2016-08-27T08:22:49.275743+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/bundler/gems/devise-4c3838bb759e/lib/devise/models/recoverable.rb:88:in `set_reset_password_token'
2016-08-27T08:22:49.275802+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/bundler/gems/devise-4c3838bb759e/lib/devise/models/recoverable.rb:119:in `send_reset_password_instructions'
2016-08-27T08:22:49.275901+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/abstract_controller/base.rb:188:in `process_action'
2016-08-27T08:22:49.275956+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/abstract_controller/callbacks.rb:20:in `block in process_action'
2016-08-27T08:22:49.275984+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:126:in `call'
2016-08-27T08:22:49.276012+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:126:in `call'
2016-08-27T08:22:49.276041+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:506:in `block (2 levels) in compile'
2016-08-27T08:22:49.276466+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activerecord-5.0.0.1/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
2016-08-27T08:22:49.277082+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/journey/router.rb:26:in `serve'
2016-08-27T08:22:49.277532+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/cookies.rb:613:in `call'
2016-08-27T08:22:49.277714+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
2016-08-27T08:22:49.278038+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/rack-2.0.1/lib/rack/runtime.rb:22:in `call'
2016-08-27T08:22:49.276098+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:455:in `call'
2016-08-27T08:22:49.276381+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_controller/metal/instrumentation.rb:30:in `process_action'
2016-08-27T08:22:49.276885+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/routing/route_set.rb:50:in `dispatch'
2016-08-27T08:22:49.277504+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/rack-2.0.1/lib/rack/session/abstract/id.rb:216:in `call'
2016-08-27T08:22:49.278267+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/puma-3.6.0/lib/puma/server.rb:415:in `process_client'
2016-08-27T08:22:49.276155+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:750:in `_run_process_action_callbacks'
2016-08-27T08:22:49.276239+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_controller/metal/rescue.rb:20:in `process_action'
2016-08-27T08:22:49.276437+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/searchkick-1.3.3/lib/searchkick/logging.rb:153:in `process_action'
2016-08-27T08:22:49.277025+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/journey/router.rb:39:in `block in serve'
2016-08-27T08:22:49.277391+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/rack-2.0.1/lib/rack/etag.rb:25:in `call'
2016-08-27T08:22:49.277884+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/tagged_logging.rb:26:in `tagged'
2016-08-27T08:22:49.278352+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/puma-3.6.0/lib/puma/thread_pool.rb:116:in `block in spawn_thread'
2016-08-27T08:22:49.276324+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
2016-08-27T08:22:49.276352+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/notifications.rb:164:in `instrument'
2016-08-27T08:22:49.276913+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/routing/route_set.rb:32:in `serve'
2016-08-27T08:22:49.276969+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/routing/mapper.rb:46:in `call'
2016-08-27T08:22:49.277743+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/debug_exceptions.rb:49:in `call'
2016-08-27T08:22:49.277828+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/rack/logger.rb:24:in `block in call'
2016-08-27T08:22:49.277914+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/tagged_logging.rb:70:in `tagged'
2016-08-27T08:22:49.277980+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/request_id.rb:24:in `call'
2016-08-27T08:22:49.278239+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/puma-3.6.0/lib/puma/server.rb:578:in `handle_request'
2016-08-27T08:22:49.276409+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_controller/metal/params_wrapper.rb:248:in `process_action'
2016-08-27T08:22:49.277560+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/callbacks.rb:38:in `block in call'
2016-08-27T08:22:49.277686+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/callbacks.rb:36:in `call'
2016-08-27T08:22:49.277167+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/omniauth-1.3.1/lib/omniauth/strategy.rb:164:in `call'
2016-08-27T08:22:49.277336+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/warden-1.2.6/lib/warden/manager.rb:34:in `catch'
2016-08-27T08:22:49.277953+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/rack/logger.rb:24:in `call'
2016-08-27T08:22:49.275829+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/bundler/gems/devise-4c3838bb759e/app/controllers/devise/passwords_controller.rb:13:in `create'
2016-08-27T08:22:49.276184+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:90:in `run_callbacks'
2016-08-27T08:22:49.277054+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/journey/router.rb:26:in `each'
2016-08-27T08:22:49.277139+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/omniauth-1.3.1/lib/omniauth/strategy.rb:186:in `call!'
2016-08-27T08:22:49.277419+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/rack-2.0.1/lib/rack/conditional_get.rb:38:in `call'
2016-08-27T08:22:49.276773+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/abstract_controller/base.rb:126:in `process'
2016-08-27T08:22:49.276828+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_controller/metal.rb:190:in `dispatch'
2016-08-27T08:22:49.276941+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/routing/mapper.rb:16:in `block in <class:Constraints>'
2016-08-27T08:22:49.277364+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/warden-1.2.6/lib/warden/manager.rb:34:in `call'
2016-08-27T08:22:49.277475+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/rack-2.0.1/lib/rack/session/abstract/id.rb:222:in `context'
2016-08-27T08:22:49.277771+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
2016-08-27T08:22:49.278067+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
2016-08-27T08:22:49.278154+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/rack-2.0.1/lib/rack/sendfile.rb:111:in `call'
2016-08-27T08:22:49.278184+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/engine.rb:522:in `call'
2016-08-27T08:22:49.278211+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/puma-3.6.0/lib/puma/configuration.rb:225:in `call'
2016-08-27T08:22:49.278324+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/puma-3.6.0/lib/puma/thread_pool.rb:116:in `call'
2016-08-27T08:22:49.278296+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/puma-3.6.0/lib/puma/server.rb:275:in `block in run'
我当前的 Gemfile
source 'https://rubygems.org'
gem 'rails', '~> 5.0.0', '>= 5.0.0.1'
gem 'pg', '~> 0.18'
gem 'puma', '~> 3.0'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
gem 'redis', '~> 3.0'
# Use ActiveModel has_secure_password
gem 'bcrypt', '~> 3.1.7'
gem 'jquery-rails'
gem 'sprockets', '>=3.0.0.beta'
#gem 'sprockets-es6'
gem 'haml'
gem 'nokogiri'
gem 'devise', git: 'https://github.com/plataformatec/devise.git', branch: 'master'
gem 'omniauth'
gem 'omniauth-facebook'
gem 'omniauth-twitter'
gem 'omniauth-instagram'
gem 'cancancan'
gem 'figaro'
gem 'humanize_boolean'
gem 'carrierwave', git: 'https://github.com/carrierwaveuploader/carrierwave'
gem 'mini_magick', '~> 3.8.0'
gem 'fog'
gem 'geocoder'
gem 'elasticsearch-model', git: 'https://github.com/elasticsearch/elasticsearch-rails.git'
gem 'elasticsearch-rails', git: 'https://github.com/elasticsearch/elasticsearch-rails.git'
gem 'searchkick'
gem 'cocoon'
gem 'owlcarousel-rails'
# Use Capistrano for deployment
gem 'capistrano-rails', group: :development
group :test do
gem 'selenium-webdriver'
end
group :development, :test do
gem 'pry-byebug', platform: :mri
gem 'rspec-rails'
gem 'simplecov'
gem 'factory_girl_rails'
gem 'launchy'
gem 'cucumber-rails', :require => false
gem 'database_cleaner'
gem 'faker'
gem 'rails-controller-testing'
gem 'capybara'
gem 'jasmine'
end
group :development do
gem 'web-console'
gem 'listen', '~> 3.0.5'
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
group :production do
gem 'rails_12factor'
gem 'aws-sdk'
end
config/environments/production.rb
Rails.application.configure do
config.cache_classes = true
config.eager_load = true
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
config.assets.js_compressor = :uglifier
config.assets.compile = true
config.log_level = :debug
config.log_tags = [ :request_id ]
config.action_mailer.perform_caching = false
config.action_mailer.raise_delivery_errors = false
config.action_mailer.default_url_options = {
host: ENV["MAILER_HOST"], #Rails.application.secrets.mailer_host,
from: ENV["MAILER_FROM"]#Rails.application.secrets.mailer_from
}
Rails.application.routes.default_url_options[:host] = ENV["MAILER_HOST"]#Rails.application.secrets.mailer_host
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
config.action_mailer.smtp_settings = {
address: "smtp.gmail.com",
port: 587,
domain: ENV["GMAIL_DOMAIN"],#Rails.application.secrets.gmail_domain,
authentication: :plain,
enable_starttls_auto: true,
user_name: ENV["GMAIL_USERNAME"],#Rails.application.secrets.gmail_username,
password: ENV["GMAIL_PASSWORD"]#Rails.application.secrets.gmail_password
}
config.i18n.fallbacks = true
config.active_support.deprecation = :notify
config.log_formatter = ActiveSupport::Logger::Formatter.new
# require 'syslog/logger'
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
if ENV["RAILS_LOG_TO_STDOUT"].present?
logger = ActiveSupport::Logger.new(STDOUT)
logger.formatter = config.log_formatter
config.logger = ActiveSupport::TaggedLogging.new(logger)
end
config.active_record.dump_schema_after_migration = false
Elasticsearch::Model.client = Elasticsearch::Client.new host: ENV['SEARCHBOX_SSL_URL']
end
如您所见,我最初尝试从机密文件访问环境变量(其中包含环境变量名称并返回 Heroku 的配置设置,但此后尝试将变量直接添加到配置文件本身。推送然而,这些对 Heroku 的新更改并没有产生太大的影响。
config/initializers/devise.rb
Devise.setup do |config|
config.mailer_sender = ENV["MAILER_FROM"]
config.mailer = 'Devise::Mailer'
config.parent_mailer = 'ActionMailer::Base'
require 'devise/orm/active_record'
config.authentication_keys = [:email]
config.strip_whitespace_keys = [:email]
config.http_authenticatable = false
config.skip_session_storage = [:http_auth]
config.stretches = Rails.env.test? ? 1 : 11
config.confirmation_keys = [:email]
config.password_length = 6..128
config.email_regexp = /\A[^@\s]+@[^@\s]+\z/
config.reset_password_within = 6.hours
config.sign_out_via = :delete
config.omniauth :twitter, ENV["TWITTER_APP_ID"], ENV["TWITTER_APP_SECRET"]# Rails.application.secrets.twitter_app_id, Rails.application.secrets.twitter_app_secret
config.omniauth :facebook, ENV["FACEBOOK_APP_ID"], ENV["FACEBOOK_APP_SECRET"]# Rails.application.secrets.facebook_app_id, Rails.application.secrets.facebook_app_secret
config.omniauth :instagram, ENV["INSTAGRAM_APP_ID"], ENV["INSTAGRAM_APP_SECRET"]# Rails.application.secrets.instagram_app_id, Rails.application.secrets.instagram_app_secret
end
设计路线
devise_scope :squatter do
devise_for :squatters, controllers: {
sessions: "squatters/sessions",
registrations: "squatters/registrations",
passwords: "squatters/passwords",
confirmations: "squatters/confirmations",
omniauth_callbacks: "squatters/omniauth_callbacks"
}
end
resources :squatters, only: [:index, :show] do
member do
get :submissions_pending_approval
end
resources :messages, except: [:destroy, :edit, :index]
end
为我使用的模型设计设置
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable,
:confirmable, :omniauthable, omniauth_providers: [:facebook, :twitter, :instagram]
我的大多数设计控制器在它们继承的控制器上调用 super。我唯一改变的是 Omniauth 那个。我主要只是在关注多个 omniauth 身份的教程 (sourcey.com/rails-4-omniauth-using-devise-with-twitter-facebook-and-linkedin),所以这可能是一个转移注意力的问题。
class Squatters::OmniauthCallbacksController < Devise::OmniauthCallbacksController
def self.provides_callback_for(provider)
class_eval %Q{
def #{provider}
@squatter = Squatter.find_for_oauth(env["omniauth.auth"], current_squatter)
if @squatter.persisted?
sign_in_and_redirect @squatter, event: :authentication
set_flash_message(:notice, :success, kind: "#{provider}".capitalize) if is_navigational_format?
else
session["devise.#{provider}_data"] = env["omniauth.auth"]
redirect_to new_squatter_registration_url
end
end
}
end
[:twitter, :facebook, :instagram].each do |provider|
provides_callback_for provider
end
def after_sign_in_path_for(resource)
if resource.email_verified?
super resource
else
finish_signup_path(resource)
end
end
end
如前所述,我尝试了 运行 heroku run rake db:migrate --app my_apps_name
并尝试了 运行 heroku restart --app my_apps_name
。有谁知道我是否遗漏了什么,或者这是否只是表明最新版本的 Devise 中存在错误?
嗨,你检查过你的 config/environments 文件夹了吗?你有 production.rb 和 development.rb 文件。当你安装设备时,你被要求在你的 development.rb 文件中包含这个 config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
,这是为了发送密码确认 link 和重置密码 link。
您是否将其包含在 production.rb 文件中?如果您在 heroku 上托管,它应该是您应用程序的 link。
请在您的 heroku 应用程序中尝试此配置。
config.action_mailer.default_url_options = { :host => 'myapp.herokuapp.com' }
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = false
config.action_mailer.default :charset => "utf-8"
config.action_mailer.smtp_settings = {
address: "smtp.gmail.com",
port: 587,
domain: "myapp.herokuapp.com",
authentication: "plain",
enable_starttls_auto: true,
user_name: ENV["GMAIL_USERNAME"],
password: ENV["GMAIL_PASSWORD"]
}
我的错误是由 Searchkick gem 引起的,它不适用于 Heroku 中的 Searchbox 插件的试用版。我只注意到当我尝试将 secret_key_base 环境变量添加到 Devise 的初始化程序文件时,当我尝试重置密码时开始在 Heroku 的日志中看到重建索引错误。注释掉我模型中的 searchkick
行解决了问题,我现在可以登录了,&c.
一时发疯,我决定制作一个 Rails 5 应用程序,它使用 Devise gem 和 Omniauth。一切似乎都在开发环境中工作(尽管我没有将它配置为从那里发送电子邮件......cukes 正在通过!=D)但是当我将它推送到 Heroku 并迁移时(甚至当我尝试重新启动 dyno ),我无法使用有效的电子邮件和密码登录(或通过 omniauth,但这是预料之中的),当我尝试注册时,帐户已创建,但从未发送过身份验证电子邮件。我无法重新发送确认电子邮件,当我尝试通过 Heroku 中的 rails 控制台确认现有帐户时,我无法在应用程序上使用忘记的密码 link 重置帐户密码。无论我做什么,我都会收到一般的 500 错误,建议我检查我的日志。据我所知,问题似乎出在 Devise 或 ActionMailer 上,因为网站的其余部分加载正确。
我已尝试在以下页面上更改我的 Gmail 设置:
Less Secure Apps (which I haven't had to use for my Rails 4 apps recently)
我已经尝试对配置文件等进行各种调整,但到目前为止没有任何效果。
Heroku 的日志(当我试图从网站发送忘记密码的电子邮件时)
2016-08-27T08:22:49.275213+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:232:in `block in conditional'
2016-08-27T08:22:49.275273+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:456:in `block in call'
2016-08-27T08:22:49.275332+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:456:in `call'
2016-08-27T08:22:49.275302+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:456:in `each'
2016-08-27T08:22:49.275656+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activerecord-5.0.0.1/lib/active_record/transactions.rb:334:in `rollback_active_record_state!'
2016-08-27T08:22:49.275713+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activerecord-5.0.0.1/lib/active_record/suppressor.rb:41:in `save'
2016-08-27T08:22:49.275774+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/bundler/gems/devise-4c3838bb759e/lib/devise/models/recoverable.rb:45:in `send_reset_password_instructions'
2016-08-27T08:22:49.275362+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:101:in `__run_callbacks__'
2016-08-27T08:22:49.275509+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/transaction.rb:202:in `within_new_transaction'
2016-08-27T08:22:49.275391+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:750:in `_run_commit_callbacks'
2016-08-27T08:22:49.275155+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:382:in `block in make_lambda'
2016-08-27T08:22:49.275420+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activerecord-5.0.0.1/lib/active_record/transactions.rb:354:in `committed!'
2016-08-27T08:22:49.275451+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/transaction.rb:87:in `commit_records'
2016-08-27T08:22:49.275684+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activerecord-5.0.0.1/lib/active_record/transactions.rb:318:in `save'
2016-08-27T08:22:49.276127+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:101:in `__run_callbacks__'
2016-08-27T08:22:49.276268+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
2016-08-27T08:22:49.275479+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/transaction.rb:178:in `commit_transaction'
2016-08-27T08:22:49.276857+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_controller/metal.rb:262:in `dispatch'
2016-08-27T08:22:49.276997+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/routing/mapper.rb:46:in `serve'
2016-08-27T08:22:49.275241+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:456:in `call'
2016-08-27T08:22:49.277110+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/routing/route_set.rb:725:in `call'
2016-08-27T08:22:49.277194+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/omniauth-1.3.1/lib/omniauth/strategy.rb:186:in `call!'
2016-08-27T08:22:49.277251+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/omniauth-1.3.1/lib/omniauth/strategy.rb:186:in `call!'
2016-08-27T08:22:49.277279+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/omniauth-1.3.1/lib/omniauth/strategy.rb:164:in `call'
2016-08-27T08:22:49.277307+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/warden-1.2.6/lib/warden/manager.rb:35:in `block in call'
2016-08-27T08:22:49.277447+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/rack-2.0.1/lib/rack/head.rb:12:in `call'
2016-08-27T08:22:49.277630+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:750:in `_run_call_callbacks'
2016-08-27T08:22:49.277658+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:90:in `run_callbacks'
2016-08-27T08:22:49.277856+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/tagged_logging.rb:70:in `block in tagged'
2016-08-27T08:22:49.278095+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/executor.rb:12:in `call'
2016-08-27T08:22:49.275538+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/database_statements.rb:232:in `transaction'
2016-08-27T08:22:49.275567+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activerecord-5.0.0.1/lib/active_record/transactions.rb:211:in `transaction'
2016-08-27T08:22:49.275597+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activerecord-5.0.0.1/lib/active_record/transactions.rb:392:in `with_transaction_returning_status'
2016-08-27T08:22:49.275859+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_controller/metal/basic_implicit_render.rb:4:in `send_action'
2016-08-27T08:22:49.275927+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_controller/metal/rendering.rb:30:in `process_action'
2016-08-27T08:22:49.276069+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:455:in `call'
2016-08-27T08:22:49.276211+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/abstract_controller/callbacks.rb:19:in `process_action'
2016-08-27T08:22:49.276296+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/notifications.rb:164:in `block in instrument'
2016-08-27T08:22:49.276800+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionview-5.0.0.1/lib/action_view/rendering.rb:30:in `process'
2016-08-27T08:22:49.277223+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/omniauth-1.3.1/lib/omniauth/strategy.rb:164:in `call'
2016-08-27T08:22:49.277587+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:97:in `__run_callbacks__'
2016-08-27T08:22:49.277799+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/rack/logger.rb:36:in `call_app'
2016-08-27T08:22:49.278008+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/rack-2.0.1/lib/rack/method_override.rb:22:in `call'
2016-08-27T08:22:49.278133+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/static.rb:136:in `call'
2016-08-27T08:22:49.275626+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activerecord-5.0.0.1/lib/active_record/transactions.rb:319:in `block in save'
2016-08-27T08:22:49.275743+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/bundler/gems/devise-4c3838bb759e/lib/devise/models/recoverable.rb:88:in `set_reset_password_token'
2016-08-27T08:22:49.275802+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/bundler/gems/devise-4c3838bb759e/lib/devise/models/recoverable.rb:119:in `send_reset_password_instructions'
2016-08-27T08:22:49.275901+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/abstract_controller/base.rb:188:in `process_action'
2016-08-27T08:22:49.275956+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/abstract_controller/callbacks.rb:20:in `block in process_action'
2016-08-27T08:22:49.275984+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:126:in `call'
2016-08-27T08:22:49.276012+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:126:in `call'
2016-08-27T08:22:49.276041+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:506:in `block (2 levels) in compile'
2016-08-27T08:22:49.276466+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activerecord-5.0.0.1/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
2016-08-27T08:22:49.277082+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/journey/router.rb:26:in `serve'
2016-08-27T08:22:49.277532+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/cookies.rb:613:in `call'
2016-08-27T08:22:49.277714+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
2016-08-27T08:22:49.278038+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/rack-2.0.1/lib/rack/runtime.rb:22:in `call'
2016-08-27T08:22:49.276098+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:455:in `call'
2016-08-27T08:22:49.276381+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_controller/metal/instrumentation.rb:30:in `process_action'
2016-08-27T08:22:49.276885+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/routing/route_set.rb:50:in `dispatch'
2016-08-27T08:22:49.277504+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/rack-2.0.1/lib/rack/session/abstract/id.rb:216:in `call'
2016-08-27T08:22:49.278267+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/puma-3.6.0/lib/puma/server.rb:415:in `process_client'
2016-08-27T08:22:49.276155+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:750:in `_run_process_action_callbacks'
2016-08-27T08:22:49.276239+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_controller/metal/rescue.rb:20:in `process_action'
2016-08-27T08:22:49.276437+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/searchkick-1.3.3/lib/searchkick/logging.rb:153:in `process_action'
2016-08-27T08:22:49.277025+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/journey/router.rb:39:in `block in serve'
2016-08-27T08:22:49.277391+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/rack-2.0.1/lib/rack/etag.rb:25:in `call'
2016-08-27T08:22:49.277884+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/tagged_logging.rb:26:in `tagged'
2016-08-27T08:22:49.278352+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/puma-3.6.0/lib/puma/thread_pool.rb:116:in `block in spawn_thread'
2016-08-27T08:22:49.276324+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
2016-08-27T08:22:49.276352+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/notifications.rb:164:in `instrument'
2016-08-27T08:22:49.276913+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/routing/route_set.rb:32:in `serve'
2016-08-27T08:22:49.276969+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/routing/mapper.rb:46:in `call'
2016-08-27T08:22:49.277743+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/debug_exceptions.rb:49:in `call'
2016-08-27T08:22:49.277828+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/rack/logger.rb:24:in `block in call'
2016-08-27T08:22:49.277914+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/tagged_logging.rb:70:in `tagged'
2016-08-27T08:22:49.277980+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/request_id.rb:24:in `call'
2016-08-27T08:22:49.278239+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/puma-3.6.0/lib/puma/server.rb:578:in `handle_request'
2016-08-27T08:22:49.276409+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_controller/metal/params_wrapper.rb:248:in `process_action'
2016-08-27T08:22:49.277560+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/callbacks.rb:38:in `block in call'
2016-08-27T08:22:49.277686+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/callbacks.rb:36:in `call'
2016-08-27T08:22:49.277167+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/omniauth-1.3.1/lib/omniauth/strategy.rb:164:in `call'
2016-08-27T08:22:49.277336+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/warden-1.2.6/lib/warden/manager.rb:34:in `catch'
2016-08-27T08:22:49.277953+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/rack/logger.rb:24:in `call'
2016-08-27T08:22:49.275829+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/bundler/gems/devise-4c3838bb759e/app/controllers/devise/passwords_controller.rb:13:in `create'
2016-08-27T08:22:49.276184+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:90:in `run_callbacks'
2016-08-27T08:22:49.277054+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/journey/router.rb:26:in `each'
2016-08-27T08:22:49.277139+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/omniauth-1.3.1/lib/omniauth/strategy.rb:186:in `call!'
2016-08-27T08:22:49.277419+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/rack-2.0.1/lib/rack/conditional_get.rb:38:in `call'
2016-08-27T08:22:49.276773+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/abstract_controller/base.rb:126:in `process'
2016-08-27T08:22:49.276828+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_controller/metal.rb:190:in `dispatch'
2016-08-27T08:22:49.276941+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/routing/mapper.rb:16:in `block in <class:Constraints>'
2016-08-27T08:22:49.277364+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/warden-1.2.6/lib/warden/manager.rb:34:in `call'
2016-08-27T08:22:49.277475+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/rack-2.0.1/lib/rack/session/abstract/id.rb:222:in `context'
2016-08-27T08:22:49.277771+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
2016-08-27T08:22:49.278067+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
2016-08-27T08:22:49.278154+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/rack-2.0.1/lib/rack/sendfile.rb:111:in `call'
2016-08-27T08:22:49.278184+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/engine.rb:522:in `call'
2016-08-27T08:22:49.278211+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/puma-3.6.0/lib/puma/configuration.rb:225:in `call'
2016-08-27T08:22:49.278324+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/puma-3.6.0/lib/puma/thread_pool.rb:116:in `call'
2016-08-27T08:22:49.278296+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/puma-3.6.0/lib/puma/server.rb:275:in `block in run'
我当前的 Gemfile
source 'https://rubygems.org'
gem 'rails', '~> 5.0.0', '>= 5.0.0.1'
gem 'pg', '~> 0.18'
gem 'puma', '~> 3.0'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
gem 'redis', '~> 3.0'
# Use ActiveModel has_secure_password
gem 'bcrypt', '~> 3.1.7'
gem 'jquery-rails'
gem 'sprockets', '>=3.0.0.beta'
#gem 'sprockets-es6'
gem 'haml'
gem 'nokogiri'
gem 'devise', git: 'https://github.com/plataformatec/devise.git', branch: 'master'
gem 'omniauth'
gem 'omniauth-facebook'
gem 'omniauth-twitter'
gem 'omniauth-instagram'
gem 'cancancan'
gem 'figaro'
gem 'humanize_boolean'
gem 'carrierwave', git: 'https://github.com/carrierwaveuploader/carrierwave'
gem 'mini_magick', '~> 3.8.0'
gem 'fog'
gem 'geocoder'
gem 'elasticsearch-model', git: 'https://github.com/elasticsearch/elasticsearch-rails.git'
gem 'elasticsearch-rails', git: 'https://github.com/elasticsearch/elasticsearch-rails.git'
gem 'searchkick'
gem 'cocoon'
gem 'owlcarousel-rails'
# Use Capistrano for deployment
gem 'capistrano-rails', group: :development
group :test do
gem 'selenium-webdriver'
end
group :development, :test do
gem 'pry-byebug', platform: :mri
gem 'rspec-rails'
gem 'simplecov'
gem 'factory_girl_rails'
gem 'launchy'
gem 'cucumber-rails', :require => false
gem 'database_cleaner'
gem 'faker'
gem 'rails-controller-testing'
gem 'capybara'
gem 'jasmine'
end
group :development do
gem 'web-console'
gem 'listen', '~> 3.0.5'
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
group :production do
gem 'rails_12factor'
gem 'aws-sdk'
end
config/environments/production.rb
Rails.application.configure do
config.cache_classes = true
config.eager_load = true
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
config.assets.js_compressor = :uglifier
config.assets.compile = true
config.log_level = :debug
config.log_tags = [ :request_id ]
config.action_mailer.perform_caching = false
config.action_mailer.raise_delivery_errors = false
config.action_mailer.default_url_options = {
host: ENV["MAILER_HOST"], #Rails.application.secrets.mailer_host,
from: ENV["MAILER_FROM"]#Rails.application.secrets.mailer_from
}
Rails.application.routes.default_url_options[:host] = ENV["MAILER_HOST"]#Rails.application.secrets.mailer_host
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
config.action_mailer.smtp_settings = {
address: "smtp.gmail.com",
port: 587,
domain: ENV["GMAIL_DOMAIN"],#Rails.application.secrets.gmail_domain,
authentication: :plain,
enable_starttls_auto: true,
user_name: ENV["GMAIL_USERNAME"],#Rails.application.secrets.gmail_username,
password: ENV["GMAIL_PASSWORD"]#Rails.application.secrets.gmail_password
}
config.i18n.fallbacks = true
config.active_support.deprecation = :notify
config.log_formatter = ActiveSupport::Logger::Formatter.new
# require 'syslog/logger'
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
if ENV["RAILS_LOG_TO_STDOUT"].present?
logger = ActiveSupport::Logger.new(STDOUT)
logger.formatter = config.log_formatter
config.logger = ActiveSupport::TaggedLogging.new(logger)
end
config.active_record.dump_schema_after_migration = false
Elasticsearch::Model.client = Elasticsearch::Client.new host: ENV['SEARCHBOX_SSL_URL']
end
如您所见,我最初尝试从机密文件访问环境变量(其中包含环境变量名称并返回 Heroku 的配置设置,但此后尝试将变量直接添加到配置文件本身。推送然而,这些对 Heroku 的新更改并没有产生太大的影响。
config/initializers/devise.rb
Devise.setup do |config|
config.mailer_sender = ENV["MAILER_FROM"]
config.mailer = 'Devise::Mailer'
config.parent_mailer = 'ActionMailer::Base'
require 'devise/orm/active_record'
config.authentication_keys = [:email]
config.strip_whitespace_keys = [:email]
config.http_authenticatable = false
config.skip_session_storage = [:http_auth]
config.stretches = Rails.env.test? ? 1 : 11
config.confirmation_keys = [:email]
config.password_length = 6..128
config.email_regexp = /\A[^@\s]+@[^@\s]+\z/
config.reset_password_within = 6.hours
config.sign_out_via = :delete
config.omniauth :twitter, ENV["TWITTER_APP_ID"], ENV["TWITTER_APP_SECRET"]# Rails.application.secrets.twitter_app_id, Rails.application.secrets.twitter_app_secret
config.omniauth :facebook, ENV["FACEBOOK_APP_ID"], ENV["FACEBOOK_APP_SECRET"]# Rails.application.secrets.facebook_app_id, Rails.application.secrets.facebook_app_secret
config.omniauth :instagram, ENV["INSTAGRAM_APP_ID"], ENV["INSTAGRAM_APP_SECRET"]# Rails.application.secrets.instagram_app_id, Rails.application.secrets.instagram_app_secret
end
设计路线
devise_scope :squatter do
devise_for :squatters, controllers: {
sessions: "squatters/sessions",
registrations: "squatters/registrations",
passwords: "squatters/passwords",
confirmations: "squatters/confirmations",
omniauth_callbacks: "squatters/omniauth_callbacks"
}
end
resources :squatters, only: [:index, :show] do
member do
get :submissions_pending_approval
end
resources :messages, except: [:destroy, :edit, :index]
end
为我使用的模型设计设置
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable,
:confirmable, :omniauthable, omniauth_providers: [:facebook, :twitter, :instagram]
我的大多数设计控制器在它们继承的控制器上调用 super。我唯一改变的是 Omniauth 那个。我主要只是在关注多个 omniauth 身份的教程 (sourcey.com/rails-4-omniauth-using-devise-with-twitter-facebook-and-linkedin),所以这可能是一个转移注意力的问题。
class Squatters::OmniauthCallbacksController < Devise::OmniauthCallbacksController
def self.provides_callback_for(provider)
class_eval %Q{
def #{provider}
@squatter = Squatter.find_for_oauth(env["omniauth.auth"], current_squatter)
if @squatter.persisted?
sign_in_and_redirect @squatter, event: :authentication
set_flash_message(:notice, :success, kind: "#{provider}".capitalize) if is_navigational_format?
else
session["devise.#{provider}_data"] = env["omniauth.auth"]
redirect_to new_squatter_registration_url
end
end
}
end
[:twitter, :facebook, :instagram].each do |provider|
provides_callback_for provider
end
def after_sign_in_path_for(resource)
if resource.email_verified?
super resource
else
finish_signup_path(resource)
end
end
end
如前所述,我尝试了 运行 heroku run rake db:migrate --app my_apps_name
并尝试了 运行 heroku restart --app my_apps_name
。有谁知道我是否遗漏了什么,或者这是否只是表明最新版本的 Devise 中存在错误?
嗨,你检查过你的 config/environments 文件夹了吗?你有 production.rb 和 development.rb 文件。当你安装设备时,你被要求在你的 development.rb 文件中包含这个 config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
,这是为了发送密码确认 link 和重置密码 link。
您是否将其包含在 production.rb 文件中?如果您在 heroku 上托管,它应该是您应用程序的 link。
请在您的 heroku 应用程序中尝试此配置。
config.action_mailer.default_url_options = { :host => 'myapp.herokuapp.com' }
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = false
config.action_mailer.default :charset => "utf-8"
config.action_mailer.smtp_settings = {
address: "smtp.gmail.com",
port: 587,
domain: "myapp.herokuapp.com",
authentication: "plain",
enable_starttls_auto: true,
user_name: ENV["GMAIL_USERNAME"],
password: ENV["GMAIL_PASSWORD"]
}
我的错误是由 Searchkick gem 引起的,它不适用于 Heroku 中的 Searchbox 插件的试用版。我只注意到当我尝试将 secret_key_base 环境变量添加到 Devise 的初始化程序文件时,当我尝试重置密码时开始在 Heroku 的日志中看到重建索引错误。注释掉我模型中的 searchkick
行解决了问题,我现在可以登录了,&c.