Add ban reason to profiles

This commit is contained in:
gpt-engineer-app[bot]
2025-10-30 02:51:16 +00:00
parent e0d1a66fb2
commit e5de404e59
8 changed files with 146 additions and 10 deletions

View File

@@ -51,6 +51,31 @@ export default function AuthCallback() {
const user = session.user;
// CRITICAL: Check ban status immediately after getting session
const { data: banProfile } = await supabase
.from('profiles')
.select('banned, ban_reason')
.eq('user_id', user.id)
.single();
if (banProfile?.banned) {
await supabase.auth.signOut();
const reason = banProfile.ban_reason
? `Reason: ${banProfile.ban_reason}`
: 'Contact support for assistance.';
toast({
variant: 'destructive',
title: 'Account Suspended',
description: `Your account has been suspended. ${reason}`,
duration: 10000
});
navigate('/auth');
return; // Stop OAuth processing
}
// Check if this is a new OAuth user (created within last minute)
const createdAt = new Date(user.created_at);
const now = new Date();