|
Lines 1-34
Link Here
|
| 1 |
$DBversion = 'XXX'; # will be replaced by the RM |
|
|
| 2 |
if( CheckVersion( $DBversion ) ) { |
| 3 |
|
| 4 |
$dbh->do(q{ |
| 5 |
INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES |
| 6 |
('TwoFactorAuthentication', '0', 'NULL', 'Enables two-factor authentication', 'YesNo') |
| 7 |
}); |
| 8 |
|
| 9 |
if( !column_exists( 'borrowers', 'secret' ) ) { |
| 10 |
$dbh->do(q{ |
| 11 |
ALTER TABLE borrowers ADD COLUMN `secret` MEDIUMTEXT COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Secret for 2FA' AFTER `password` |
| 12 |
}); |
| 13 |
} |
| 14 |
|
| 15 |
if( !column_exists( 'deletedborrowers', 'secret' ) ) { |
| 16 |
$dbh->do(q{ |
| 17 |
ALTER TABLE deletedborrowers ADD COLUMN `secret` MEDIUMTEXT COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Secret for 2FA' AFTER `password` |
| 18 |
}); |
| 19 |
} |
| 20 |
|
| 21 |
if( !column_exists( 'borrowers', 'auth_method' ) ) { |
| 22 |
$dbh->do(q{ |
| 23 |
ALTER TABLE borrowers ADD COLUMN `auth_method` ENUM('password', 'two-factor') NOT NULL DEFAULT 'password' COMMENT 'Authentication method' AFTER `secret` |
| 24 |
}); |
| 25 |
} |
| 26 |
|
| 27 |
if( !column_exists( 'deletedborrowers', 'auth_method' ) ) { |
| 28 |
$dbh->do(q{ |
| 29 |
ALTER TABLE deletedborrowers ADD COLUMN `auth_method` ENUM('password', 'two-factor') NOT NULL DEFAULT 'password' COMMENT 'Authentication method' AFTER `secret` |
| 30 |
}); |
| 31 |
} |
| 32 |
|
| 33 |
NewVersion( $DBversion, 28786, "Add new syspref TwoFactorAuthentication"); |
| 34 |
} |