Rails 5.1.4
ruby 2.5.0
authlogic 3.8.0
Nginx + puma
authlogic
を使って認証処理を実装しています。
自分の開発環境(vagrant+VirtualBox+CentOS7.2
)では正常にログアウトされますが、
AWS上の検証環境でChrome
,Opera
の時はログアウトされません。
ログアウトボタンを押下後、URL直打ちでログイン後のアドレスにアクセスすると
ログイン画面にリダイレクトされず、アクセスできてしまいます。
(FireFox, Edge, IEではログアウトされます)
ローカルのRAILS_ENV
をproduction
、nginx + puma
にして試してみましたが、
やはり正常にログアウトが行われます。
お知恵を拝借できますと幸いです。
どうぞよろしくお願い致します。
ruby
1class UserSessionsController < ApplicationController 2 protect_from_forgery :except => [:create] 3 4 def create 5 @user_session = UserSession.new(user_session_params) 6 if @user_session.save 7 redirect_to hoge_path 8 else 9 render :action => :index 10 end 11 end 12 13 def destroy 14 current_user_session.destroy 15 redirect_to root_path 16 end 17end
ruby
1class ApplicationController < ActionController::Base 2 protect_from_forgery with: :exception 3 helper_method :current_user_session, :current_user 4 5 private 6 def current_user_session 7 return @current_user_session if defined?(@current_user_session) 8 @current_user_session = UserSession.find 9 end 10 11 def current_user 12 return @current_user if defined?(@current_user) 13 @current_user = current_user_session && current_user_session.user 14 end 15end
ruby
1class UserSession < Authlogic::Session::Base 2 httponly true 3 secure true 4end 5
ruby
1class User < ApplicationRecord 2 acts_as_authentic do |c| 3 c.session_class = UserSession 4 end 5end
回答1件
あなたの回答
tips
プレビュー