From b46e96c858401804ef54ef54a5b008e6d21cd016 Mon Sep 17 00:00:00 2001 From: Lucas Mateus Date: Tue, 19 Sep 2017 14:30:16 -0300 Subject: [PATCH] fix warning messages when $storedpassword is undefined --- lib/Catalyst/Authentication/Credential/Password.pm | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/Catalyst/Authentication/Credential/Password.pm b/lib/Catalyst/Authentication/Credential/Password.pm index 0ce16c7..79d7854 100644 --- a/lib/Catalyst/Authentication/Credential/Password.pm +++ b/lib/Catalyst/Authentication/Credential/Password.pm @@ -62,12 +62,10 @@ sub check_password { my $password = $authinfo->{$self->_config->{'password_field'}}; my $storedpassword = $user->get($self->_config->{'password_field'}); - if ($self->_config->{'password_type'} eq 'none') { - return 1; - } elsif ($self->_config->{'password_type'} eq 'clear') { - # FIXME - Should we warn in the $storedpassword undef case, - # as the user probably fluffed the config? - return unless defined $storedpassword; + return 1 if ($self->_config->{'password_type'} eq 'none'); + return if (!defined $storedpassword); + + if ($self->_config->{'password_type'} eq 'clear') { return $password eq $storedpassword; } elsif ($self->_config->{'password_type'} eq 'crypted') { return $storedpassword eq crypt( $password, $storedpassword );