나는 다음과 같은 오류 받고 있어요 그러나 after_sign_in_path 오류를 고안 : 필터 체인은 중단 : require_no_authentication
로그인 후 현재 페이지로 사용자를 리디렉션하기 위해 고안 위키 다음 해요 : 을Started GET "/login" for 127.0.0.1 at 2014-05-12 18:52:52 -0300
Processing by Devise::SessionsController#new as HTML
←[1m←[35mUser Load (3.0ms)←[0m SELECT "users".* FROM "users" WHERE "users"."id" = 3 ORDER BY "users"."id" ASC LIMIT 1
Redirected to http://localhost:3000/login
Filter chain halted as :require_no_authentication rendered or redirected
Completed 302 Found in 8ms (ActiveRecord: 3.0ms)
이 내 응용 프로그램 컨트롤러에있는 코드입니다 :
after_filter :store_location
def store_location
# store last url - this is needed for post-login redirect to whatever the user last visited.
if (request.fullpath != "https://stackoverflow.com/users/sign_in" &&
request.fullpath != "https://stackoverflow.com/users/sign_up" &&
request.fullpath != "https://stackoverflow.com/users/password" &&
!request.fullpath.match("/users") &&
!request.xhr? && # don't store ajax calls
request.format == "text/html" || request.content_type == "text/html")
session[:previous_url] = request.fullpath
session[:last_request_time] = Time.now.utc.to_i
end
end
def after_sign_in_path_for(resource)
session[:previous_url] || root_path
end
어떤 생각이 왜 이런 일이 일어나고 있는가? 감사합니다
routes.rb
Myapp::Application.routes.draw do
ActiveAdmin.routes(self)
devise_for :users, :controllers => { :omniauth_callbacks => "users/omniauth_callbacks", :registrations => "registrations" }, :skip => [:sessions]
as :user do
get 'login' => 'devise/sessions#new', :as => :new_user_session
post 'login' => 'devise/sessions#create', :as => :user_session
delete 'logout' => 'devise/sessions#destroy', :as => :destroy_user_session
end
root 'static_pages#home'
devise.rb
Devise.setup do |config|
config.secret_key = ENV['DEVISE_SECRET_KEY']
require 'devise/orm/active_record'
# omniauth login
require "omniauth-facebook"
config.omniauth :facebook, ENV["APP_ID"], ENV["APP_SECRET"],
{:scope => 'email, offline_access, user_events, friends_events', :client_options => {:ssl => {:ca_file => '/usr/lib/ssl/certs/ca-certificates.crt'}}}
# add username to login
config.authentication_keys = [ :login ]
config.reset_password_keys = [ :email ]
config.confirmation_keys = [ :login ]
config.case_insensitive_keys = [ :email ]
config.strip_whitespace_keys = [ :email ]
config.skip_session_storage = [:http_auth]
config.stretches = Rails.env.test? ? 1 : 10
config.reconfirmable = false
config.password_length = 8..128
config.reset_password_within = 6.hours
config.sign_out_via = :delete
end
'routes.rb' 파일과'devise.rb' 파일을 게시 할 수 있습니까? –
방금 질문을 편집했습니다. 감사합니다. –