Mm Zz wrote:
> any takers on help with this? :)
> 
> thank you

Here is the solution thanks to an Awesome gent in #rubyonrails....



Since 
http://wota.jp/svn/rails/plugins/branches/stable/htpasswd/lib/htpasswd/class_methods.rb
 
is rescuing Htpasswd::Error => error around line 70, i overrode the 
htpasswd_authorize method by doing the following:

- Created lib/hacks/htpasswd_hack.rb
- Dropped the following into that file:
module Htpasswd


  protected
  def htpasswd_authorize
    logger.debug "Htpasswd is enabled with %s" % 
htpasswd_options.inspect
    username = Auths.scheme(self).authorize(htpasswd_acls)
    logger.debug "Htpasswd authorize user '%s'" % username
    @htpasswd_authorized_username = username
    return true
  rescue Htpasswd::Error => error
    logger.debug "Htpasswd error(%s): %s" % [error.class, error.message]
    strongest_auth = htpasswd_options[:schemes].map{|scheme| 
Auths[scheme]}.sort.last or raise AuthSchemesNotDefined
    response.headers['WWW-Authenticate'] = 
strongest_auth.new(htpasswd_options).server_header
    logger.debug "Htpasswd sending authenticate header: '%s'"% 
response.headers['WWW-Authenticate']

    #render :nothing => true, :status => 401
    # DO SOMETHING FANCY WITH THE 401 HERE
    render :action => "show_home_page", :layout=> false  , :status => 
401
    return false
  end


end

- In application.rb added this on line 1:
require 'lib/hacks/htpasswd_hack'



And finally i ended all that by dancing a jig.

THANKS to Patrick for responding to my help request.
-- 
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