简体   繁体   English

设计密码重置失败

[英]Devise Password Reset Failing

My Ruby on Rails application is using Devise to manage it's user logins etc.. 我的Ruby on Rails应用程序正在使用Devise来管理其用户登录名等。

I am currently having issues with the password reset feature. 我目前在密码重置功能方面遇到问题。 I have got it working perfectly fine on our local environment, but on the production server (on Heroku) it is failing. 我已经在我们的本地环境上使它运行良好,但是在生产服务器上(在Heroku上)却失败了。

A user can reset their password if they forget it, and the system is sending out the emails with the link to click to reset their password. 如果用户忘记了密码,可以重设密码,系统将发送带有链接的电子邮件,以单击以重设密码。

Once this link is clicked, they are successfully brought to the site and asked to enter in their new password and then confirm it. 单击此链接后,他们将被成功带入站点并要求输入新密码,然后进行确认。 The problem is once they save this password, the application fails with the standard "Application Error - An error occurred in the application and your page could not be loaded" 问题是一旦他们保存了该密码,应用程序就会失败,并显示标准的“应用程序错误-应用程序中发生错误,无法加载您的页面”

Looking at the heroku logs I can see the following 查看heroku日志,我可以看到以下内容

2014-05-30T12:38:15.373355+00:00 app[web.1]: Started PUT "/users/password" for xx.xxx.xxx.xxx at 2014-05-30 12:38:15 +0000
2014-05-30T12:38:15.377511+00:00 app[web.1]: Processing by Devise::PasswordsController#update as HTML
2014-05-30T12:38:15.377577+00:00 app[web.1]:   Parameters: {"utf8"=>"???", "authenticity_token"=>"3NjJhk3HcIgIkWy8hlmizOVTX5Wx3N9RgHmxwK5Evrg=", "user"=>{"reset_password_token"=>"[FILTERED]", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]"}, "commit"=>"Change my password"}
2014-05-30T12:38:31.727191+00:00 app[web.1]: E, [2014-05-30T12:38:31.726292 #2] ERROR -- : worker=0 PID:5 timeout (16s > 15s), killing
2014-05-30T12:38:31.797612+00:00 app[web.1]: E, [2014-05-30T12:38:31.797478 #2] ERROR -- : reaped #<Process::Status: pid 5 SIGKILL (signal
9)> worker=0
2014-05-30T12:38:31.800988+00:00 heroku[router]: at=error code=H13 desc="Connection closed without response" method=POST path=/users/password host=horsepip.com request_id=27d37c84-544f-4fe5-a12d-a7384dfb60c5 fwd="xx.xxx.xxx.xxx" dyno=web.1 connect=1ms service=16425ms status=503 bytes=0
2014-05-30T12:38:31.986995+00:00 heroku[router]: at=info method=GET path=/favicon.ico host=horsepip.com request_id=91e0f2a7-284a-4c85-a9e2-af3d404f1151 fwd="xx.xxx.xxx.xxx" dyno=web.1 connect=0ms service=2ms status=200 bytes=196
2014-05-30T12:38:32.312878+00:00 app[web.1]: I, [2014-05-30T12:38:32.312200 #1109]  INFO -- : worker=0 ready

What I can make out is that the servers worker is crashing, and looking up some of these errors I see they can be related to the Unicorn Gem (which we are using) 我可以确定的是,服务器工作程序崩溃了,在查找其中的一些错误时,我发现它们可能与Unicorn Gem有关(我们正在使用)

We are on the basic Heroku package at the moment as our production server does not have very many people using at the moment, but surely a simple password reset couldn't crash a worker? 目前,我们使用的是基本的Heroku软件包,因为我们的生产服务器目前没有太多人在使用,但是肯定的简单密码重置不会使工人崩溃吗?

I have tried changing a users password via a settings page whereby the user enters their current password, and then a new one, this saves fine without any issues. 我尝试通过设置页面更改用户密码,在该页面中,用户输入其当前密码,然后输入一个新密码,这样可以很好地保存一切。

Has anyone else ever had any issues with this? 有没有其他人对此有任何疑问?

Update With Logs in Debug mode 在调试模式下使用日志更新

2014-05-30T13:30:29.393026+00:00 app[web.1]: Processing by Devise::PasswordsController#update as HTML
2014-05-30T13:30:29.393096+00:00 app[web.1]:   Parameters: {"utf8"=>"???", "authenticity_token"=>"oj1WtMp7zU+5MRiCjdk47NeEwJYyZkB7w+FcTvgD1ik=", "user"=>{"reset_password_token"=>"[FILTERED]", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]"}, "commit"=>"Change my password"}
2014-05-30T13:30:29.389774+00:00 app[web.1]: Started PUT "/users/password" for xx.xxx.xx.xxx  at 2014-05-30 13:30:29 +0000
2014-05-30T13:30:30.045362+00:00 app[web.1]:   ←[1m←[36mUser Load (2.4ms)←[0m  ←[1mSELECT  "users".* FROM "users"  WHERE "users"."reset_password_token" = '0da2c26faa8c7a6a2935abf55b857590fdfc4b8bbb8ee90bfd5ad35c04f9e3ae'  ORDER BY "users"."id" ASC LIMIT 1←[0m
2014-05-30T13:30:30.136894+00:00 app[web.1]:   ←[1m←[36mSQL (1.7ms)←[0m  ←[1mUPDATE "users" SET "encrypted_password" = $1, "reset_password_sent_at" = $2, "reset_password_token" = $3, "updated_at" = $4 WHERE "users"."id" = 1←[0m  [["encrypted_password", "$2a$10$d2zQ6yuEb17QK2WtHmRk/ufQRhun1RO2ILJ16NJkL90T2JzbxciAq"], ["reset_password_sent_at", nil], ["reset_password_token", nil], ["updated_at", "2014-05-30 13:30:30.130959"]]
2014-05-30T13:30:30.130271+00:00 app[web.1]:   ←[1m←[35m (1.4ms)←[0m  BEGIN
2014-05-30T13:30:39.112542+00:00 app[web.1]:   ←[1m←[35m (6.9ms)←[0m  COMMIT
2014-05-30T13:30:39.159501+00:00 app[web.1]:   ←[1m←[35mSQL (5.3ms)←[0m  UPDATE "users" SET "current_sign_in_at" = $1, "last_sign_in_at" = $2, "reset_password_token" = $3, "sign_in_count" = $4, "updated_at" = $5 WHERE "users"."id" = 1  [["current_sign_in_at", "2014-05-30 13:30:39.133511"], ["last_sign_in_at", "2014-05-30 12:39:44.631269"], ["reset_password_token", "rZPXQ3r8D2easJmjzBox"], ["sign_in_count", 19], ["updated_at", "2014-05-30 13:30:39.147892"]]
2014-05-30T13:30:39.145115+00:00 app[web.1]:   ←[1m←[36m (5.0ms)←[0m  ←[1mBEGIN←[0m
2014-05-30T13:30:45.857557+00:00 app[web.1]: E, [2014-05-30T13:30:45.857376 #2] ERROR -- : worker=1 PID:8 timeout (16s > 15s), killing
2014-05-30T13:30:45.983703+00:00 app[web.1]: I, [2014-05-30T13:30:45.983379 #310]  INFO -- : worker=1 ready
2014-05-30T13:30:45.915630+00:00 app[web.1]: E, [2014-05-30T13:30:45.915530 #2] ERROR -- : reaped #<Process::Status: pid 8 SIGKILL (signal 9)> worker=1
2014-05-30T13:30:45.917905+00:00 heroku[router]: at=error code=H13 desc="Connection closed without response" method=POST path=/users/password host=xxxxx.com request_id=d7fb6561-950a-4dcb-8852-52c259985c99 fwd="78.16.33.137" dyno=web.1 connect=0ms service=16526ms status=503 bytes=0

Found out in the end that we had an intensive cropping of images set to take place each time a users profile was updated. 最终发现,每次用户配置文件更新时,我们都会对图像进行大量裁剪。 Updating the password triggered the cropping of these images and caused the workers to fail 更新密码会触发这些图像的裁剪并导致工作人员失败

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

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