From e60b7643af9e8c18095547f680b14d249b2282cd Mon Sep 17 00:00:00 2001 From: Jacob O'Mara Date: Thu, 10 Apr 2025 12:26:55 +0100 Subject: [PATCH] Bug 40824: Create borrower_password_history table MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Test Plan: Run the following test files to verify the core functionality works: prove t/db_dependent/Koha/Patron.t prove t/db_dependent/Koha/Patron/Category.t prove t/db_dependent/Koha/PatronPasswordHistories.t prove t/db_dependent/Koha/PatronPasswordHistory.t - Navigate to system preferences and set “PasswordHistoryCount” to a value other than 0 we’ll call this X - Navigate to a test patron and change password. You should be unable to change the password to any of your last X used passwords. - Navigate to the opal and attempt to change the password there. The same should apply as on the staff interface. ( You should also receive a suitable error message explaining why your password change failed ) - Navigate to Patron Categories and set the password history count here for your patron’s category ( Y ) - Ensure that this new value Y is used in place of X as the number of previous passwords to check --- installer/data/mysql/kohastructure.sql | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index b90542fcf4b..8fde565796b 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -1813,6 +1813,7 @@ CREATE TABLE `categories` ( `can_be_guarantee` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'if patrons of this category can be guarantees', `reset_password` tinyint(1) DEFAULT NULL COMMENT 'if patrons of this category can do the password reset flow,', `change_password` tinyint(1) DEFAULT NULL COMMENT 'if patrons of this category can change their passwords in the OAPC', + `password_history_count` smallint(6) DEFAULT NULL COMMENT 'Number of previous passwords to check against when changing password for this patron type', `min_password_length` smallint(6) DEFAULT NULL COMMENT 'set minimum password length for patrons in this category', `require_strong_password` tinyint(1) DEFAULT NULL COMMENT 'set required password strength for patrons in this category', `force_password_reset_when_set_by_staff` tinyint(1) DEFAULT NULL COMMENT 'if patrons of this category are required to reset password after being created by a staff member', @@ -6814,6 +6815,25 @@ CREATE TABLE `zebraqueue` ( /*!40101 SET character_set_client = @saved_cs_client */; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; +-- +-- Table structure for table `borrower_password_history` +-- + +DROP TABLE IF EXISTS `borrower_password_history`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE IF NOT EXISTS borrower_password_history ( + id int(11) NOT NULL AUTO_INCREMENT, + borrowernumber int(11) NOT NULL, + password varchar(128) NOT NULL, + created_on timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (id), + KEY borrowernumber (borrowernumber), + CONSTRAINT borrower_password_history_ibfk_1 FOREIGN KEY (borrowernumber) REFERENCES borrowers(borrowernumber) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + + /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; -- 2.39.5