Email System Fixes: - Fix email sending after payment: handle-order-paid now calls send-notification instead of send-email-v2 directly, properly processing template variables - Fix order_created email timing: sent immediately after order creation, before payment QR code generation - Update email templates to use short order ID (8 chars) instead of full UUID - Add working "Akses Sekarang" buttons to payment_success and access_granted emails - Add platform_url column to platform_settings for email links OTP Verification Flow: - Create dedicated /confirm-otp page for users who close registration modal - Add link in checkout modal and email to dedicated OTP page - Update OTP email template with better copywriting and dedicated page link - Fix send-auth-otp to fetch platform settings for dynamic brand_name and platform_url - Auto-login users after OTP verification in checkout flow Admin Features: - Add delete user functionality with cascade deletion of all related data - Update IntegrasiTab to read/write email settings from platform_settings only - Add test email template for email configuration testing Cleanup: - Remove obsolete send-consultation-reminder and send-test-email functions - Update send-email-v2 to read email config from platform_settings - Remove footer links (Ubah Preferensi/Unsubscribe) from email templates 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
55 lines
2.3 KiB
SQL
55 lines
2.3 KiB
SQL
-- ============================================================================
|
||
-- Update Auth OTP Email Template - Better Copywriting with Dedicated Page Link
|
||
-- ============================================================================
|
||
|
||
-- Update auth_email_verification template with improved copywriting
|
||
UPDATE notification_templates
|
||
SET
|
||
email_subject = 'Konfirmasi Email Anda - {platform_name}',
|
||
email_body_html = '---
|
||
<h1>🔐 Konfirmasi Alamat Email</h1>
|
||
|
||
<p>Selamat datang di <strong>{platform_name}</strong>!</p>
|
||
|
||
<p>Terima kasih telah mendaftar. Untuk mengaktifkan akun Anda, masukkan kode verifikasi 6 digit berikut:</p>
|
||
|
||
<div class="otp-box">{otp_code}</div>
|
||
|
||
<p><strong>⏰ Berlaku selama {expiry_minutes} menit</strong></p>
|
||
|
||
<h2>🎯 Cara Verifikasi:</h2>
|
||
<ol>
|
||
<li><strong>Kembali ke halaman pendaftaran</strong> - Form OTP sudah otomatis muncul</li>
|
||
<li><strong>Masukkan kode 6 digit</strong> di atas pada kolom verifikasi</li>
|
||
<li><strong>Klik "Verifikasi Email"</strong> dan akun Anda siap digunakan!</li>
|
||
</ol>
|
||
|
||
<h2>🔄 Halaman Khusus Verifikasi</h2>
|
||
<p>Jika Anda kehilangan halaman pendaftaran atau tertutup tidak sengaja, jangan khawatir! Anda tetap bisa memverifikasi akun melalui:</p>
|
||
|
||
<p class="text-center" style="margin: 20px 0;">
|
||
<a href="{platform_url}/confirm-otp?user_id={user_id}&email={email}" class="button" style="display: inline-block; padding: 12px 24px; background-color: #000; color: #fff; text-decoration: none; border-radius: 4px; font-weight: bold;">
|
||
📧 Buka Halaman Verifikasi Khusus
|
||
</a>
|
||
</p>
|
||
|
||
<p style="font-size: 14px; color: #666;">
|
||
<em>Link ini akan membawa Anda ke halaman khusus untuk memasukkan kode verifikasi.</em>
|
||
</p>
|
||
|
||
<div class="alert-warning" style="margin: 20px 0; padding: 15px; background-color: #fff3cd; border-left: 4px solid #ffc107;">
|
||
<p style="margin: 0;"><strong>💡 Tips:</strong> Cek folder <em>Spam</em> atau <em>Promotions</em> jika email tidak muncul di inbox dalam 1-2 menit.</p>
|
||
</div>
|
||
|
||
<blockquote class="alert-info">
|
||
<strong>ℹ️ Info:</strong> Jika Anda tidak merasa mendaftar di {platform_name}, abaikan email ini dengan aman.
|
||
</blockquote>
|
||
---'
|
||
WHERE key = 'auth_email_verification';
|
||
|
||
-- Return success message
|
||
DO $$
|
||
BEGIN
|
||
RAISE NOTICE 'Auth email template updated with improved copywriting and dedicated page link';
|
||
END $$;
|