- Email 2FA is now optional and disabled by default.
Existing and new accounts default to 2FA off. Registration signs users in directly. Users can enable it under My Account. Administrators can manage it under Users & Staff. Verified password-only and opted-in email-code login flows. PHP/JavaScript checks and browser console passed.
This commit is contained in:
@@ -74,6 +74,7 @@ CREATE TABLE IF NOT EXISTS users (
|
||||
postal_code TEXT NOT NULL DEFAULT '',
|
||||
role TEXT NOT NULL DEFAULT 'customer',
|
||||
newsletter_opt_in INTEGER NOT NULL DEFAULT 1,
|
||||
two_factor_enabled INTEGER NOT NULL DEFAULT 0,
|
||||
email_verified_at TEXT,
|
||||
active INTEGER NOT NULL DEFAULT 1,
|
||||
created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
@@ -264,9 +265,22 @@ CREATE INDEX IF NOT EXISTS idx_users_newsletter ON users(newsletter_opt_in, acti
|
||||
SQL;
|
||||
|
||||
$this->pdo->exec($schema);
|
||||
$this->ensureSqliteColumn('users', 'two_factor_enabled', 'INTEGER NOT NULL DEFAULT 0');
|
||||
$this->seed();
|
||||
}
|
||||
|
||||
private function ensureSqliteColumn(string $table, string $column, string $definition): void
|
||||
{
|
||||
$columns = $this->pdo->query("PRAGMA table_info(`{$table}`)")->fetchAll();
|
||||
foreach ($columns as $existing) {
|
||||
if (($existing['name'] ?? '') === $column) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$this->pdo->exec("ALTER TABLE `{$table}` ADD COLUMN `{$column}` {$definition}");
|
||||
}
|
||||
|
||||
private function seed(): void
|
||||
{
|
||||
$categoryCount = (int) $this->pdo->query('SELECT COUNT(*) FROM menu_categories')->fetchColumn();
|
||||
|
||||
Reference in New Issue
Block a user