Lines 1181-1186
sub checkauth {
Link Here
|
1181 |
push @inputs, { name => $name, value => $value }; |
1181 |
push @inputs, { name => $name, value => $value }; |
1182 |
} |
1182 |
} |
1183 |
|
1183 |
|
|
|
1184 |
my $patron = Koha::Patrons->find({ userid => $q_userid }); # Not necessary logged in! |
1185 |
|
1184 |
my $LibraryNameTitle = C4::Context->preference("LibraryName"); |
1186 |
my $LibraryNameTitle = C4::Context->preference("LibraryName"); |
1185 |
$LibraryNameTitle =~ s/<(?:\/?)(?:br|p)\s*(?:\/?)>/ /sgi; |
1187 |
$LibraryNameTitle =~ s/<(?:\/?)(?:br|p)\s*(?:\/?)>/ /sgi; |
1186 |
$LibraryNameTitle =~ s/<(?:[^<>'"]|'(?:[^']*)'|"(?:[^"]*)")*>//sg; |
1188 |
$LibraryNameTitle =~ s/<(?:[^<>'"]|'(?:[^']*)'|"(?:[^"]*)")*>//sg; |
Lines 1230-1235
sub checkauth {
Link Here
|
1230 |
PatronSelfRegistration => C4::Context->preference("PatronSelfRegistration"), |
1232 |
PatronSelfRegistration => C4::Context->preference("PatronSelfRegistration"), |
1231 |
PatronSelfRegistrationDefaultCategory => C4::Context->preference("PatronSelfRegistrationDefaultCategory"), |
1233 |
PatronSelfRegistrationDefaultCategory => C4::Context->preference("PatronSelfRegistrationDefaultCategory"), |
1232 |
opac_css_override => $ENV{'OPAC_CSS_OVERRIDE'}, |
1234 |
opac_css_override => $ENV{'OPAC_CSS_OVERRIDE'}, |
|
|
1235 |
too_many_login_attempts => ( $patron and $patron->account_locked ), |
1233 |
); |
1236 |
); |
1234 |
|
1237 |
|
1235 |
$template->param( SCO_login => 1 ) if ( $query->param('sco_user_login') ); |
1238 |
$template->param( SCO_login => 1 ) if ( $query->param('sco_user_login') ); |
Lines 1728-1755
sub get_session {
Link Here
|
1728 |
sub checkpw { |
1731 |
sub checkpw { |
1729 |
my ( $dbh, $userid, $password, $query, $type, $no_set_userenv ) = @_; |
1732 |
my ( $dbh, $userid, $password, $query, $type, $no_set_userenv ) = @_; |
1730 |
$type = 'opac' unless $type; |
1733 |
$type = 'opac' unless $type; |
1731 |
if ($ldap) { |
1734 |
|
|
|
1735 |
my @return; |
1736 |
my $patron = Koha::Patrons->find({ userid => $userid }); |
1737 |
|
1738 |
if ( $patron and $patron->account_locked ) { |
1739 |
@return = (0); |
1740 |
} elsif ($ldap) { |
1732 |
$debug and print STDERR "## checkpw - checking LDAP\n"; |
1741 |
$debug and print STDERR "## checkpw - checking LDAP\n"; |
1733 |
my ( $retval, $retcard, $retuserid ) = checkpw_ldap(@_); # EXTERNAL AUTH |
1742 |
my ( $retval, $retcard, $retuserid ) = checkpw_ldap(@_); # EXTERNAL AUTH |
1734 |
return 0 if $retval == -1; # Incorrect password for LDAP login attempt |
1743 |
if ( $retval ) { |
1735 |
($retval) and return ( $retval, $retcard, $retuserid ); |
1744 |
@return = ( $retval, $retcard, $retuserid ); |
1736 |
} |
1745 |
} else { |
|
|
1746 |
@return = (0); |
1747 |
} |
1737 |
|
1748 |
|
1738 |
if ( $cas && $query && $query->param('ticket') ) { |
1749 |
} elsif ( $cas && $query && $query->param('ticket') ) { |
1739 |
$debug and print STDERR "## checkpw - checking CAS\n"; |
1750 |
$debug and print STDERR "## checkpw - checking CAS\n"; |
1740 |
|
1751 |
|
1741 |
# In case of a CAS authentication, we use the ticket instead of the password |
1752 |
# In case of a CAS authentication, we use the ticket instead of the password |
1742 |
my $ticket = $query->param('ticket'); |
1753 |
my $ticket = $query->param('ticket'); |
1743 |
$query->delete('ticket'); # remove ticket to come back to original URL |
1754 |
$query->delete('ticket'); # remove ticket to come back to original URL |
1744 |
my ( $retval, $retcard, $retuserid ) = checkpw_cas( $dbh, $ticket, $query, $type ); # EXTERNAL AUTH |
1755 |
my ( $retval, $retcard, $retuserid ) = checkpw_cas( $dbh, $ticket, $query, $type ); # EXTERNAL AUTH |
1745 |
($retval) and return ( $retval, $retcard, $retuserid ); |
1756 |
if ( $retval ) { |
1746 |
return 0; |
1757 |
@return = ( $retval, $retcard, $retuserid ); |
|
|
1758 |
} else { |
1759 |
@return = (0); |
1760 |
} |
1747 |
} |
1761 |
} |
1748 |
|
1762 |
|
1749 |
# If we are in a shibboleth session (shibboleth is enabled, and a shibboleth match attribute is present) |
1763 |
# If we are in a shibboleth session (shibboleth is enabled, and a shibboleth match attribute is present) |
1750 |
# Check for password to asertain whether we want to be testing against shibboleth or another method this |
1764 |
# Check for password to asertain whether we want to be testing against shibboleth or another method this |
1751 |
# time around. |
1765 |
# time around. |
1752 |
if ( $shib && $shib_login && !$password ) { |
1766 |
elsif ( $shib && $shib_login && !$password ) { |
1753 |
|
1767 |
|
1754 |
$debug and print STDERR "## checkpw - checking Shibboleth\n"; |
1768 |
$debug and print STDERR "## checkpw - checking Shibboleth\n"; |
1755 |
|
1769 |
|
Lines 1760-1772
sub checkpw {
Link Here
|
1760 |
# Then, we check if it matches a valid koha user |
1774 |
# Then, we check if it matches a valid koha user |
1761 |
if ($shib_login) { |
1775 |
if ($shib_login) { |
1762 |
my ( $retval, $retcard, $retuserid ) = C4::Auth_with_shibboleth::checkpw_shib($shib_login); # EXTERNAL AUTH |
1776 |
my ( $retval, $retcard, $retuserid ) = C4::Auth_with_shibboleth::checkpw_shib($shib_login); # EXTERNAL AUTH |
1763 |
($retval) and return ( $retval, $retcard, $retuserid ); |
1777 |
if ( $retval ) { |
1764 |
return 0; |
1778 |
@return = ( $retval, $retcard, $retuserid ); |
|
|
1779 |
} else { |
1780 |
@return = (0); |
1781 |
} |
1765 |
} |
1782 |
} |
1766 |
} |
1783 |
} |
1767 |
|
1784 |
|
1768 |
# INTERNAL AUTH |
1785 |
# INTERNAL AUTH |
1769 |
return checkpw_internal( $dbh, $userid, $password, $no_set_userenv); |
1786 |
@return = checkpw_internal( $dbh, $userid, $password, $no_set_userenv) unless @return; |
|
|
1787 |
|
1788 |
if ( $return[0] == 0 ) { |
1789 |
$patron->update({ login_attempts => $patron->login_attempts + 1 }) if $patron; |
1790 |
} elsif ( $return[1] == 1 ) { |
1791 |
$patron->update({ login_attempts => 0 })->store if $patron; |
1792 |
} |
1793 |
return @return; |
1770 |
} |
1794 |
} |
1771 |
|
1795 |
|
1772 |
sub checkpw_internal { |
1796 |
sub checkpw_internal { |