[英]basic http authentication with cms pages in rails
我正在使用Rails 4和舒适的墨西哥沙发。 我希望使用密码保护来保护某些cms页面。 他们不需要非常安全。 以下代码给了我一个未定义的方法错误:
module CmsPagesAuth
def authenticate
http_basic_authenticate_with name: "dhh", password: "secret"
end
end
该方法是ActionController :: HttpAuthentication :: Basic的一部分如何访问有问题的方法? 还是有解决这个问题的更好方法? 在此先感谢您的任何建议,解决方案或见解。
class StaticController < ApplicationController
http_basic_authenticate_with name: "dhh", password: "secret", only: [your static actions]
end
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.