简体   繁体   English

ActionController :: UnknownFormat设计确认

[英]ActionController::UnknownFormat Devise Confirmation

Whenever I have a user that has not confirmed their account, if I click on "Resend Confirmation Instructions" after putting in the correct email address, an email gets successfully sent (in development anyway) and then I get this error message: 每当我有一个尚未确认其帐户的用户时,如果在输入正确的电子邮件地址后单击“重新发送确认说明”,则会成功发送一封电子邮件(无论如何仍在开发中),然后会出现以下错误消息:

ActionController::UnknownFormat at /users/confirmation.user
ActionController::UnknownFormat

At this URL: 在此URL:

http://localhost:3000/users/confirmation.user

Here is my ConfirmationsController 这是我的ConfirmationsController

class ConfirmationsController < Devise::ConfirmationsController
  private
  def after_confirmation_path_for(resource_name, resource)
    new_session_path(resource_name)
  end
end

Here is the log for the entire event: 这是整个事件的日志:

Started POST "/users/confirmation.user" for 127.0.0.1 at 2014-12-28 19:23:23 -0500
Processing by ConfirmationsController#create as 
  Parameters: {"utf8"=>"✓", "authenticity_token"=>"SaKoS0Xo3PEkPLDRGt0s1dDsFL3sWIGAS6TZ69bhF4E=", "user"=>{"email"=>"xyz@test.com"}, "commit"=>"Resend confirmation instructions"}
  User Load (3.6ms)  SELECT  "users".* FROM "users"  WHERE "users"."email" = 'xyz@test.com'  ORDER BY "users"."id" ASC LIMIT 1
  User Load (0.7ms)  SELECT  "users".* FROM "users"  WHERE "users"."confirmation_token" = '03f1df6d19e7ca7f5b3f0789e159ba3b31b24895fffc6124def25467e901b5df'  ORDER BY "users"."id" ASC LIMIT 1
   (1.5ms)  BEGIN
  SQL (14.2ms)  UPDATE "users" SET "confirmation_sent_at" = $1, "confirmation_token" = $2, "updated_at" = $3 WHERE "users"."id" = 4  [["confirmation_sent_at", "2014-12-29 00:23:23.286698"], ["confirmation_token", "03f1df6d19e7ca7f5b3f0789e159ba3b31b24895fffc6124def25467e901b5df"], ["updated_at", "2014-12-29 00:23:23.296387"]]
   (1.5ms)  COMMIT
  Rendered devise/mailer/confirmation_instructions.html.erb (0.8ms)

Devise::Mailer#confirmation_instructions: processed outbound mail in 20.1ms

Sent mail to xyz@test.com (39.6ms)
Date: Sun, 28 Dec 2014 19:23:23 -0500
From: noreply@myapp
Reply-To: noreply@myapp
To: xyz@test.com
Message-ID: <54a09efb589ec_12f63fc655865be02817a@myputer.local.mail>
Subject: Welcome to My App! Please confirm your email address
Mime-Version: 1.0
Content-Type: text/html;
 charset=UTF-8
Content-Transfer-Encoding: 7bit

<center><img alt="Logo" height="50" src="http://someurl.com/assets/logo.png" width="153" /></center>

<p>Welcome to My App, xyz@test.com! Please confirm your email address by clicking the link below:</p>

<p><a href="http://localhost:3000/users/confirmation?confirmation_token=EXJkB4sZxP18m2sVQyBQ">Confirm my account</a></p>

<p>Once you confirm, you are welcomed to join the community by sharing, reading and commenting on the breaking news that matters to you.</p>

<p>Best regards,
My App</p>
Completed 406 Not Acceptable in 161ms

ActionController::UnknownFormat - ActionController::UnknownFormat:

What could be causing this? 是什么原因造成的?

Edit 1 编辑1

Please note that this error is NOT the same as other errors. 请注意,这个错误是一样的其他错误。 In this case, the email IS successfully sent. 在这种情况下,电子邮件已成功发送。 It is just the page/action that it is redirected to that generates the error. 只是页面/操作被重定向到它会产生错误。 THAT is the issue! 这就是问题! The issue IS NOT with what happens AFTER you press the link in the confirmations email that is sent to the user. 问题不在于您按下发送给用户的确认电子邮件中的链接之后发生的事情。 It is what happens to the Rails app AFTER the confirmation email is successfully sent. 成功发送确认电子邮件后,Rails应用程序会发生什么情况。 That is why I pasted the ConfirmationsController at the top of the question, because I suspect it is central to this issue. 这就是为什么我将ConfirmationsController粘贴在问题的顶部的原因,因为我怀疑它对于此问题很重要。

For re-sending the confirmation instructions ( Resend Confirmation Instructions ), what is the helper method you have used in your code? 要重新发送确认说明( Resend Confirmation Instructions ),您在代码中使用的帮助方法是什么?

It can be resolved in either of 2 solutions mentioned below: 可以通过以下两种解决方案之一解决该问题:

Solution 1: 解决方案1:

If you have used a similar one like below, please remove the parameter you have passed through it. 如果您使用了类似如下的参数,请删除通过它的参数。

As per the issue reported on Github ( https://github.com/plataformatec/devise/issues/2834 ): 根据Githubhttps://github.com/plataformatec/devise/issues/2834 )报告的问题:

In your confirmation email view you're probably passing a parameter to your url helper, something like this: 在确认电子邮件视图中,您可能正在将参数传递给url帮助器,如下所示:

user_confirmations_url(@some_variable)

That url does not require an argument and because you are sending one, it is being set as the url format instead of replacing a url parameter. 该url不需要参数,因为您正在发送一个参数,所以将其设置为url格式,而不是替换url参数。

Solution 2: 解决方案2:

Refer this link 引用此链接

Hope that helps :) 希望有帮助:)

暂无
暂无

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

相关问题 设计,ActionController :: UnknownFormat - Devise, ActionController::UnknownFormat Devise中的ActionController :: UnknownFormat ::在rails 4中的SessionsController#new - ActionController::UnknownFormat in Devise::SessionsController#new in rails 4 ActionController :: UnknownFormat(ActionController :: UnknownFormat) - ActionController::UnknownFormat (ActionController::UnknownFormat) Rails 4 - 设计:在注册时获取ActionController :: UnknownFormat - Rails 4 - Devise: getting ActionController::UnknownFormat on signup ActionController::UnknownFormat in RegistrationsController#create (Devise) - ActionController::UnknownFormat in RegistrationsController#create (Devise) 在没有电子邮件确认的情况下尝试登录时处理 Devise::SessionsController#new 错误中的 ActionController::UnknownFormat (Rails) - Handle ActionController::UnknownFormat in Devise::SessionsController#new error when try to login without E-mail confirmation (Rails) Rails 4设计3.1.1 ActionController :: Devise中的UnknownFormat :: RegistrationsController #new - Rails 4 Devise 3.1.1 ActionController::UnknownFormat in Devise::RegistrationsController#new ActionController::UnknownFormat (ActionController::UnknownFormat): 销毁 - ActionController::UnknownFormat (ActionController::UnknownFormat): on destroy 由于用户的 CRUD 实现,Devise::RegistrationsController#create 中的 ActionController::UnknownFormat - ActionController::UnknownFormat in Devise::RegistrationsController#create due to CRUD implementation of Users 新安装的Devise登录问题(RegistrationsController#create中的ActionController :: UnknownFormat) - Issues with Newly Installed Devise Login (ActionController::UnknownFormat in RegistrationsController#create)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM