X-Git-Url: http://wagnertech.de/git?p=kivitendo-erp.git;a=blobdiff_plain;f=SL%2FAuth%2FDB.pm;fp=SL%2FAuth%2FDB.pm;h=93e5cc0b36d280fe497e6e1db7f3c72ea1aecec3;hp=0bbc050166466d7a419ab4dfbdf7368af544894e;hb=53593baa211863fbf66540cf1bcc36c8fb37257f;hpb=deb4d2dbb676d7d6f69dfe7815d6e0cb09bd4a44 diff --git a/SL/Auth/DB.pm b/SL/Auth/DB.pm index 0bbc05016..93e5cc0b3 100644 --- a/SL/Auth/DB.pm +++ b/SL/Auth/DB.pm @@ -38,17 +38,15 @@ sub authenticate { my $stored_password = $self->{auth}->get_stored_password($login); - my ($algorithm, $algorithm2); - # Empty password hashes in the database mean just that -- empty # passwords. Hash it for easier comparison. - $stored_password = SL::Auth::Password->hash(password => $stored_password) unless $stored_password; - ($algorithm, $stored_password) = SL::Auth::Password->parse($stored_password); - ($algorithm2, $password) = SL::Auth::Password->parse(SL::Auth::Password->hash(password => $password, algorithm => $algorithm, login => $login)); + $stored_password = SL::Auth::Password->hash(password => $stored_password) unless $stored_password; + my ($algorithm) = SL::Auth::Password->parse($stored_password); + my $hashed_password = SL::Auth::Password->hash(password => $password, algorithm => $algorithm, login => $login, stored_password => $stored_password); $main::lxdebug->leave_sub(); - return $password eq $stored_password ? OK : ERR_PASSWORD; + return $hashed_password eq $stored_password ? OK : ERR_PASSWORD; } sub can_change_password {