Goify在Rails中被http_basic_authentication阻止

时间:2010-09-07 20:38:16

标签: ruby-on-rails authentication uploadify

我让uploadify与我没有任何身份验证的模型一起正常工作。 问题是,用户需要在他/她可以上传文件之前进行身份验证。 当我启用之前的过滤器时,文件不会上传。

before_filter :authenticate

def authenticate
  authenticate_or_request_with_http_basic do |name, password|
    name == "foo" && password == "bar"
    true
  end
end

启用此功能。上传失败。这是我在开发日志中看到的内容:

Filter chain halted as [:authenticate] rendered_or_redirected.
Completed in 2ms (View: 1, DB: 0) | 401 Unauthorized

这仅适用于Flash上​​传,而不是定期下载。

有什么想法吗?

谢谢!

2 个答案:

答案 0 :(得分:1)

我是通过取消上传操作的身份验证来完成此操作的: “before_filter:authenticate,:except => [:swfupload]” 希望它有所帮助。

答案 1 :(得分:0)

答案不是很多,但我通过将基于会话的身份验证与authlogic集成来解决这个问题。不喜欢这个解决方案,但它可以解决问题。但是,任何想法如何解决这个具体问题仍然会受到赞赏。