Refactor: Secure email confirmation flow

This commit is contained in:
gpt-engineer-app[bot]
2025-10-01 15:50:27 +00:00
parent ba04dbc966
commit 5634dc4920
2 changed files with 65 additions and 12 deletions

View File

@@ -117,15 +117,8 @@ export function EmailChangeDialog({ open, onOpenChange, currentEmail, userId }:
if (updateError) throw updateError;
// Step 3: Update Novu subscriber (non-blocking)
if (notificationService.isEnabled()) {
notificationService.updateSubscriber({
subscriberId: userId,
email: data.newEmail,
}).catch(error => {
console.error('Failed to update Novu subscriber:', error);
});
}
// Step 3: Novu subscriber will be updated automatically after both emails are confirmed
// This happens in the useAuth hook when the email change is fully verified
// Step 4: Log the email change attempt
supabase.from('admin_audit_log').insert({