6 use Digest::MD5 qw(md5_hex);
8 use OpenSRF::EX qw(:try);
12 my $bootstrap = '/openils/conf/opensrf_core.xml';
14 my $u = $cgi->param('user');
15 my $p = $cgi->param('passwd');
17 print $cgi->header(-type=>'text/html', -expires=>'-1d');
19 OpenSRF::System->bootstrap_client( config_file => $bootstrap );
24 my $nametype = 'username';
25 $nametype = 'barcode' if ($u =~ /^\d+$/o);
26 my $seed = OpenSRF::AppSession
27 ->create("open-ils.auth")
28 ->request( 'open-ils.auth.authenticate.init', $u )
31 my $response = OpenSRF::AppSession
32 ->create("open-ils.auth")
33 ->request( 'open-ils.auth.authenticate.complete', { $nametype => $u, password => md5_hex($seed . md5_hex($p)), type => 'temp' })
35 if ($response->{payload}->{authtoken}) {
36 my $user = OpenSRF::AppSession
37 ->create("open-ils.auth")
38 ->request( "open-ils.auth.session.retrieve", $response->{payload}->{authtoken} )
40 if (ref($user) eq 'HASH' && $user->{ilsevent} == 1001) {
49 print "+BACKEND_ERROR";