From a5f5970bd7c98e5049f260d10fe18d35e2cec469 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 21 Mar 2017 17:20:00 -0300 Subject: [PATCH] Bug 18314: Add pref FailedLoginAttempts and columns borrowers.login_attempts And of course deletedborrowers.login_attempts Signed-off-by: Jonathan Field --- 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 diff --git a/installer/data/mysql/atomicupdate/lockout.perl b/installer/data/mysql/atomicupdate/lockout.perl new file mode 100644 index 0000000..db7fbc9 --- /dev/null +++ b/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"; +} diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 261fb37..55daa8d 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/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`), @@ -1663,6 +1664,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`), diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 64aa493..964d605 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -159,6 +159,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'), diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref index 4a85957..ac4946d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref +++ b/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. -- 2.7.4