Update Discord verification to handle alphanumeric codes
Modify the Discord verification input to accept alphanumeric characters and update related configurations in the API and client-side components. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 9203795e-937a-4306-b81d-b4d5c78c240e Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 0ba1c751-a5b8-430c-9eb8-ed3da85d8c56 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/7c94b7a0-29c7-4f2e-94ef-44b2153872b7/9203795e-937a-4306-b81d-b4d5c78c240e/saoW2ee Replit-Helium-Checkpoint-Created: true
This commit is contained in:
parent
34e06399bd
commit
cad695b4a7
3 changed files with 7 additions and 74 deletions
4
.replit
4
.replit
|
|
@ -52,6 +52,10 @@ externalPort = 80
|
||||||
localPort = 8044
|
localPort = 8044
|
||||||
externalPort = 3003
|
externalPort = 3003
|
||||||
|
|
||||||
|
[[ports]]
|
||||||
|
localPort = 36225
|
||||||
|
externalPort = 3002
|
||||||
|
|
||||||
[[ports]]
|
[[ports]]
|
||||||
localPort = 38557
|
localPort = 38557
|
||||||
externalPort = 3000
|
externalPort = 3000
|
||||||
|
|
|
||||||
|
|
@ -1,71 +0,0 @@
|
||||||
import { createClient } from "@supabase/supabase-js";
|
|
||||||
|
|
||||||
export const config = {
|
|
||||||
runtime: "nodejs",
|
|
||||||
};
|
|
||||||
|
|
||||||
export default async function handler(req: any, res: any) {
|
|
||||||
const supabaseUrl = process.env.SUPABASE_URL || process.env.VITE_SUPABASE_URL;
|
|
||||||
const supabaseServiceRole = process.env.SUPABASE_SERVICE_ROLE;
|
|
||||||
|
|
||||||
const debug: any = {
|
|
||||||
timestamp: new Date().toISOString(),
|
|
||||||
env: {
|
|
||||||
hasSupabaseUrl: !!supabaseUrl,
|
|
||||||
supabaseUrlPrefix: supabaseUrl?.substring(0, 30) + "...",
|
|
||||||
hasServiceRole: !!supabaseServiceRole,
|
|
||||||
serviceRolePrefix: supabaseServiceRole?.substring(0, 20) + "...",
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!supabaseUrl || !supabaseServiceRole) {
|
|
||||||
return res.status(500).json({
|
|
||||||
error: "Missing environment variables",
|
|
||||||
debug,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
const supabase = createClient(supabaseUrl, supabaseServiceRole);
|
|
||||||
|
|
||||||
const { data: codes, error: codesError } = await supabase
|
|
||||||
.from("discord_verifications")
|
|
||||||
.select("verification_code, discord_id, expires_at, created_at")
|
|
||||||
.order("created_at", { ascending: false })
|
|
||||||
.limit(5);
|
|
||||||
|
|
||||||
debug.verificationCodes = {
|
|
||||||
count: codes?.length || 0,
|
|
||||||
error: codesError?.message,
|
|
||||||
codes: codes?.map((c) => ({
|
|
||||||
code: c.verification_code,
|
|
||||||
discord_id: c.discord_id?.substring(0, 6) + "...",
|
|
||||||
expires_at: c.expires_at,
|
|
||||||
is_expired: new Date(c.expires_at) < new Date(),
|
|
||||||
})),
|
|
||||||
};
|
|
||||||
|
|
||||||
const { data: links, error: linksError } = await supabase
|
|
||||||
.from("discord_links")
|
|
||||||
.select("discord_id, user_id, linked_at")
|
|
||||||
.order("linked_at", { ascending: false })
|
|
||||||
.limit(5);
|
|
||||||
|
|
||||||
debug.discordLinks = {
|
|
||||||
count: links?.length || 0,
|
|
||||||
error: linksError?.message,
|
|
||||||
};
|
|
||||||
|
|
||||||
res.status(200).json({
|
|
||||||
status: "ok",
|
|
||||||
message: "Supabase connection working",
|
|
||||||
debug,
|
|
||||||
});
|
|
||||||
} catch (error: any) {
|
|
||||||
res.status(500).json({
|
|
||||||
error: "Connection failed",
|
|
||||||
message: error?.message,
|
|
||||||
debug,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -218,15 +218,15 @@ export default function DiscordVerify() {
|
||||||
<Input
|
<Input
|
||||||
id="code"
|
id="code"
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="000000"
|
placeholder="ABC123"
|
||||||
value={verificationCode}
|
value={verificationCode}
|
||||||
onChange={(e) => setVerificationCode(e.target.value.replace(/\D/g, '').slice(0, 6))}
|
onChange={(e) => setVerificationCode(e.target.value.toUpperCase().replace(/[^A-Z0-9]/g, '').slice(0, 6))}
|
||||||
maxLength={6}
|
maxLength={6}
|
||||||
disabled={isLoading}
|
disabled={isLoading}
|
||||||
className="text-center text-3xl font-bold tracking-[0.5em] border-2 border-indigo-500/50 focus:border-indigo-500 bg-background/60 hover:bg-background/80 transition-colors"
|
className="text-center text-3xl font-bold tracking-[0.5em] border-2 border-indigo-500/50 focus:border-indigo-500 bg-background/60 hover:bg-background/80 transition-colors"
|
||||||
/>
|
/>
|
||||||
<p className="text-xs text-muted-foreground text-center">
|
<p className="text-xs text-muted-foreground text-center">
|
||||||
Enter the 6-digit code from Discord
|
Enter the 6-character code from Discord
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue