Lines 1207-1212
sub checkauth {
Link Here
|
1207 |
push @inputs, { name => $name, value => $value }; |
1207 |
push @inputs, { name => $name, value => $value }; |
1208 |
} |
1208 |
} |
1209 |
|
1209 |
|
|
|
1210 |
my $patron = Koha::Patrons->find({ userid => $q_userid }); # Not necessary logged in! |
1211 |
|
1210 |
my $LibraryNameTitle = C4::Context->preference("LibraryName"); |
1212 |
my $LibraryNameTitle = C4::Context->preference("LibraryName"); |
1211 |
$LibraryNameTitle =~ s/<(?:\/?)(?:br|p)\s*(?:\/?)>/ /sgi; |
1213 |
$LibraryNameTitle =~ s/<(?:\/?)(?:br|p)\s*(?:\/?)>/ /sgi; |
1212 |
$LibraryNameTitle =~ s/<(?:[^<>'"]|'(?:[^']*)'|"(?:[^"]*)")*>//sg; |
1214 |
$LibraryNameTitle =~ s/<(?:[^<>'"]|'(?:[^']*)'|"(?:[^"]*)")*>//sg; |
Lines 1256-1261
sub checkauth {
Link Here
|
1256 |
PatronSelfRegistration => C4::Context->preference("PatronSelfRegistration"), |
1258 |
PatronSelfRegistration => C4::Context->preference("PatronSelfRegistration"), |
1257 |
PatronSelfRegistrationDefaultCategory => C4::Context->preference("PatronSelfRegistrationDefaultCategory"), |
1259 |
PatronSelfRegistrationDefaultCategory => C4::Context->preference("PatronSelfRegistrationDefaultCategory"), |
1258 |
opac_css_override => $ENV{'OPAC_CSS_OVERRIDE'}, |
1260 |
opac_css_override => $ENV{'OPAC_CSS_OVERRIDE'}, |
|
|
1261 |
too_many_login_attempts => ( $patron and $patron->account_locked ), |
1259 |
); |
1262 |
); |
1260 |
|
1263 |
|
1261 |
$template->param( SCO_login => 1 ) if ( $query->param('sco_user_login') ); |
1264 |
$template->param( SCO_login => 1 ) if ( $query->param('sco_user_login') ); |
Lines 1754-1781
sub get_session {
Link Here
|
1754 |
sub checkpw { |
1757 |
sub checkpw { |
1755 |
my ( $dbh, $userid, $password, $query, $type, $no_set_userenv ) = @_; |
1758 |
my ( $dbh, $userid, $password, $query, $type, $no_set_userenv ) = @_; |
1756 |
$type = 'opac' unless $type; |
1759 |
$type = 'opac' unless $type; |
1757 |
if ($ldap) { |
1760 |
|
|
|
1761 |
my @return; |
1762 |
my $patron = Koha::Patrons->find({ userid => $userid }); |
1763 |
|
1764 |
if ( $patron and $patron->account_locked ) { |
1765 |
@return = (0); |
1766 |
} elsif ($ldap) { |
1758 |
$debug and print STDERR "## checkpw - checking LDAP\n"; |
1767 |
$debug and print STDERR "## checkpw - checking LDAP\n"; |
1759 |
my ( $retval, $retcard, $retuserid ) = checkpw_ldap(@_); # EXTERNAL AUTH |
1768 |
my ( $retval, $retcard, $retuserid ) = checkpw_ldap(@_); # EXTERNAL AUTH |
1760 |
return 0 if $retval == -1; # Incorrect password for LDAP login attempt |
1769 |
if ( $retval ) { |
1761 |
($retval) and return ( $retval, $retcard, $retuserid ); |
1770 |
@return = ( $retval, $retcard, $retuserid ); |
1762 |
} |
1771 |
} else { |
|
|
1772 |
@return = (0); |
1773 |
} |
1763 |
|
1774 |
|
1764 |
if ( $cas && $query && $query->param('ticket') ) { |
1775 |
} elsif ( $cas && $query && $query->param('ticket') ) { |
1765 |
$debug and print STDERR "## checkpw - checking CAS\n"; |
1776 |
$debug and print STDERR "## checkpw - checking CAS\n"; |
1766 |
|
1777 |
|
1767 |
# In case of a CAS authentication, we use the ticket instead of the password |
1778 |
# In case of a CAS authentication, we use the ticket instead of the password |
1768 |
my $ticket = $query->param('ticket'); |
1779 |
my $ticket = $query->param('ticket'); |
1769 |
$query->delete('ticket'); # remove ticket to come back to original URL |
1780 |
$query->delete('ticket'); # remove ticket to come back to original URL |
1770 |
my ( $retval, $retcard, $retuserid ) = checkpw_cas( $dbh, $ticket, $query, $type ); # EXTERNAL AUTH |
1781 |
my ( $retval, $retcard, $retuserid ) = checkpw_cas( $dbh, $ticket, $query, $type ); # EXTERNAL AUTH |
1771 |
($retval) and return ( $retval, $retcard, $retuserid ); |
1782 |
if ( $retval ) { |
1772 |
return 0; |
1783 |
@return = ( $retval, $retcard, $retuserid ); |
|
|
1784 |
} else { |
1785 |
@return = (0); |
1786 |
} |
1773 |
} |
1787 |
} |
1774 |
|
1788 |
|
1775 |
# If we are in a shibboleth session (shibboleth is enabled, and a shibboleth match attribute is present) |
1789 |
# If we are in a shibboleth session (shibboleth is enabled, and a shibboleth match attribute is present) |
1776 |
# Check for password to asertain whether we want to be testing against shibboleth or another method this |
1790 |
# Check for password to asertain whether we want to be testing against shibboleth or another method this |
1777 |
# time around. |
1791 |
# time around. |
1778 |
if ( $shib && $shib_login && !$password ) { |
1792 |
elsif ( $shib && $shib_login && !$password ) { |
1779 |
|
1793 |
|
1780 |
$debug and print STDERR "## checkpw - checking Shibboleth\n"; |
1794 |
$debug and print STDERR "## checkpw - checking Shibboleth\n"; |
1781 |
|
1795 |
|
Lines 1786-1798
sub checkpw {
Link Here
|
1786 |
# Then, we check if it matches a valid koha user |
1800 |
# Then, we check if it matches a valid koha user |
1787 |
if ($shib_login) { |
1801 |
if ($shib_login) { |
1788 |
my ( $retval, $retcard, $retuserid ) = C4::Auth_with_shibboleth::checkpw_shib($shib_login); # EXTERNAL AUTH |
1802 |
my ( $retval, $retcard, $retuserid ) = C4::Auth_with_shibboleth::checkpw_shib($shib_login); # EXTERNAL AUTH |
1789 |
($retval) and return ( $retval, $retcard, $retuserid ); |
1803 |
if ( $retval ) { |
1790 |
return 0; |
1804 |
@return = ( $retval, $retcard, $retuserid ); |
|
|
1805 |
} else { |
1806 |
@return = (0); |
1807 |
} |
1791 |
} |
1808 |
} |
1792 |
} |
1809 |
} |
1793 |
|
1810 |
|
1794 |
# INTERNAL AUTH |
1811 |
# INTERNAL AUTH |
1795 |
return checkpw_internal( $dbh, $userid, $password, $no_set_userenv); |
1812 |
@return = checkpw_internal( $dbh, $userid, $password, $no_set_userenv) unless @return; |
|
|
1813 |
|
1814 |
if ( $return[0] == 0 ) { |
1815 |
$patron->update({ login_attempts => $patron->login_attempts + 1 }) if $patron; |
1816 |
} elsif ( $return[1] == 1 ) { |
1817 |
$patron->update({ login_attempts => 0 })->store if $patron; |
1818 |
} |
1819 |
return @return; |
1796 |
} |
1820 |
} |
1797 |
|
1821 |
|
1798 |
sub checkpw_internal { |
1822 |
sub checkpw_internal { |