を使用して Devise 3.2.2 を使用する Rails 4 アプリがあり、:confirmable
無効な確認トークンを送信するという問題が発生していますが、初回のみです。確認トークンを再送信すると、リンクが機能します。
関連するルート:
devise_for :users, skip: [:sessions, :passwords, :confirmations, :unlocks, :registrations, :invitations]
as :user do
...
# joining
get '/register' => 'devise/registrations#new', as: 'new_user_registration'
post '/register' => 'devise/registrations#create', as: 'user_registration'
...
end
...そして問題のメールテンプレート:
<p>Welcome <%= @email %>!</p>
<p>You can confirm your account email through the link below:</p>
<p><%= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @token) %></p>
私が知る限り、すべてがかなり標準的な料金であり、再送信ではなく最初の作成時にのみ失敗するという事実は、かなり混乱しています.
- アップデート -
リンクをクリックすると、開発ログに次のように表示されます。
Started GET "/account/confirm?confirmation_token=3bQP-EvYJPv74s9AMz63" for 127.0.0.1 at 2014-02-07 12:26:10 -0500
Processing by Users::ConfirmationsController#show as HTML
Parameters: {"confirmation_token"=>"3bQP-EvYJPv74s9AMz63"}
User Load (0.4ms) SELECT "users".* FROM "users" WHERE "users"."confirmation_token" = 'e191b48746f15014beb32073f08de3c7aa13a2282216f089fa71d083901b3dca' ORDER BY "users"."id" ASC LIMIT 1
Rendered devise/shared/_links.slim (1.2ms)
Rendered devise/confirmations/new.html.slim within layouts/devise (7.0ms)
Rendered layouts/_jquery.slim (1.0ms)
Completed 200 OK in 32ms (Views: 23.4ms | ActiveRecord: 0.4ms)
参照されるコントローラーは次のとおりです。
class Users::ConfirmationsController < Devise::ConfirmationsController
protected
def after_confirmation_path_for(resource_name, resource)
if signed_in?
signed_in_root_path(resource)
else
new_session_path(resource_name, email: resource.email)
end
end
end
-- 更新 2 --
以下は、サインアップ プロセス全体のログの要点です: https://gist.github.com/jbender/bbe079c2dd3fa2d1e664