Add login history tracking and session management features

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
root
2025-12-11 05:26:44 +00:00
parent dd6c17f923
commit 18928c8678
10 changed files with 881 additions and 142 deletions

View File

@@ -336,6 +336,11 @@
"created_at": "2025-12-10T02:06:33+00:00",
"created_by": "root",
"command": "php artisan make:migration:safe set_user_1_invite_accepted"
},
"2025_12_11_050610_create_login_history_table.php": {
"created_at": "2025-12-11T05:06:10+00:00",
"created_by": "root",
"command": "php artisan make:migration:safe create_login_history_table"
}
}
}

View File

@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up()
{
DB::statement("
CREATE TABLE _login_history (
id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
login_user_id BIGINT NULL,
email_attempted VARCHAR(255) NOT NULL,
ip_address VARCHAR(45) NOT NULL,
user_agent VARCHAR(512) NULL,
location_city VARCHAR(100) NULL,
location_region VARCHAR(100) NULL,
location_country VARCHAR(2) NULL,
status VARCHAR(32) NOT NULL,
failure_reason VARCHAR(255) NULL,
created_at TIMESTAMP(3) NULL DEFAULT CURRENT_TIMESTAMP(3),
INDEX _login_history_login_user_id_idx (login_user_id),
INDEX _login_history_email_attempted_idx (email_attempted),
INDEX _login_history_created_at_idx (created_at),
INDEX _login_history_status_idx (status),
INDEX _login_history_ip_address_idx (ip_address)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
");
}
};