snapshot of https://github.com/marmelab/atomic-crm.git (main, 2026-09-18; blobs > 131072B omitted)
Some checks failed
✅ Check / 🔬 ESLint (push) Failing after 21s
✅ Check / 🏷️ Typecheck (push) Failing after 11s
✅ Check / 🔎 Test (push) Failing after 11s
✅ Check / e2e-test (push) Failing after 11s
✅ Check / 🔨 Build (push) Failing after 11s
🚀 Deploy / 🚀 Deploy (doc) (push) Failing after 12s
🚀 Deploy / 🚀 Deploy (demo) (push) Failing after 12s
🚀 Deploy / 🚀 Deploy (supabase) (push) Failing after 18s
Some checks failed
✅ Check / 🔬 ESLint (push) Failing after 21s
✅ Check / 🏷️ Typecheck (push) Failing after 11s
✅ Check / 🔎 Test (push) Failing after 11s
✅ Check / e2e-test (push) Failing after 11s
✅ Check / 🔨 Build (push) Failing after 11s
🚀 Deploy / 🚀 Deploy (doc) (push) Failing after 12s
🚀 Deploy / 🚀 Deploy (demo) (push) Failing after 12s
🚀 Deploy / 🚀 Deploy (supabase) (push) Failing after 18s
This commit is contained in:
38
supabase/functions/update_password/index.ts
Normal file
38
supabase/functions/update_password/index.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import "jsr:@supabase/functions-js/edge-runtime.d.ts";
|
||||
import { corsHeaders, OptionsMiddleware } from "../_shared/cors.ts";
|
||||
import { createErrorResponse } from "../_shared/utils.ts";
|
||||
import { supabaseAdmin } from "../_shared/supabaseAdmin.ts";
|
||||
import { AuthMiddleware, UserMiddleware } from "../_shared/authentication.ts";
|
||||
|
||||
async function updatePassword(user: any) {
|
||||
const { data, error } = await supabaseAdmin.auth.resetPasswordForEmail(
|
||||
user.email,
|
||||
);
|
||||
|
||||
if (!data || error) {
|
||||
return createErrorResponse(500, "Internal Server Error");
|
||||
}
|
||||
|
||||
return new Response(
|
||||
JSON.stringify({
|
||||
data,
|
||||
}),
|
||||
{
|
||||
headers: { "Content-Type": "application/json", ...corsHeaders },
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Deno.serve(async (req: Request) =>
|
||||
OptionsMiddleware(req, async (req) =>
|
||||
AuthMiddleware(req, async (req) =>
|
||||
UserMiddleware(req, async (req, user) => {
|
||||
if (req.method === "PATCH") {
|
||||
return updatePassword(user);
|
||||
}
|
||||
|
||||
return createErrorResponse(405, "Method Not Allowed");
|
||||
}),
|
||||
),
|
||||
),
|
||||
);
|
||||
Reference in New Issue
Block a user