From 1bbc77e3233a872c6c80e0aa3c9bca3311029f00 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 29 Jul 2021 15:12:49 +0200 Subject: [PATCH] Bug 28786: Add new DB column borrowers.secret Content-Type: text/plain; charset=utf-8 Sponsored-by: Orex Digital Signed-off-by: David Nind Signed-off-by: Marcel de Rooy --- installer/data/mysql/atomicupdate/two-fa.perl | 12 ++++++++++++ installer/data/mysql/kohastructure.sql | 2 ++ 2 files changed, 14 insertions(+) diff --git a/installer/data/mysql/atomicupdate/two-fa.perl b/installer/data/mysql/atomicupdate/two-fa.perl index 25896b6201..5d62189b1c 100644 --- a/installer/data/mysql/atomicupdate/two-fa.perl +++ b/installer/data/mysql/atomicupdate/two-fa.perl @@ -6,5 +6,17 @@ if( CheckVersion( $DBversion ) ) { ('TwoFactorAuthentication', '0', 'NULL', 'Enables two-factor authentication', 'YesNo') }); + if( !column_exists( 'borrowers', 'secret' ) ) { + $dbh->do(q{ + ALTER TABLE borrowers ADD COLUMN `secret` MEDIUMTEXT COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Secret for 2FA' AFTER `password` + }); + } + + if( !column_exists( 'deletedborrowers', 'secret' ) ) { + $dbh->do(q{ + ALTER TABLE deletedborrowers ADD COLUMN `secret` MEDIUMTEXT COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Secret for 2FA' AFTER `password` + }); + } + NewVersion( $DBversion, 28786, "Add new syspref TwoFactorAuthentication"); } diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index a309cea736..a3307dc511 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -1423,6 +1423,7 @@ CREATE TABLE `borrowers` ( `relationship` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'used for children to include the relationship to their guarantor', `sex` varchar(1) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'patron/borrower''s gender', `password` varchar(60) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'patron/borrower''s Bcrypt encrypted password', + `secret` MEDIUMTEXT COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Secret for 2FA', `flags` int(11) DEFAULT NULL COMMENT 'will include a number associated with the staff member''s permissions', `userid` varchar(75) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'patron/borrower''s opac and/or staff interface log in', `opacnote` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'a note on the patron/borrower''s account that is visible in the OPAC and staff interface', @@ -2431,6 +2432,7 @@ CREATE TABLE `deletedborrowers` ( `relationship` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'used for children to include the relationship to their guarantor', `sex` varchar(1) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'patron/borrower''s gender', `password` varchar(60) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'patron/borrower''s encrypted password', + `secret` MEDIUMTEXT COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Secret for 2FA', `flags` int(11) DEFAULT NULL COMMENT 'will include a number associated with the staff member''s permissions', `userid` varchar(75) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'patron/borrower''s opac and/or staff interface log in', `opacnote` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'a note on the patron/borrower''s account that is visible in the OPAC and staff interface', -- 2.20.1