In ./lib/htpasswd/auths/base.rb I found two exceptions that are raised for an 
invalid account and password: Htpasswd::UnknownUserAccount and 
Htpasswd::IncorrectPassword.

Try rescuing the latter. See if that does the trick.


On Thursday 16 October 2008 19:24:03 Mm Zz wrote:
> If anyone has a suggestion for a starting point on where I can begin
> trying to figure this out i'd really appreciate hearing it.
>
> thanks
>
> Mm Zz wrote:
> > Hi All,
> >
> > I would love to hear your thoughts on this.
> >
> > I am using the htpasswd plugin located here:
> > http://wota.jp/svn/rails/plugins/branches/stable/htpasswd/
> >
> > To validate access against a .htpasswd file.  The plugin is working
> > great but currently if you fail to get the PW correct and generate a 401
> > (Unauthorized) the user is presented with a completely blank page.
> >
> > My goal is to at least redirect them to the home page or present a
> > message saying their login attempts have failed.
> >
> > Here is what i have tried:
> > #application.rb
> >   rescue_from Htpasswd::UnknownUserAccount, :with => :http_status_code
> >
> > def http_status_code
> >   redirect_to "http://someplace.com";
> > end
> >
> >  ^---- The above does nothing and does NOT catch anything.  I have tried
> > with Htpasswd::Error, and ActiveResource::UnauthorizedAccess  --
> > nothing.
> >
> > I have also tried a before filter with a method in application.rb
> > calling htpasswd but i get an error saying the htpasswd method does not
> > exist.



--~--~---------~--~----~------------~-------~--~----~
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