Add domain status notifications & login alerts

Introduce richer notifications and domain status handling across the app.

- NotificationService: Add domain status alert formatting/sending, in-app notifications for available/registered/redemption/pending_delete, richer session_new and session_failed notifications (geolocation + UA parsing) and helpers for human-readable status labels.
- Auth/TwoFactor: Emit notifications for successful logins (including remember-me and 2FA) and failed login attempts; update last-login timestamp on various flows.
- DomainController: Wrap bulk domain create in try/catch to handle duplicate race conditions and log failures.
- WhoisService: Detect redemption_period and pending_delete statuses from WHOIS/EPP statuses.
- Settings/Setting: Add settings support for notification status triggers and bump default app_version to 1.1.2; persist/update status trigger values.
- Views/Layout/View helpers: Add parsing/formatting for login notification data, add new status labels/classes (available, redemption_period, pending_delete), update notification icons/colors mapping.
- Top-nav & Notifications UI: Enhance dropdown with rich login/failed-login display (flags, device icons), clickable domain redirects when marking read, badge IDs for dynamic updates.
- Error admin UI: Add copy error report button with robust clipboard fallback and toast UI reused from messages; improved copy UX in admin index/detail.
- Installer: Add new migration 024 to installer migration lists and adjust detected toVersion to 1.1.2.
- DB: Add migration file 024_add_status_notifications_v1.1.2.sql (new file).

These changes add user-facing alerts for domain lifecycle events and stronger login/security notifications while improving UI feedback and robustness during bulk operations.
This commit is contained in:
Hosteroid
2026-02-08 22:58:59 +02:00
parent f32de0a848
commit e334f7c9d6
24 changed files with 1597 additions and 200 deletions

View File

@@ -141,7 +141,7 @@ CREATE TABLE IF NOT EXISTS domains (
updated_date DATE,
abuse_email VARCHAR(255),
last_checked TIMESTAMP NULL,
status ENUM('active', 'expiring_soon', 'expired', 'error', 'available') DEFAULT 'active',
status ENUM('active', 'expiring_soon', 'expired', 'error', 'available', 'redemption_period', 'pending_delete') DEFAULT 'active',
whois_data JSON,
notes TEXT,
is_active BOOLEAN DEFAULT TRUE,
@@ -362,7 +362,7 @@ INSERT INTO settings (setting_key, setting_value, `type`, `description`) VALUES
('app_name', 'Domain Monitor', 'string', 'Application name'),
('app_url', 'http://localhost:8000', 'string', 'Application URL'),
('app_timezone', 'UTC', 'string', 'Application timezone'),
('app_version', '1.1.1', 'string', 'Application version number'),
('app_version', '1.1.2', 'string', 'Application version number'),
-- Email settings
('mail_host', 'smtp.mailtrap.io', 'string', 'SMTP server host'),
@@ -375,6 +375,7 @@ INSERT INTO settings (setting_key, setting_value, `type`, `description`) VALUES
-- Monitoring settings
('notification_days_before', '60,30,21,14,7,5,3,2,1', 'string', 'Notification days before expiration'),
('notification_status_triggers', 'available,registered,expired,redemption_period,pending_delete', 'string', 'Domain status changes that trigger notifications'),
('check_interval_hours', '24', 'string', 'Domain check interval in hours'),
('last_check_run', NULL, 'datetime', 'Last time cron job ran'),

View File

@@ -0,0 +1,20 @@
-- Migration: Add status-based notifications and new domain lifecycle statuses
-- Version: 1.1.2
-- This migration adds support for notifications based on domain status changes:
-- available, registered, expired, redemption_period, pending_delete
-- 1. Expand domain status ENUM to include redemption_period and pending_delete
ALTER TABLE domains MODIFY COLUMN status
ENUM('active', 'expiring_soon', 'expired', 'error', 'available', 'redemption_period', 'pending_delete')
DEFAULT 'active';
-- 2. Add setting for notification status triggers (which status changes trigger notifications)
INSERT INTO settings (setting_key, setting_value, created_at, updated_at)
VALUES ('notification_status_triggers', 'available,registered,expired,redemption_period,pending_delete', NOW(), NOW())
ON DUPLICATE KEY UPDATE setting_key = setting_key;
-- 3. Update application version to 1.1.2
UPDATE settings
SET setting_value = '1.1.2'
WHERE setting_key = 'app_version';