feat: SMTP integration, dynamic app_settings for email, and email verification enforcement for tier upgrades

This commit is contained in:
Mohan Ki
2026-07-27 18:54:19 +05:30
parent 41e333b30e
commit b328b0429a
9 changed files with 273 additions and 2 deletions
+7
View File
@@ -63,6 +63,13 @@ router.put('/users/:id/tier', async (req, res) => {
}
try {
if (role === 'pro' || role === 'enterprise') {
const userCheck = await pgPool.query('SELECT is_email_verified FROM users WHERE id = $1', [id]);
if (userCheck.rows.length === 0) return res.status(404).json({ error: 'User not found' });
if (!userCheck.rows[0].is_email_verified) {
return res.status(400).json({ error: 'Cannot upgrade tier: User email is not verified' });
}
}
const result = await pgPool.query(
'UPDATE users SET role = $1 WHERE id = $2 RETURNING id, email, role',
[role, id]