0
나는 간단한 응용 프로그램을 가지고 있지만 사용자 데이터의 기밀에 대해 신경을 쓰고 있습니다. 이 유형의 확인을 사용해도 안전합니까?레일 : before_filter의이 스타일을 사용하는 것이 안전합니다.
before_filter :authenticate, :only => [:show, :edit, :update]
before_filter :correct_user, :only => [:show, :edit, :update]
def authenticate
redirect_to(root_path) unless !current_user.nil?
end
def correct_user
redirect_to(root_path) unless current_user == User.find(params[:id])
end
감사합니다. 나는 railscasts'270 (http://railscasts.com/episodes/270-authentication-in-rails-3-1)에서 인증 방법을 가지고있다. 나는 희망이있다, 그것은 나쁜 해결책이 아니다 :) –
물론, 그게 나쁜 해결책이 아니야. 관심이 있으시면 칸칸을 보시기 바랍니다. Railan을하는 동일한 녀석 Ryan Bates에 의해 써진 그것. –