JBAS-1786 Remote auth 2.10-style password test
authorBill Erickson <berickxx@gmail.com>
Mon, 14 Aug 2017 15:28:55 +0000 (11:28 -0400)
committerBill Erickson <berickxx@gmail.com>
Thu, 21 Mar 2019 19:46:23 +0000 (15:46 -0400)
Teach our custom version of remoteauth.cgi to use the new 2.10-style
in-database password check.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/examples/remoteauth.cgi

index 3ee752f..5c62a27 100755 (executable)
@@ -25,7 +25,6 @@ use strict;
 use warnings;
 
 use CGI;
-use Digest::MD5 qw(md5_hex);
 use DateTime;
 use DateTime::Format::ISO8601;
 use OpenSRF::Utils qw/:datetime/;
@@ -36,6 +35,7 @@ use OpenSRF::AppSession;
 use OpenILS::Utils::Fieldmapper;
 use OpenILS::Utils::CStoreEditor qw/:funcs/;
 use OpenILS::Application::AppUtils;
+my $U = 'OpenILS::Application::AppUtils';
 
 my $bootstrap = '/openils/conf/opensrf_core.xml';
 my $cgi = new CGI;
@@ -115,7 +115,7 @@ if (!($u || $usrname || $barcode) || !$p) {
         exit 0;
     }
 
-    if ($user->passwd ne md5_hex($p)) {
+    if (!$U->verify_migrated_user_password($e, $user->id, $p)) {
         $logger->warn("remoteauth: bad password for $logtag");
         print '+NO';
         exit 0;
@@ -140,8 +140,7 @@ if (!($u || $usrname || $barcode) || !$p) {
 
     $logger->info("remoteauth: successful authentication for $logtag");
 
-    OpenILS::Application::AppUtils
-        ->log_user_activity($user->id, $agent, 'verify');
+    $U->log_user_activity($user->id, $agent, 'verify');
 
     print '+VALID';
 }