Hi all.
What I want to do:
use HTTP Basic Authentication (stop screaming!) and then redirect to a
welcome page.

What I am trying to do:
Use a before filter which will authenticate and then redirect to the
welcome page.

How I am failing (It's a little ugly, but please bear with me - I'm
trying to understand how this works):

class ApplicationController < ActionController::Base
  helper :all

  before_filter :authenticate

  protected

  def authenticate
    authenticate_or_request_with_http_basic do |username, password|
      user = User.first(:conditions => ['username like ? and password
like ?', username, password])
      redirect_to root_path and return unless user.nil?
      user
    end
  end

end

How it is failing:
  It tells me there's a render and a redirect.

Can anyone suggest something here? Am I just .. Thinking about it the
wrong way?
-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to