I want to add a admin functionality to my webapp with Rails version 3. I want something very simple, there will be only one admin, this funcionality doesn't need a username field, just a password field. I don't know how to do it, can you help me?
Thanks!
Have a look at this Railscast on HTTP simple authentication:
# products_controller.rb
before_filter :authenticate
protected
def authenticate
authenticate_or_request_with_http_basic do |username, password|
username == "foo" && password == "bar"
end
end
As simple as that!
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