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:
@@ -680,28 +680,41 @@ class DomainController extends Controller
|
||||
$availableCount++;
|
||||
}
|
||||
|
||||
$domainId = $this->domainModel->create([
|
||||
'domain_name' => $domainName,
|
||||
'notification_group_id' => $groupId,
|
||||
'registrar' => $whoisData['registrar'],
|
||||
'registrar_url' => $whoisData['registrar_url'] ?? null,
|
||||
'expiration_date' => $whoisData['expiration_date'],
|
||||
'updated_date' => $whoisData['updated_date'] ?? null,
|
||||
'abuse_email' => $whoisData['abuse_email'] ?? null,
|
||||
'last_checked' => date('Y-m-d H:i:s'),
|
||||
'status' => $status,
|
||||
'whois_data' => json_encode($whoisData),
|
||||
'is_active' => 1,
|
||||
'user_id' => \Core\Auth::id()
|
||||
]);
|
||||
try {
|
||||
$domainId = $this->domainModel->create([
|
||||
'domain_name' => $domainName,
|
||||
'notification_group_id' => $groupId,
|
||||
'registrar' => $whoisData['registrar'],
|
||||
'registrar_url' => $whoisData['registrar_url'] ?? null,
|
||||
'expiration_date' => $whoisData['expiration_date'],
|
||||
'updated_date' => $whoisData['updated_date'] ?? null,
|
||||
'abuse_email' => $whoisData['abuse_email'] ?? null,
|
||||
'last_checked' => date('Y-m-d H:i:s'),
|
||||
'status' => $status,
|
||||
'whois_data' => json_encode($whoisData),
|
||||
'is_active' => 1,
|
||||
'user_id' => \Core\Auth::id()
|
||||
]);
|
||||
|
||||
// Handle tags using the new tag system
|
||||
if (!empty($tags) && $domainId) {
|
||||
$tagModel = new \App\Models\Tag();
|
||||
$tagModel->updateDomainTags($domainId, $tags, $userId);
|
||||
// Handle tags using the new tag system
|
||||
if (!empty($tags) && $domainId) {
|
||||
$tagModel = new \App\Models\Tag();
|
||||
$tagModel->updateDomainTags($domainId, $tags, $userId);
|
||||
}
|
||||
|
||||
$added++;
|
||||
} catch (\PDOException $e) {
|
||||
// Handle duplicate key (race condition between existsByDomain check and insert)
|
||||
if (str_contains($e->getMessage(), 'Duplicate entry')) {
|
||||
$skipped++;
|
||||
} else {
|
||||
$logger->error('Failed to add domain in bulk', [
|
||||
'domain' => $domainName,
|
||||
'error' => $e->getMessage()
|
||||
]);
|
||||
$errors[] = $domainName;
|
||||
}
|
||||
}
|
||||
|
||||
$added++;
|
||||
}
|
||||
|
||||
// Log bulk add completion
|
||||
|
||||
Reference in New Issue
Block a user