is there a way to only use
http_basic_authenticate_with :name => 'user', :password => 'secret'
when the server is running on production mode?
Yes, try:
class ApplicationController < ActionController::Base
before_filter :authenticate
def authenticate
if Rails.env.production?
authenticate_or_request_with_http_basic do |username, password|
username == "user" && password == "%$§$§"
end
end
end
end
Just add this to your example
http_basic_authenticate_with :name => 'user', :password => 'secret' if Rails.env.production?
authenticate_or_request_with_http_basic do |username, password|
username == "user" && password == "secret"
end if Rails.env.production?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With