]> wagnertech.de Git - mfinanz.git/blobdiff - SL/Auth/DB.pm
Fall 'kein Hash-Algorithmus angegeben' bei alten Passwörtern richtig behandeln
[mfinanz.git] / SL / Auth / DB.pm
index e70112be1d3e557236ca6a7e5a8359014ce5100c..520e3e272f3b3e8bcdb9a2b4557ad904eecf8a2f 100644 (file)
@@ -32,15 +32,7 @@ sub authenticate {
   my $login      = shift;
   my $password   = shift;
 
-  my $dbh        = $self->{auth}->dbconnect();
-
-  if (!$dbh) {
-    $main::lxdebug->leave_sub();
-    return ERR_BACKEND;
-  }
-
-  my $query             = qq|SELECT password FROM auth."user" WHERE login = ?|;
-  my ($stored_password) = $dbh->selectrow_array($query, undef, $login);
+  my $stored_password = $self->{auth}->get_stored_password($login);
 
   my ($algorithm, $algorithm2);
 
@@ -48,7 +40,7 @@ sub authenticate {
   # 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));
+  ($algorithm2, $password)       = SL::Auth::Password->parse(SL::Auth::Password->hash_if_unhashed(password => $password, algorithm => $algorithm, login => $login));
 
   $main::lxdebug->leave_sub();
 
@@ -59,6 +51,10 @@ sub can_change_password {
   return 1;
 }
 
+sub requires_cleartext_password {
+  return 0;
+}
+
 sub change_password {
   $main::lxdebug->enter_sub();