From c24cd457d64b5ffe48b381f5e28cdd1def59b07b Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Wed, 1 Sep 2010 17:16:35 -0500 Subject: apparently this *dies* if it's not a user in the file --- lib/Plack/Middleware/Auth/Htpasswd.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/Plack/Middleware/Auth/Htpasswd.pm b/lib/Plack/Middleware/Auth/Htpasswd.pm index 087efa3..b3d0f54 100644 --- a/lib/Plack/Middleware/Auth/Htpasswd.pm +++ b/lib/Plack/Middleware/Auth/Htpasswd.pm @@ -37,7 +37,10 @@ sub call { sub _check_password { my $self = shift; my ($file, $user, $pass) = @_; - return Authen::Htpasswd->new($file)->check_user_password($user, $pass); + my $htpasswd = Authen::Htpasswd->new($file); + my $htpasswd_user = $htpasswd->lookup_user($user); + return unless $htpasswd_user; + return $htpasswd_user->check_password($pass); } sub authenticate { -- cgit v1.2.3-54-g00ecf