krsyer-server-monitor-pro 1.0.27 → 1.0.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/UPDATES.md +84 -0
- package/lib/controllers/cloudflareController.js +1 -1
- package/lib/controllers/dockerController.js +1 -1
- package/lib/controllers/networkController.js +1 -1
- package/lib/controllers/serverController.js +1 -1
- package/lib/ecosystem.config.js +1 -1
- package/lib/middleware/saasAuth.js +1 -1
- package/lib/routes/cloudflareRoutes.js +1 -1
- package/lib/routes/dockerRoutes.js +1 -1
- package/lib/routes/networkRoutes.js +1 -1
- package/lib/routes/serverRoutes.js +1 -1
- package/lib/server.js +1 -1
- package/lib/services/cashfreeService.js +1 -1
- package/package.json +8 -1
- package/guestguru-api/.idea/guestguru-api.iml +0 -9
- package/guestguru-api/.idea/misc.xml +0 -6
- package/guestguru-api/.idea/modules.xml +0 -8
- package/guestguru-api/.idea/vcs.xml +0 -6
- package/guestguru-api/API_DESIGN_GUIDE.md +0 -140
- package/guestguru-api/API_DOCUMENTATION.md +0 -504
- package/guestguru-api/API_REQUIREMENTS_TENANTS.md +0 -110
- package/guestguru-api/AVAILABLE_TENANT_ENDPOINTS.md +0 -137
- package/guestguru-api/BACKEND_INSTRUCTIONS.md +0 -77
- package/guestguru-api/DINING_MODULE_INTEGRATION.md +0 -175
- package/guestguru-api/FRONTEND_FINANCE_MODULE.md +0 -151
- package/guestguru-api/README.md +0 -93
- package/guestguru-api/app.json +0 -12
- package/guestguru-api/database.sqlite +0 -0
- package/guestguru-api/eas.json +0 -21
- package/guestguru-api/ecosystem.config.js +0 -19
- package/guestguru-api/fix_db_schema.js +0 -77
- package/guestguru-api/list_columns.js +0 -27
- package/guestguru-api/package.json +0 -34
- package/guestguru-api/postman_backend_v2.json +0 -1745
- package/guestguru-api/postman_collection.json +0 -477
- package/guestguru-api/postman_environment.json +0 -17
- package/guestguru-api/public/icon.png +0 -0
- package/guestguru-api/public/icon_b64.txt +0 -1
- package/guestguru-api/readd_column.js +0 -27
- package/guestguru-api/server.js +0 -263
- package/guestguru-api/test_cashfree_connection.js +0 -52
- package/license-portal/.env.example +0 -15
- package/license-portal/README.md +0 -93
- package/license-portal/ecosystem.config.js +0 -16
- package/license-portal/package.json +0 -22
- package/license-portal/server.js +0 -306
- package/license-portal/services/emailService.js +0 -126
- package/license-portal/views/pricing.html +0 -358
- package/temp_cf_method.js +0 -48
package/license-portal/server.js
DELETED
|
@@ -1,306 +0,0 @@
|
|
|
1
|
-
require('dotenv').config();
|
|
2
|
-
const express = require('express');
|
|
3
|
-
const { Cashfree, CFEnvironment } = require('cashfree-pg');
|
|
4
|
-
const path = require('path');
|
|
5
|
-
const cors = require('cors');
|
|
6
|
-
const fs = require('fs');
|
|
7
|
-
const { sendLicenseEmail } = require('./services/emailService');
|
|
8
|
-
|
|
9
|
-
const app = express();
|
|
10
|
-
app.use(express.static('public'));
|
|
11
|
-
app.use(express.json());
|
|
12
|
-
app.use(express.urlencoded({ extended: true }));
|
|
13
|
-
app.use(cors());
|
|
14
|
-
|
|
15
|
-
// --- Database (Simple JSON File Persistence) ---
|
|
16
|
-
const mysql = require('mysql2/promise');
|
|
17
|
-
|
|
18
|
-
// --- Database (MySQL) ---
|
|
19
|
-
const dbConfig = {
|
|
20
|
-
host: process.env.DB_HOST || 'localhost',
|
|
21
|
-
user: process.env.DB_USER || 'mulaorg',
|
|
22
|
-
password: process.env.DB_PASSWORD || 'Krishika@9959',
|
|
23
|
-
waitForConnections: true,
|
|
24
|
-
connectionLimit: 10,
|
|
25
|
-
queueLimit: 0
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const DB_NAME = process.env.DB_NAME || 'license_portal';
|
|
29
|
-
|
|
30
|
-
let pool;
|
|
31
|
-
|
|
32
|
-
// Init DB
|
|
33
|
-
(async () => {
|
|
34
|
-
try {
|
|
35
|
-
// 1. Create DB if not exists
|
|
36
|
-
const output = await mysql.createConnection({
|
|
37
|
-
host: dbConfig.host,
|
|
38
|
-
user: dbConfig.user,
|
|
39
|
-
password: dbConfig.password
|
|
40
|
-
});
|
|
41
|
-
await output.query(`CREATE DATABASE IF NOT EXISTS ${DB_NAME}`);
|
|
42
|
-
await output.end();
|
|
43
|
-
|
|
44
|
-
// 2. Init Pool
|
|
45
|
-
pool = mysql.createPool({
|
|
46
|
-
...dbConfig,
|
|
47
|
-
database: DB_NAME
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
// 3. Create Table
|
|
51
|
-
const conn = await pool.getConnection();
|
|
52
|
-
await conn.query(`
|
|
53
|
-
CREATE TABLE IF NOT EXISTS licenses (
|
|
54
|
-
id INT AUTO_INCREMENT PRIMARY KEY,
|
|
55
|
-
license_key VARCHAR(255) NOT NULL UNIQUE,
|
|
56
|
-
order_id VARCHAR(255),
|
|
57
|
-
customer_email VARCHAR(255),
|
|
58
|
-
customer_phone VARCHAR(50),
|
|
59
|
-
plan VARCHAR(50) DEFAULT 'Pro',
|
|
60
|
-
machine_id VARCHAR(255),
|
|
61
|
-
active BOOLEAN DEFAULT TRUE,
|
|
62
|
-
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
|
63
|
-
expiry_date DATETIME,
|
|
64
|
-
INDEX idx_key (license_key)
|
|
65
|
-
)
|
|
66
|
-
`);
|
|
67
|
-
|
|
68
|
-
// Migration: Add machine_id to existing tables if needed
|
|
69
|
-
try {
|
|
70
|
-
await conn.query("ALTER TABLE licenses ADD COLUMN machine_id VARCHAR(255)");
|
|
71
|
-
console.log("Schema Updated: machine_id column added");
|
|
72
|
-
} catch (e) {
|
|
73
|
-
if (e.code !== 'ER_DUP_FIELDNAME') console.log("Schema check skipped:", e.message);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
console.log('MySQL Database initialized');
|
|
77
|
-
conn.release();
|
|
78
|
-
} catch (err) {
|
|
79
|
-
console.error('MySQL Init Error:', err.message);
|
|
80
|
-
if (err.code === 'ECONNREFUSED') {
|
|
81
|
-
console.error('❌ Could not connect to MySQL Server. Is it installed and running?');
|
|
82
|
-
console.error('👉 Try: sudo systemctl start mysql');
|
|
83
|
-
} else if (err.code === 'ER_ACCESS_DENIED_ERROR') {
|
|
84
|
-
console.error('❌ Access Denied. Check DB_USER and DB_PASSWORD.');
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
})();
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
// --- Cashfree Init Helper ---
|
|
91
|
-
const getCashfree = () => {
|
|
92
|
-
const cf = new Cashfree();
|
|
93
|
-
cf.XClientId = process.env.CASHFREE_APP_ID;
|
|
94
|
-
cf.XClientSecret = process.env.CASHFREE_SECRET_KEY;
|
|
95
|
-
cf.XEnvironment = CFEnvironment.PRODUCTION;
|
|
96
|
-
return cf;
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
// --- Routes ---
|
|
100
|
-
|
|
101
|
-
// 1. Landing Page (Serve on / and /pricing)
|
|
102
|
-
app.get(['/', '/pricing'], (req, res) => {
|
|
103
|
-
res.sendFile(path.join(__dirname, 'views', 'pricing.html'));
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
// 2. Buy Route
|
|
107
|
-
app.post('/api/buy', async (req, res) => {
|
|
108
|
-
try {
|
|
109
|
-
const { email, phone } = req.body;
|
|
110
|
-
const orderId = `order_${Date.now()}`;
|
|
111
|
-
|
|
112
|
-
// Store temp order info? Not strictly needed if we trust Cashfree return
|
|
113
|
-
// But helpful for reconciliation. For now, rely on Return URL params.
|
|
114
|
-
|
|
115
|
-
const request = {
|
|
116
|
-
order_amount: 99.00,
|
|
117
|
-
order_currency: "INR",
|
|
118
|
-
order_id: orderId,
|
|
119
|
-
customer_details: {
|
|
120
|
-
customer_id: email.replace(/[^a-zA-Z0-9]/g, '').substring(0, 20),
|
|
121
|
-
customer_phone: phone,
|
|
122
|
-
customer_email: email
|
|
123
|
-
},
|
|
124
|
-
order_meta: {
|
|
125
|
-
return_url: `${process.env.APP_URL}/verify?order_id={order_id}&email=${encodeURIComponent(email)}&phone=${encodeURIComponent(phone)}`
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
const cf = getCashfree();
|
|
130
|
-
const response = await cf.PGCreateOrder(request);
|
|
131
|
-
res.json(response.data);
|
|
132
|
-
|
|
133
|
-
} catch (error) {
|
|
134
|
-
console.error("Cashfree Order Create Error:", error.response?.data || error.message);
|
|
135
|
-
res.status(500).json({ error: "Failed to create order" });
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
// 3. Verify Route (Return URL)
|
|
140
|
-
app.get('/verify', async (req, res) => {
|
|
141
|
-
const { order_id, email, phone } = req.query;
|
|
142
|
-
|
|
143
|
-
if (!order_id) {
|
|
144
|
-
return res.redirect('/');
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
try {
|
|
148
|
-
const cf = getCashfree();
|
|
149
|
-
// Check Payment Status
|
|
150
|
-
const response = await cf.PGOrderFetchPayments(order_id);
|
|
151
|
-
const payments = response.data;
|
|
152
|
-
|
|
153
|
-
// Find successful payment
|
|
154
|
-
const isPaid = payments.some(p => p.payment_status === 'SUCCESS');
|
|
155
|
-
|
|
156
|
-
if (isPaid) {
|
|
157
|
-
// Generate License
|
|
158
|
-
const licenseKey = 'PRO-' + Math.random().toString(36).substring(2, 10).toUpperCase() + '-' + Date.now().toString(36).toUpperCase();
|
|
159
|
-
|
|
160
|
-
// Calculate Expiry (1 year from now)
|
|
161
|
-
const expiryDate = new Date();
|
|
162
|
-
expiryDate.setFullYear(expiryDate.getFullYear() + 1);
|
|
163
|
-
|
|
164
|
-
// Check if license already exists for this order (Idempotency)
|
|
165
|
-
if (pool) {
|
|
166
|
-
const [existing] = await pool.query('SELECT license_key FROM licenses WHERE order_id = ?', [order_id]);
|
|
167
|
-
if (existing.length > 0) {
|
|
168
|
-
return res.send(getSuccessHtml(existing[0].license_key, order_id, true));
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
await pool.query(
|
|
172
|
-
'INSERT INTO licenses (license_key, order_id, customer_email, customer_phone, expiry_date, active) VALUES (?, ?, ?, ?, ?, ?)',
|
|
173
|
-
[licenseKey, order_id, email || 'Unknown', phone || 'Unknown', expiryDate, true]
|
|
174
|
-
);
|
|
175
|
-
|
|
176
|
-
// Send Email Notification
|
|
177
|
-
if (email && email !== 'Unknown') {
|
|
178
|
-
// Fire and forget, or await? Let's await to log success
|
|
179
|
-
await sendLicenseEmail(email, licenseKey, expiryDate);
|
|
180
|
-
}
|
|
181
|
-
} else {
|
|
182
|
-
console.error("Critical: DB Pool missing during verify. License generated but not saved:", licenseKey);
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
// Show Success Page
|
|
186
|
-
res.send(getSuccessHtml(licenseKey, order_id, false));
|
|
187
|
-
} else {
|
|
188
|
-
res.send(`<h1>Payment Failed or Pending</h1><a href="/">Try Again</a>`);
|
|
189
|
-
}
|
|
190
|
-
} catch (e) {
|
|
191
|
-
console.error("Cashfree Verification Error:", e);
|
|
192
|
-
res.status(500).send(`<h1>Verification Error</h1><p>${e.message}</p><pre>${JSON.stringify(e.response?.data || {}, null, 2)}</pre>`);
|
|
193
|
-
}
|
|
194
|
-
});
|
|
195
|
-
|
|
196
|
-
// 4. API Validation Endpoint
|
|
197
|
-
app.get('/api/validate', async (req, res) => {
|
|
198
|
-
let { key, machineId } = req.query;
|
|
199
|
-
if (!key) return res.json({ valid: false });
|
|
200
|
-
|
|
201
|
-
key = key.trim();
|
|
202
|
-
|
|
203
|
-
// Special Demo Key
|
|
204
|
-
if (key === 'DEMO-123') {
|
|
205
|
-
return res.json({ valid: true, plan: 'Pro (Demo)' });
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
if (!pool) {
|
|
209
|
-
console.error("DB Pool not ready");
|
|
210
|
-
return res.json({ valid: false, message: 'Server Starting...' });
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
try {
|
|
214
|
-
const [rows] = await pool.query('SELECT * FROM licenses WHERE license_key = ?', [key]);
|
|
215
|
-
const license = rows[0];
|
|
216
|
-
|
|
217
|
-
if (license && license.active) {
|
|
218
|
-
// Machine Binding Logic
|
|
219
|
-
if (machineId) {
|
|
220
|
-
if (!license.machine_id) {
|
|
221
|
-
// First time: Bind license to this machine
|
|
222
|
-
await pool.query('UPDATE licenses SET machine_id = ? WHERE id = ?', [machineId, license.id]);
|
|
223
|
-
} else if (license.machine_id !== machineId) {
|
|
224
|
-
// Already bound to another machine
|
|
225
|
-
return res.json({ valid: false, message: 'License is active on another server' });
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
// Check Expiry
|
|
230
|
-
const now = new Date();
|
|
231
|
-
const expiry = new Date(license.expiry_date);
|
|
232
|
-
|
|
233
|
-
if (expiry && now > expiry) {
|
|
234
|
-
return res.json({ valid: false, message: 'Subscription Expired' });
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
return res.json({
|
|
238
|
-
valid: true,
|
|
239
|
-
plan: license.plan,
|
|
240
|
-
expiry: license.expiry_date
|
|
241
|
-
});
|
|
242
|
-
}
|
|
243
|
-
} catch (e) {
|
|
244
|
-
console.error("Validation Error", e);
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
return res.json({ valid: false, message: 'Invalid Key' });
|
|
248
|
-
});
|
|
249
|
-
|
|
250
|
-
const getSuccessHtml = (licenseKey, orderId, isExisting) => {
|
|
251
|
-
return `
|
|
252
|
-
<!DOCTYPE html>
|
|
253
|
-
<html lang="en">
|
|
254
|
-
<head>
|
|
255
|
-
<meta charset="UTF-8">
|
|
256
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
257
|
-
<title>License Activated</title>
|
|
258
|
-
<link href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&display=swap" rel="stylesheet">
|
|
259
|
-
<style>
|
|
260
|
-
body { font-family: 'Space Grotesk', sans-serif; background: #0f172a; color: white; display: flex; justify-content: center; align-items: center; min-height: 100vh; margin: 0; }
|
|
261
|
-
.card { background: #1e293b; padding: 2.5rem; border-radius: 16px; box-shadow: 0 10px 25px rgba(0,0,0,0.5); text-align: center; max-width: 500px; width: 90%; border: 1px solid #334155; }
|
|
262
|
-
h1 { color: ${isExisting ? '#fbbf24' : '#4ade80'}; margin-bottom: 0.5rem; font-size: 2rem; }
|
|
263
|
-
.key-box { background: rgba(0,0,0,0.3); padding: 15px; border-radius: 8px; margin: 20px 0; border: 1px dashed #475569; position: relative; }
|
|
264
|
-
.label { color: #94a3b8; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 5px; display: block; }
|
|
265
|
-
.value { font-family: monospace; font-size: 1.25rem; color: #fbbf24; word-break: break-all; font-weight: bold; }
|
|
266
|
-
.credentials { background: #334155; padding: 15px; border-radius: 8px; margin-top: 20px; text-align: left; }
|
|
267
|
-
.cred-row { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 0.95rem; }
|
|
268
|
-
.cred-label { color: #cbd5e1; }
|
|
269
|
-
.cred-val { color: #fff; font-weight: 600; font-family: monospace; }
|
|
270
|
-
.warning { color: #f87171; font-size: 0.85rem; margin-top: 10px; font-style: italic; text-align: center;}
|
|
271
|
-
.btn { display: inline-block; margin-top: 25px; padding: 12px 24px; background: #3b82f6; color: white; text-decoration: none; border-radius: 8px; font-weight: 600; transition: all 0.2s; }
|
|
272
|
-
.btn:hover { background: #2563eb; transform: translateY(-1px); }
|
|
273
|
-
</style>
|
|
274
|
-
</head>
|
|
275
|
-
<body>
|
|
276
|
-
<div class="card">
|
|
277
|
-
<h1>${isExisting ? 'License Retrieved' : 'Payment Successful!'}</h1>
|
|
278
|
-
<p style="color: #cbd5e1;">Your License is active.</p>
|
|
279
|
-
|
|
280
|
-
<div class="key-box">
|
|
281
|
-
<span class="label">License Key</span>
|
|
282
|
-
<div class="value">${licenseKey}</div>
|
|
283
|
-
</div>
|
|
284
|
-
|
|
285
|
-
<div class="credentials">
|
|
286
|
-
<div style="margin-bottom:12px; color:#60a5fa; font-weight:bold; font-size:0.95rem; text-align:center; text-transform:uppercase; letter-spacing:1px;">Monitor Credentials</div>
|
|
287
|
-
<div class="cred-row">
|
|
288
|
-
<span class="cred-label">Username:</span>
|
|
289
|
-
<span class="cred-val">admin@monitor.com</span>
|
|
290
|
-
</div>
|
|
291
|
-
<div class="cred-row">
|
|
292
|
-
<span class="cred-label">Password:</span>
|
|
293
|
-
<span class="cred-val">AdminPass123!</span>
|
|
294
|
-
</div>
|
|
295
|
-
<div class="warning">⚠️ Please change your password after initial login</div>
|
|
296
|
-
</div>
|
|
297
|
-
|
|
298
|
-
<a href="/" class="btn">Back Home</a>
|
|
299
|
-
</div>
|
|
300
|
-
</body>
|
|
301
|
-
</html>
|
|
302
|
-
`;
|
|
303
|
-
};
|
|
304
|
-
|
|
305
|
-
const PORT = process.env.PORT || 3011;
|
|
306
|
-
app.listen(PORT, () => console.log(`License Portal running on port ${PORT}`));
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
const nodemailer = require('nodemailer');
|
|
2
|
-
|
|
3
|
-
const transporter = nodemailer.createTransport({
|
|
4
|
-
host: process.env.SMTP_HOST,
|
|
5
|
-
port: parseInt(process.env.SMTP_PORT || '465'),
|
|
6
|
-
secure: process.env.SMTP_SECURE === 'true',
|
|
7
|
-
auth: {
|
|
8
|
-
user: process.env.SMTP_USER,
|
|
9
|
-
pass: process.env.SMTP_PASS
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Sends the license confirmation email
|
|
15
|
-
* @param {string} to - Recipient email
|
|
16
|
-
* @param {string} licenseKey - The generated license key
|
|
17
|
-
* @param {string} expiryDate - Expiry date string
|
|
18
|
-
*/
|
|
19
|
-
const sendLicenseEmail = async (to, licenseKey, expiryDate) => {
|
|
20
|
-
const subject = '🚀 Your Server Monitor Pro License + Credentials';
|
|
21
|
-
|
|
22
|
-
// Formatting date
|
|
23
|
-
const dateStr = new Date(expiryDate).toLocaleDateString('en-US', {
|
|
24
|
-
year: 'numeric', month: 'long', day: 'numeric'
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
const html = `
|
|
28
|
-
<!DOCTYPE html>
|
|
29
|
-
<html>
|
|
30
|
-
<head>
|
|
31
|
-
<meta charset="utf-8">
|
|
32
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
33
|
-
<title>License Key</title>
|
|
34
|
-
</head>
|
|
35
|
-
<body style="margin: 0; padding: 0; background-color: #f1f5f9; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;">
|
|
36
|
-
<table role="presentation" border="0" cellpadding="0" cellspacing="0" width="100%" style="min-width: 100%;">
|
|
37
|
-
<tr>
|
|
38
|
-
<td align="center" style="padding: 40px 0;">
|
|
39
|
-
<table role="presentation" border="0" cellpadding="0" cellspacing="0" width="600" style="background-color: #ffffff; border-radius: 16px; box-shadow: 0 10px 25px rgba(0,0,0,0.05); overflow: hidden;">
|
|
40
|
-
<!-- Header -->
|
|
41
|
-
<tr>
|
|
42
|
-
<td align="center" style="background: linear-gradient(135deg, #4f46e5, #7c3aed); padding: 40px 0;">
|
|
43
|
-
<h1 style="color: #ffffff; margin: 0; font-size: 28px; letter-spacing: 1px;">Server Monitor Pro</h1>
|
|
44
|
-
<p style="color: rgba(255,255,255,0.9); margin-top: 10px; font-size: 16px;">Thank you for your purchase!</p>
|
|
45
|
-
</td>
|
|
46
|
-
</tr>
|
|
47
|
-
|
|
48
|
-
<!-- Content -->
|
|
49
|
-
<tr>
|
|
50
|
-
<td style="padding: 40px;">
|
|
51
|
-
<h2 style="color: #1e293b; margin-top: 0; font-size: 20px;">Your License is Ready 🚀</h2>
|
|
52
|
-
<p style="color: #64748b; line-height: 1.6;">Your Payment was successful. Below are your license details and default login credentials to access the monitor dashboard.</p>
|
|
53
|
-
|
|
54
|
-
<!-- License Card -->
|
|
55
|
-
<div style="background-color: #f8fafc; border: 1px solid #e2e8f0; border-radius: 12px; padding: 25px; margin: 30px 0; text-align: center;">
|
|
56
|
-
<p style="color: #94a3b8; margin: 0 0 10px 0; text-transform: uppercase; letter-spacing: 1.5px; font-size: 12px; font-weight: 600;">License Key</p>
|
|
57
|
-
<div style="color: #4f46e5; font-size: 24px; font-weight: 700; letter-spacing: 1px; font-family: monospace; background: #fff; padding: 10px; border-radius: 8px; display: inline-block;">
|
|
58
|
-
${licenseKey}
|
|
59
|
-
</div>
|
|
60
|
-
<p style="margin-top: 15px; margin-bottom: 0; font-size: 14px; color: #64748b;">
|
|
61
|
-
<span style="color: #10b981;">● Active</span> | Valid until <strong>${dateStr}</strong>
|
|
62
|
-
</p>
|
|
63
|
-
</div>
|
|
64
|
-
|
|
65
|
-
<!-- Credentials Card -->
|
|
66
|
-
<div style="background-color: #1e293b; color: #ffffff; border-radius: 12px; padding: 25px; margin-bottom: 30px;">
|
|
67
|
-
<h3 style="margin: 0 0 15px 0; color: #38bdf8; font-size: 16px; border-bottom: 1px solid #334155; padding-bottom: 10px;">Default Admin Credentials</h3>
|
|
68
|
-
<table width="100%" cellpadding="0" cellspacing="0" border="0">
|
|
69
|
-
<tr>
|
|
70
|
-
<td style="padding: 8px 0; color: #94a3b8; width: 100px;">Username:</td>
|
|
71
|
-
<td style="padding: 8px 0; font-weight: 600; font-family: monospace; color: #ffffff;">admin@monitor.com</td>
|
|
72
|
-
</tr>
|
|
73
|
-
<tr>
|
|
74
|
-
<td style="padding: 8px 0; color: #94a3b8;">Password:</td>
|
|
75
|
-
<td style="padding: 8px 0; font-weight: 600; font-family: monospace; color: #ffffff;">AdminPass123!</td>
|
|
76
|
-
</tr>
|
|
77
|
-
</table>
|
|
78
|
-
<div style="margin-top: 15px; padding-top: 15px; border-top: 1px dotted #334155; color: #facc15; font-size: 13px;">
|
|
79
|
-
⚠️ <strong>Important:</strong> Please change your password immediately upon first login for security.
|
|
80
|
-
</div>
|
|
81
|
-
</div>
|
|
82
|
-
|
|
83
|
-
<p style="color: #64748b; font-size: 14px; line-height: 1.6;">
|
|
84
|
-
To activate, enter the license key in your monitor dashboard at port <strong>3014</strong>.
|
|
85
|
-
</p>
|
|
86
|
-
|
|
87
|
-
<table role="presentation" border="0" cellpadding="0" cellspacing="0" style="margin-top: 30px;">
|
|
88
|
-
<tr>
|
|
89
|
-
<td align="center" style="border-radius: 8px;" bgcolor="#4f46e5">
|
|
90
|
-
<a href="#" style="font-size: 16px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; border-radius: 8px; padding: 12px 24px; border: 1px solid #4f46e5; display: inline-block; font-weight: bold;">Open Dashboard</a>
|
|
91
|
-
</td>
|
|
92
|
-
</tr>
|
|
93
|
-
</table>
|
|
94
|
-
</td>
|
|
95
|
-
</tr>
|
|
96
|
-
|
|
97
|
-
<!-- Footer -->
|
|
98
|
-
<tr>
|
|
99
|
-
<td align="center" style="background-color: #f1f5f9; padding: 20px; color: #94a3b8; font-size: 12px;">
|
|
100
|
-
© ${new Date().getFullYear()} MulaSoft. All rights reserved.<br>
|
|
101
|
-
This is an automated system email.
|
|
102
|
-
</td>
|
|
103
|
-
</tr>
|
|
104
|
-
</table>
|
|
105
|
-
</td>
|
|
106
|
-
</tr>
|
|
107
|
-
</table>
|
|
108
|
-
</body>
|
|
109
|
-
</html>
|
|
110
|
-
`;
|
|
111
|
-
|
|
112
|
-
try {
|
|
113
|
-
const info = await transporter.sendMail({
|
|
114
|
-
from: process.env.MAIL_FROM,
|
|
115
|
-
to: to,
|
|
116
|
-
subject: subject,
|
|
117
|
-
html: html
|
|
118
|
-
});
|
|
119
|
-
console.log(`Email sent: ${info.messageId}`);
|
|
120
|
-
} catch (error) {
|
|
121
|
-
console.error('Error sending email:', error);
|
|
122
|
-
// We don't throw here to avoid failing the response to user, just log it.
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
module.exports = { sendLicenseEmail };
|