设计重置密码令牌不能为空

时间:2022-11-21 00:17:16

I'm trying to debut the error "Reset password token can't be blank" in my rails app when trying to reset a password. I've received an email in my console with a link to reset my password. When I pull up the link and enter my new password, I get the error "Reset password token can't be blank"

当我尝试重置密码时,我正在尝试在我的rails应用程序中首次出现“重置密码令牌不能为空”的错误。我在我的控制台中收到一封邮件,里面有一个重置密码的链接。当我打开链接并输入新密码时,我得到了错误“重置密码令牌不能为空”

Why am I getting this error and how can I fix it? I'm using devise-basecamper gem as well

我为什么会得到这个错误,我该怎么修正呢?我也在使用devise-basecamper gem

Let me know if there's anything else I can post that is helpful.

如果有什么我可以张贴的有用的东西,请告诉我。

Started GET "/users/password/new" for 127.0.0.1 at 2014-01-08 22:43:09 -0600
Processing by Devise::PasswordsController#new as HTML
  Account Load (0.3ms)  SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`subdomain` = 'mysubdomain' LIMIT 1
  Company Load (0.2ms)  SELECT `companies`.* FROM `companies` WHERE `companies`.`account_id` = 1 LIMIT 1
   (0.3ms)  SELECT COUNT(*) FROM `applicants` WHERE `applicants`.`company_id` = 1 AND (viewed = false and archived = false and submitted = true)
  Rendered devise/passwords/new.html.erb within layouts/session (17.5ms)
Completed 200 OK in 808ms (Views: 309.2ms | ActiveRecord: 44.8ms)
Wed, 15 Jan 2014 19:04:50 CST -06:00
Wed, 08 Jan 2014 22:43:17 CST -06:00


Started POST "/users/password" for 127.0.0.1 at 2014-01-08 22:43:17 -0600
Processing by Devise::PasswordsController#create as HTML
  Parameters: {"utf8"=>"✓", "authenticity_token"=>"96PTbxVrxaQWiXh6QXGZUyRe/7J/lLQo4hbASED1Mrs=", "user"=>{"email"=>"support@example.com", "subdomain"=>"mysubdomain"}, "submit"=>"Send me reset password instructions"}
  Account Load (0.3ms)  SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`subdomain` = 'mysubdomain' LIMIT 1
  Company Load (0.3ms)  SELECT `companies`.* FROM `companies` WHERE `companies`.`account_id` = 1 LIMIT 1
   (0.4ms)  SELECT COUNT(*) FROM `applicants` WHERE `applicants`.`company_id` = 1 AND (viewed = false and archived = false and submitted = true)
  CACHE (0.0ms)  SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`subdomain` = 'mysubdomain' LIMIT 1
  User Load (0.5ms)  SELECT `users`.* FROM `users` WHERE `users`.`account_id` = 1 AND `users`.`email` = 'support@example.com' LIMIT 1
  Account Load (0.3ms)  SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 1 LIMIT 1
  Rendered devise/mailer/reset_password_instructions.html.erb (23.9ms)

Sent mail to support@example.com (32ms)
Date: Wed, 08 Jan 2014 22:43:18 -0600
From: support@example.com
Reply-To: support@example.com
To: support@example.com
Message-ID: <52ce28e64d967_87e73fda575bea4889930@Toms-Mac-mini.local.mail>
Subject: Reset password instructions
Mime-Version: 1.0
Content-Type: text/html;
 charset=UTF-8
Content-Transfer-Encoding: 7bit

<p>Hello support@example.com!</p>

<p>Someone has requested a link to change your password, and you can do this through the link below.</p>

<p><a href="http://mysubdomain.127.0.0.1.xip.io:3000/users/password/edit?reset_password_token=wHnYjLtLtXfU8FButP3p">Change my password</a></p>

<p>If you didn't request this, please ignore this email.</p>
<p>Your password won't change until you access the link above and create a new one.</p>

Redirected to http://mysubdomain.127.0.0.1.xip.io:3000/login
Completed 302 Found in 536ms (ActiveRecord: 0.0ms)
Wed, 15 Jan 2014 19:04:50 CST -06:00
Wed, 08 Jan 2014 22:43:18 CST -06:00


