1 $DBversion = 'XXX'; # will be replaced by the RM
2 if( CheckVersion( $DBversion ) ) {
5 INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES
6 ('TwoFactorAuthentication', '0', 'NULL', 'Enables two-factor authentication', 'YesNo')
9 if( !column_exists( 'borrowers', 'secret' ) ) {
11 ALTER TABLE borrowers ADD COLUMN `secret` MEDIUMTEXT COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Secret for 2FA' AFTER `password`
15 if( !column_exists( 'deletedborrowers', 'secret' ) ) {
17 ALTER TABLE deletedborrowers ADD COLUMN `secret` MEDIUMTEXT COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Secret for 2FA' AFTER `password`
21 if( !column_exists( 'borrowers', 'auth_method' ) ) {
23 ALTER TABLE borrowers ADD COLUMN `auth_method` ENUM('password', 'two-factor') NOT NULL DEFAULT 'password' COMMENT 'Authentication method' AFTER `secret`
27 if( !column_exists( 'deletedborrowers', 'auth_method' ) ) {
29 ALTER TABLE deletedborrowers ADD COLUMN `auth_method` ENUM('password', 'two-factor') NOT NULL DEFAULT 'password' COMMENT 'Authentication method' AFTER `secret`
33 NewVersion( $DBversion, 28786, "Add new syspref TwoFactorAuthentication");