このconfig.allow_insecure_sign_in_after_confirmation
フラグは Devise ではサポートされなくなりました。
ユーザーがアカウントを確認したときに自動的にログインすることで発生する可能性のあるセキュリティ上の問題に注意する必要があります ( http://blog.plataformatec.com.br/2013/08/devise-3-1-now-with-more-secure -defaults/ )、一部のアプリでは、ユーザー エクスペリエンスの面での利点は、セキュリティのトレードオフに値する場合があります。
結局のところ、セキュリティ リスクは、a) ユーザーが電子メールを間違って入力する、b) ユーザーが間違いをすぐに修正しない、c) 入力した電子メールが有効で有効な電子メールに対応している、d) 間違って受信した人である、ということです。メールが開き、リンクをクリックします。
これがアプリケーションの許容可能なリスク プロファイルである場合は、デバイスの ConfirmationsController をオーバーライドできます。
class ConfirmationsController < Devise::ConfirmationsController
def show
self.resource = resource_class.confirm_by_token(params[:confirmation_token])
yield resource if block_given?
if resource.errors.empty?
set_flash_message(:notice, :confirmed) if is_flashing_format?
sign_in(resource) # <= THIS LINE ADDED
respond_with_navigational(resource){ redirect_to after_confirmation_path_for(resource_name, resource) }
else
respond_with_navigational(resource.errors, :status => :unprocessable_entity){ render :new }
end
end
end
そしてあなたの中でそれにルーティングしますroutes.rb
:
devise_for :users, controllers: { confirmations: 'confirmations' }