Started GET "/login" for 127.0.0.1 at 2014-01-08 22:43:18 -0600
Processing by Devise::SessionsController#new as HTML
  Account Load (0.3ms)  SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`subdomain` = 'mysubdomain' LIMIT 1
  Company Load (0.2ms)  SELECT `companies`.* FROM `companies` WHERE `companies`.`account_id` = 1 LIMIT 1
   (0.3ms)  SELECT COUNT(*) FROM `applicants` WHERE `applicants`.`company_id` = 1 AND (viewed = false and archived = false and submitted = true)
  Rendered shared/_messages.html.erb (1.2ms)
  Rendered devise/sessions/new.html.erb within layouts/session (13.3ms)
Completed 200 OK in 28ms (Views: 22.1ms | ActiveRecord: 0.9ms)
Wed, 15 Jan 2014 19:04:50 CST -06:00
Wed, 08 Jan 2014 22:43:28 CST -06:00


Started GET "/users/password/edit?reset_password_token=[FILTERED]" for 127.0.0.1 at 2014-01-08 22:43:28 -0600
Processing by Devise::PasswordsController#edit as HTML
  Parameters: {"reset_password_token"=>"[FILTERED]"}
  Account Load (0.3ms)  SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`subdomain` = 'mysubdomain' LIMIT 1
  Company Load (0.3ms)  SELECT `companies`.* FROM `companies` WHERE `companies`.`account_id` = 1 LIMIT 1
   (0.7ms)  SELECT COUNT(*) FROM `applicants` WHERE `applicants`.`company_id` = 1 AND (viewed = false and archived = false and submitted = true)
  Rendered devise/passwords/edit.html.erb within layouts/session (1.8ms)
Completed 200 OK in 36ms (Views: 29.0ms | ActiveRecord: 1.3ms)
Wed, 15 Jan 2014 19:04:50 CST -06:00
Wed, 08 Jan 2014 22:43:39 CST -06:00


Started PUT "/users/password" for 127.0.0.1 at 2014-01-08 22:43:39 -0600
Processing by Devise::PasswordsController#update as HTML
  Parameters: {"utf8"=>"✓", "authenticity_token"=>"96PTbxVrxaQWiXh6QXGZUyRe/7J/lLQo4hbASED1Mrs=", "user"=>{"password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]"}, "submit"=>"Change my Password"}
  Account Load (0.4ms)  SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`subdomain` = 'mysubdomain' LIMIT 1
  Company Load (0.3ms)  SELECT `companies`.* FROM `companies` WHERE `companies`.`account_id` = 1 LIMIT 1
   (0.4ms)  SELECT COUNT(*) FROM `applicants` WHERE `applicants`.`company_id` = 1 AND (viewed = false and archived = false and submitted = true)
  Rendered devise/passwords/edit.html.erb within layouts/session (2.8ms)
Completed 200 OK in 39ms (Views: 27.9ms | ActiveRecord: 0.0ms)

1 个解决方案

#1


7  

Did you get a link like this?

你有这样的链接吗?

http://localhost.com/users/password/edit?reset_password_token=GVN7DnKTVVsE15gMXaFb (remove .com)

http://localhost.com/users/password/edit?reset_password_token = GVN7DnKTVVsE15gMXaFb(删除。com)

See the reset_password_token in the query parameter?

在查询参数中看到reset_password_token吗?

Also in your set password page, make sure you have line like this

同样,在设置密码页面中,请确保有如下一行

<input class="hidden" id="user_reset_password_token" name="user[reset_password_token]" type="hidden" value="GVN7DnKTVVsE15gMXaFb" />

#1


7  

Did you get a link like this?

你有这样的链接吗?

http://localhost.com/users/password/edit?reset_password_token=GVN7DnKTVVsE15gMXaFb (remove .com)

http://localhost.com/users/password/edit?reset_password_token = GVN7DnKTVVsE15gMXaFb(删除。com)

See the reset_password_token in the query parameter?

在查询参数中看到reset_password_token吗?

Also in your set password page, make sure you have line like this

同样,在设置密码页面中,请确保有如下一行

<input class="hidden" id="user_reset_password_token" name="user[reset_password_token]" type="hidden" value="GVN7DnKTVVsE15gMXaFb" />