mirror of
https://github.com/slawkens/myaac.git
synced 2025-10-17 03:03:26 +02:00
2fa: first draft
This commit is contained in:
8
system/migrations/47-accounts_email_codes.sql
Normal file
8
system/migrations/47-accounts_email_codes.sql
Normal file
@@ -0,0 +1,8 @@
|
||||
CREATE TABLE `myaac_account_email_codes`
|
||||
(
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`account_id` int NOT NULL,
|
||||
`code` varchar(6) NOT NULL,
|
||||
`created_at` int NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8mb4;
|
27
system/migrations/47.php
Normal file
27
system/migrations/47.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
// add the myaac_account_email_codes
|
||||
|
||||
/**
|
||||
* @var OTS_DB_MySQL $db
|
||||
*/
|
||||
|
||||
$up = function () use ($db) {
|
||||
if (!$db->hasColumn('accounts', '2fa_type')) {
|
||||
$db->addColumn('accounts', '2fa_type', "tinyint NOT NULL DEFAULT 0 AFTER `web_flags`");
|
||||
}
|
||||
|
||||
// add myaac_account_email_codes table
|
||||
if (!$db->hasTable(TABLE_PREFIX . 'account_email_codes')) {
|
||||
$db->exec(file_get_contents(__DIR__ . '/46-account_email_codes.sql'));
|
||||
}
|
||||
};
|
||||
|
||||
$down = function () use ($db) {
|
||||
if ($db->hasColumn('accounts', '2fa_type')) {
|
||||
$db->dropColumn('accounts', '2fa_type');
|
||||
}
|
||||
|
||||
//if ($db->hasTable(TABLE_PREFIX . 'account_email_codes')) {
|
||||
// $db->dropTable(TABLE_PREFIX . 'account_email_codes');
|
||||
//}
|
||||
};
|
Reference in New Issue
Block a user