summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2010-09-01 17:16:35 -0500
committerJesse Luehrs <doy@tozt.net>2010-09-01 17:17:30 -0500
commitc24cd457d64b5ffe48b381f5e28cdd1def59b07b (patch)
treef586d06c1a55eea3dcf242a972380cf62d213974
parentfe1a91cd0621e40da8d70963f9f87ca50453f7ee (diff)
downloadplack-middleware-auth-htpasswd-c24cd457d64b5ffe48b381f5e28cdd1def59b07b.tar.gz
plack-middleware-auth-htpasswd-c24cd457d64b5ffe48b381f5e28cdd1def59b07b.zip
apparently this *dies* if it's not a user in the file
-rw-r--r--lib/Plack/Middleware/Auth/Htpasswd.pm5
1 files changed, 4 insertions, 1 deletions
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 {