2012-08-31 5 views
2

게시 할 때 세션 변수 중 하나가 IE에서 손실됩니다.Internet Explorer에서 Sinatra 세션이 손실 됨

이 웹 앱은 Chrome과 Firefox에서 완벽하게 작동합니다. 사용자가 세션 변수를 로그인하면

: 여기

def xml_file_to_use 
    groups = allowed_groups 
    #Which xml file should I write to 
    if (session[:location_group].include? allowed_groups[0]) <----Line 19 
    ...... 
end 

는 설명 내 코드입니다 : 여기
NoMethodError at/

undefined method `include?' for nil:NilClass 
file: welcometo.rb 
location: xml_file_to_use 
line: 19 

오류 방법입니다 : 여기

오류입니다 설정됩니다 :

#Check to see if the user is authorized 
auth_token = Adauth.authenticate(params[:user], params[:password]) 
if auth_token 
    session[:user] = params[:user] 
    session[:first_name] = auth_token.first_name.tr('/"[]', '') 
    session[:location_group] = (auth_token.groups & allowed_groups) 
    redirect '/' 
else 
    redirect '/login' 
end 
(210)

다음 나는이 세션 값에 따라 변수를 설정 :

get '/' do 
    if session["user"] != nil 
    @first_name = session[:first_name] 
    @groups = session[:groups] 
    @xml_file = xml_file_to_use 
    @location = location 
    erb :form 
    else 
    redirect '/login' 
    end 

end 

이 부분은 잘 작동합니다. 내보기에서 @location 변수를 사용하기 때문에 알 수 있습니다.

#Setup Location Variable 
def location 
    if (session[:location_group].include? allowed_groups[0]) <-- This same code errors during a post in IE 
    return 'Eagan' 
    else 
    return 'Chicago' 
    end 
end 
+1

이 랙 생산에 버그를 추적하는 것으로 알려져 하드입니다 : 링크에서

그는 내 welcome.rb 파일의 상단에이 퍼팅이 문제를 해결 발견 기록했다. (Un) 다행스럽게도 그것은 매우 자주 나타나지 않습니다. 토론에 참여하십시오 : https://github.com/rkh/rack-protection/issues/11 –

답변

0

콘스탄틴 하제이 버그 있어야 정확한지 : 여기

는 위치 결정 방법이다.

set :protection, except: :session_hijacking 
관련 문제