Compare commits
2 Commits
dc0f7f51c5
...
2fda27a329
| Author | SHA1 | Date |
|---|---|---|
|
|
2fda27a329 | |
|
|
a505ce6ca7 |
|
|
@ -89,11 +89,14 @@ Deno.serve(async (request) => {
|
||||||
const clientIp = getClientIp(request);
|
const clientIp = getClientIp(request);
|
||||||
const userAgent = request.headers.get("user-agent") || null;
|
const userAgent = request.headers.get("user-agent") || null;
|
||||||
|
|
||||||
// Insert with OTP hash only — no plaintext in DB
|
// Insert with OTP hash for verification. otp_code (plaintext) is also stored
|
||||||
|
// because DB has it NOT NULL and the send_pin trigger (→ n8n webhook) emails
|
||||||
|
// this exact code to the user. verify-otp still compares the SHA-256 hash.
|
||||||
const { error: insertError } = await supabase.from("login_otps").insert({
|
const { error: insertError } = await supabase.from("login_otps").insert({
|
||||||
email,
|
email,
|
||||||
name: userName,
|
name: userName,
|
||||||
role: userRole,
|
role: userRole,
|
||||||
|
otp_code: otp,
|
||||||
otp_code_hash: otpCodeHash,
|
otp_code_hash: otpCodeHash,
|
||||||
ip_address: clientIp,
|
ip_address: clientIp,
|
||||||
user_agent: userAgent,
|
user_agent: userAgent,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue