feat: SMTP integration, dynamic app_settings for email, and email verification enforcement for tier upgrades
This commit is contained in:
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user