@@ -, +, @@ borrowers.login_attempts --- installer/data/mysql/atomicupdate/lockout.perl | 19 +++++++++++++++++++ installer/data/mysql/kohastructure.sql | 2 ++ installer/data/mysql/sysprefs.sql | 1 + .../prog/en/modules/admin/preferences/patrons.pref | 5 +++++ 4 files changed, 27 insertions(+) create mode 100644 installer/data/mysql/atomicupdate/lockout.perl --- a/installer/data/mysql/atomicupdate/lockout.perl +++ a/installer/data/mysql/atomicupdate/lockout.perl @@ -0,0 +1,19 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if( CheckVersion( $DBversion ) ) { + $dbh->do( q| + INSERT IGNORE INTO systempreferences (`variable`, `value`, `options`, `explanation`, `type`) + VALUES ('FailedLoginAttempts','','','Number of login attempts before lockout the patron account','Integer'); + |); + + unless( column_exists( 'borrowers', 'login_attempts' ) ) { + $dbh->do(q| + ALTER TABLE borrowers ADD COLUMN login_attempts INT(4) DEFAULT 0 AFTER lastseen + |); + $dbh->do(q| + ALTER TABLE deletedborrowers ADD COLUMN login_attempts INT(4) DEFAULT 0 AFTER lastseen + |); + } + + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug XXXXX - Add FailedLoginAttempts and borrowers.login_attempts)\n"; +} --- a/installer/data/mysql/kohastructure.sql +++ a/installer/data/mysql/kohastructure.sql @@ -632,6 +632,7 @@ CREATE TABLE `deletedborrowers` ( -- stores data related to the patrons/borrower `checkprevcheckout` varchar(7) NOT NULL default 'inherit', -- produce a warning for this patron if this item has previously been checked out to this patron if 'yes', not if 'no', defer to category setting if 'inherit'. `updated_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- time of last change could be useful for synchronization with external systems (among others) `lastseen` datetime default NULL, -- last time a patron has been seed (connected at the OPAC or staff interface) + `login_attempts` int(4) default 0, -- number of failed login attemps `overdrive_auth_token` text default NULL, -- persist OverDrive auth token KEY borrowernumber (borrowernumber), KEY `cardnumber` (`cardnumber`), @@ -1664,6 +1665,7 @@ CREATE TABLE `borrowers` ( -- this table includes information about your patrons `checkprevcheckout` varchar(7) NOT NULL default 'inherit', -- produce a warning for this patron if this item has previously been checked out to this patron if 'yes', not if 'no', defer to category setting if 'inherit'. `updated_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- time of last change could be useful for synchronization with external systems (among others) `lastseen` datetime default NULL, -- last time a patron has been seed (connected at the OPAC or staff interface) + `login_attempts` int(4) default 0, -- number of failed login attemps `overdrive_auth_token` text default NULL, -- persist OverDrive auth token UNIQUE KEY `cardnumber` (`cardnumber`), PRIMARY KEY `borrowernumber` (`borrowernumber`), --- a/installer/data/mysql/sysprefs.sql +++ a/installer/data/mysql/sysprefs.sql @@ -160,6 +160,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('ExtendedPatronAttributes','0',NULL,'Use extended patron IDs and attributes','YesNo'), ('FacetLabelTruncationLength','20',NULL,'Specify the facet max length in OPAC','Integer'), ('FacetMaxCount','20',NULL,'Specify the max facet count for each category','Integer'), +('FailedLoginAttempts','','','Number of login attempts before lockout the patron account','Integer'), ('FeeOnChangePatronCategory','1','','If set, when a patron changes to a category with enrolment fee, a fee is charged','YesNo'), ('FilterBeforeOverdueReport','0','','Do not run overdue report until filter selected','YesNo'), ('FineNotifyAtCheckin','0',NULL,'If ON notify librarians of overdue fines on the items they are checking in.','YesNo'), --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref @@ -212,3 +212,8 @@ Patrons: yes: Do no: "Don't" - search the Norwegian national patron database after a local search result was found. + - + - Block a patron's account if it reaches + - pref: FailedLoginAttempts + class: integer + - failed login attempts. --