Security hardening: invited user onboarding flow (C1–N7)
This commit is contained in:
@@ -46,7 +46,8 @@ function run(PDO $pdo, string $sql, string $label): void {
|
||||
$pdo->exec($sql);
|
||||
ok($label);
|
||||
} catch (PDOException $e) {
|
||||
if (str_contains($e->getMessage(), 'already exists')) {
|
||||
if (str_contains($e->getMessage(), 'already exists') ||
|
||||
str_contains($e->getMessage(), 'Duplicate column name')) {
|
||||
skip($label . ' (already exists)');
|
||||
} else {
|
||||
fail($label . ': ' . $e->getMessage());
|
||||
@@ -148,14 +149,20 @@ CREATE TABLE IF NOT EXISTS `company_map_user` (
|
||||
`user_id` int(11) DEFAULT NULL,
|
||||
`role` varchar(15) NOT NULL DEFAULT 'user',
|
||||
`app_access` varchar(15) NOT NULL DEFAULT 'wms',
|
||||
`invite_token` varchar(64) DEFAULT NULL,
|
||||
`created_at` datetime DEFAULT NULL,
|
||||
`invite_token` varchar(64) DEFAULT NULL,
|
||||
`invite_expires_at` datetime DEFAULT NULL,
|
||||
`invite_resent_at` datetime DEFAULT NULL,
|
||||
`created_at` datetime DEFAULT NULL,
|
||||
PRIMARY KEY (`map_id`),
|
||||
KEY `user_id` (`user_id`),
|
||||
KEY `company_id` (`company_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
|
||||
", 'company_map_user');
|
||||
|
||||
// Column added for explicit-consent invite flow (existing users)
|
||||
run($pdo, "ALTER TABLE `company_map_user` ADD COLUMN `invite_expires_at` DATETIME DEFAULT NULL AFTER `invite_token`", 'company_map_user.invite_expires_at');
|
||||
run($pdo, "ALTER TABLE `company_map_user` ADD COLUMN `invite_resent_at` DATETIME DEFAULT NULL AFTER `invite_expires_at`", 'company_map_user.invite_resent_at');
|
||||
|
||||
run($pdo, "
|
||||
CREATE TABLE IF NOT EXISTS `company_setting` (
|
||||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
|
||||
Reference in New Issue
Block a user