|
Lines 1342-1379
sub checkauth {
Link Here
|
| 1342 |
my $auth_error = $query->param('auth_error'); |
1342 |
my $auth_error = $query->param('auth_error'); |
| 1343 |
my $template = C4::Templates::gettemplate( $auth_template_name, $type, $query ); |
1343 |
my $template = C4::Templates::gettemplate( $auth_template_name, $type, $query ); |
| 1344 |
$template->param( |
1344 |
$template->param( |
| 1345 |
login => 1, |
|
|
| 1346 |
INPUTS => \@inputs, |
1345 |
INPUTS => \@inputs, |
| 1347 |
script_name => get_script_name(), |
1346 |
script_name => get_script_name(), |
| 1348 |
casAuthentication => C4::Context->preference("casAuthentication"), |
1347 |
casAuthentication => C4::Context->preference("casAuthentication"), |
| 1349 |
shibbolethAuthentication => $shib, |
1348 |
shibbolethAuthentication => $shib, |
| 1350 |
suggestion => C4::Context->preference("suggestion"), |
|
|
| 1351 |
virtualshelves => C4::Context->preference("virtualshelves"), |
| 1352 |
LibraryName => "" . C4::Context->preference("LibraryName"), |
| 1353 |
LibraryNameTitle => "" . $LibraryNameTitle, |
1349 |
LibraryNameTitle => "" . $LibraryNameTitle, |
| 1354 |
opacuserlogin => C4::Context->preference("opacuserlogin"), |
|
|
| 1355 |
OpacFavicon => C4::Context->preference("OpacFavicon"), |
| 1356 |
opacreadinghistory => C4::Context->preference("opacreadinghistory"), |
| 1357 |
opaclanguagesdisplay => C4::Context->preference("opaclanguagesdisplay"), |
| 1358 |
OPACUserJS => C4::Context->preference("OPACUserJS"), |
| 1359 |
opacbookbag => "" . C4::Context->preference("opacbookbag"), |
| 1360 |
OpacCloud => C4::Context->preference("OpacCloud"), |
| 1361 |
OpacTopissue => C4::Context->preference("OpacTopissue"), |
| 1362 |
OpacAuthorities => C4::Context->preference("OpacAuthorities"), |
| 1363 |
OpacBrowser => C4::Context->preference("OpacBrowser"), |
| 1364 |
TagsEnabled => C4::Context->preference("TagsEnabled"), |
| 1365 |
OPACUserCSS => C4::Context->preference("OPACUserCSS"), |
| 1366 |
intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), |
1350 |
intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), |
| 1367 |
intranetstylesheet => C4::Context->preference("intranetstylesheet"), |
1351 |
intranetstylesheet => C4::Context->preference("intranetstylesheet"), |
| 1368 |
IntranetNav => C4::Context->preference("IntranetNav"), |
|
|
| 1369 |
IntranetFavicon => C4::Context->preference("IntranetFavicon"), |
1352 |
IntranetFavicon => C4::Context->preference("IntranetFavicon"), |
| 1370 |
IntranetUserCSS => C4::Context->preference("IntranetUserCSS"), |
1353 |
IntranetUserCSS => C4::Context->preference("IntranetUserCSS"), |
| 1371 |
IntranetUserJS => C4::Context->preference("IntranetUserJS"), |
1354 |
IntranetUserJS => C4::Context->preference("IntranetUserJS"), |
| 1372 |
IndependentBranches => C4::Context->preference("IndependentBranches"), |
1355 |
IndependentBranches => C4::Context->preference("IndependentBranches"), |
| 1373 |
AutoLocation => C4::Context->preference("AutoLocation"), |
1356 |
AutoLocation => C4::Context->preference("AutoLocation"), |
| 1374 |
wrongip => $info{'wrongip'}, |
1357 |
wrongip => $info{'wrongip'}, |
| 1375 |
PatronSelfRegistration => C4::Context->preference("PatronSelfRegistration"), |
|
|
| 1376 |
PatronSelfRegistrationDefaultCategory => C4::Context->preference("PatronSelfRegistrationDefaultCategory"), |
| 1377 |
opac_css_override => $ENV{'OPAC_CSS_OVERRIDE'}, |
1358 |
opac_css_override => $ENV{'OPAC_CSS_OVERRIDE'}, |
| 1378 |
too_many_login_attempts => ( $patron and $patron->account_locked ), |
1359 |
too_many_login_attempts => ( $patron and $patron->account_locked ), |
| 1379 |
password_has_expired => ( $patron and $patron->password_expired ), |
1360 |
password_has_expired => ( $patron and $patron->password_expired ), |
|
Lines 1382-1388
sub checkauth {
Link Here
|
| 1382 |
|
1363 |
|
| 1383 |
$template->param( SCO_login => 1 ) if ( $query->param('sco_user_login') ); |
1364 |
$template->param( SCO_login => 1 ) if ( $query->param('sco_user_login') ); |
| 1384 |
$template->param( SCI_login => 1 ) if ( $query->param('sci_user_login') ); |
1365 |
$template->param( SCI_login => 1 ) if ( $query->param('sci_user_login') ); |
| 1385 |
$template->param( OpacPublic => C4::Context->preference("OpacPublic") ); |
|
|
| 1386 |
$template->param( loginprompt => 1 ) unless $info{'nopermission'}; |
1366 |
$template->param( loginprompt => 1 ) unless $info{'nopermission'}; |
| 1387 |
if ( $auth_state eq 'additional-auth-needed' ) { |
1367 |
if ( $auth_state eq 'additional-auth-needed' ) { |
| 1388 |
my $patron = Koha::Patrons->find( { userid => $userid } ); |
1368 |
my $patron = Koha::Patrons->find( { userid => $userid } ); |
|
Lines 1399-1415
sub checkauth {
Link Here
|
| 1399 |
); |
1379 |
); |
| 1400 |
} |
1380 |
} |
| 1401 |
|
1381 |
|
| 1402 |
if ( $type eq 'opac' ) { |
|
|
| 1403 |
require Koha::Virtualshelves; |
| 1404 |
my $some_public_shelves = Koha::Virtualshelves->get_some_shelves( |
| 1405 |
{ |
| 1406 |
public => 1, |
| 1407 |
} |
| 1408 |
); |
| 1409 |
$template->param( |
| 1410 |
some_public_shelves => $some_public_shelves, |
| 1411 |
); |
| 1412 |
} |
| 1413 |
|
1382 |
|
| 1414 |
if ($cas) { |
1383 |
if ($cas) { |
| 1415 |
|
1384 |
|
|
Lines 1456-1480
sub checkauth {
Link Here
|
| 1456 |
} |
1425 |
} |
| 1457 |
} |
1426 |
} |
| 1458 |
|
1427 |
|
| 1459 |
$template->param( |
|
|
| 1460 |
LibraryName => C4::Context->preference("LibraryName"), |
| 1461 |
); |
| 1462 |
$template->param(%info); |
1428 |
$template->param(%info); |
| 1463 |
|
1429 |
|
| 1464 |
# $cookie = $query->cookie(CGISESSID => $session->id |
1430 |
__PACKAGE__->render_auth_page({ |
| 1465 |
# ); |
1431 |
controller => $query, |
| 1466 |
print $query->header( |
1432 |
cookie => $cookie, |
| 1467 |
{ type => 'text/html', |
1433 |
template => $template, |
| 1468 |
charset => 'utf-8', |
1434 |
type => $type, |
| 1469 |
cookie => $cookie, |
1435 |
}); |
| 1470 |
'X-Frame-Options' => 'SAMEORIGIN', |
|
|
| 1471 |
-sameSite => 'Lax' |
| 1472 |
} |
| 1473 |
), |
| 1474 |
$template->output; |
| 1475 |
safe_exit; |
1436 |
safe_exit; |
| 1476 |
} |
1437 |
} |
| 1477 |
|
1438 |
|
|
|
1439 |
=head2 render_auth_page |
| 1440 |
|
| 1441 |
C4::Auth->render_auth_page({ |
| 1442 |
controller => $query, |
| 1443 |
cookie => $cookie, |
| 1444 |
template => $template, |
| 1445 |
type => $type, |
| 1446 |
}); |
| 1447 |
|
| 1448 |
Given a controller object, a cookie, a template, and a type, this |
| 1449 |
function renders a UI page for the user to login/authenticate for |
| 1450 |
Koha. |
| 1451 |
|
| 1452 |
=cut |
| 1453 |
|
| 1454 |
sub render_auth_page { |
| 1455 |
my ($class,$args) = @_; |
| 1456 |
my $controller = $args->{controller}; |
| 1457 |
my $cookie = $args->{cookie}; |
| 1458 |
my $template = $args->{template}; |
| 1459 |
my $type = $args->{type}; |
| 1460 |
if ($template){ |
| 1461 |
if ($type){ |
| 1462 |
if ($type eq 'opac'){ |
| 1463 |
#LISTS |
| 1464 |
require Koha::Virtualshelves; |
| 1465 |
my $some_public_shelves = Koha::Virtualshelves->get_some_shelves( |
| 1466 |
{ |
| 1467 |
public => 1, |
| 1468 |
} |
| 1469 |
); |
| 1470 |
#/LISTS |
| 1471 |
$template->param( |
| 1472 |
some_public_shelves => $some_public_shelves, |
| 1473 |
opaclanguagesdisplay => C4::Context->preference("opaclanguagesdisplay"), |
| 1474 |
); |
| 1475 |
} |
| 1476 |
else { |
| 1477 |
$template->param ( |
| 1478 |
login => 1, |
| 1479 |
); |
| 1480 |
} |
| 1481 |
} |
| 1482 |
} |
| 1483 |
if ( $controller ){ |
| 1484 |
if ( $controller->isa('CGI') ){ |
| 1485 |
my $query = $controller; |
| 1486 |
print $query->header( |
| 1487 |
{ type => 'text/html', |
| 1488 |
charset => 'utf-8', |
| 1489 |
cookie => $cookie, |
| 1490 |
'X-Frame-Options' => 'SAMEORIGIN', |
| 1491 |
-sameSite => 'Lax' |
| 1492 |
} |
| 1493 |
); |
| 1494 |
if ($template){ |
| 1495 |
print $template->output; |
| 1496 |
} |
| 1497 |
} |
| 1498 |
} |
| 1499 |
} |
| 1500 |
|
| 1478 |
=head2 check_api_auth |
1501 |
=head2 check_api_auth |
| 1479 |
|
1502 |
|
| 1480 |
($status, $cookie, $sessionId) = check_api_auth($query, $userflags); |
1503 |
($status, $cookie, $sessionId) = check_api_auth($query, $userflags); |