-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into prod/festapp
- Loading branch information
Showing
11 changed files
with
66 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ import { sendEmailWithSubs } from "../_shared/emailClient.ts"; | |
import { createClient } from 'https://esm.sh/@supabase/[email protected]'; | ||
|
||
const _DEFAULT_EMAIL = Deno.env.get("DEFAULT_EMAIL")!; | ||
const _supabase = createClient( | ||
const supabaseAdmin = createClient( | ||
Deno.env.get('SUPABASE_URL')!, | ||
Deno.env.get('SUPABASE_SERVICE_ROLE_KEY')! | ||
); | ||
|
@@ -21,7 +21,7 @@ Deno.serve(async (req) => { | |
const userEmail = reqData.email ? reqData.email.toLowerCase() : "[email protected]"; | ||
const organization = reqData.organization; | ||
|
||
const orgData = await _supabase | ||
const orgData = await supabaseAdmin | ||
.from("organizations") | ||
.select("data") | ||
.eq("id", organization) | ||
|
@@ -39,7 +39,7 @@ Deno.serve(async (req) => { | |
const appName = orgConfig.APP_NAME || "DefaultAppName"; | ||
const defaultUrl = orgConfig.DEFAULT_URL || "http://default.url"; | ||
|
||
const userData = await _supabase | ||
const userData = await supabaseAdmin | ||
.from("user_info") | ||
.select() | ||
.eq("organization", organization) | ||
|
@@ -56,19 +56,19 @@ Deno.serve(async (req) => { | |
const userId = userData.data.id; | ||
const token = crypto.randomUUID(); | ||
|
||
await _supabase | ||
await supabaseAdmin | ||
.from("user_reset_token") | ||
.delete() | ||
.eq("user", userId); | ||
|
||
await _supabase | ||
await supabaseAdmin | ||
.from("user_reset_token") | ||
.insert({ | ||
"user": userId, | ||
"token": token, | ||
}); | ||
|
||
const template = await _supabase | ||
const template = await supabaseAdmin | ||
.from("email_templates") | ||
.select() | ||
.eq("id", "RESET_PASSWORD") | ||
|
@@ -96,7 +96,7 @@ Deno.serve(async (req) => { | |
from: `${appName} | Festapp <${_DEFAULT_EMAIL}>`, | ||
}); | ||
|
||
await _supabase | ||
await supabaseAdmin | ||
.from("log_emails") | ||
.insert({ | ||
"from": _DEFAULT_EMAIL, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ import { createClient } from 'https://esm.sh/@supabase/[email protected]'; | |
|
||
const _DEFAULT_EMAIL = Deno.env.get("DEFAULT_EMAIL")!; | ||
|
||
const _supabase = createClient( | ||
const supabaseAdmin = createClient( | ||
Deno.env.get('SUPABASE_URL')!, | ||
Deno.env.get('SUPABASE_SERVICE_ROLE_KEY')! | ||
); | ||
|
@@ -22,7 +22,7 @@ Deno.serve(async (req) => { | |
const userEmail = reqData.email.trim(); | ||
const organizationId = reqData.organization; | ||
|
||
const orgData = await _supabase | ||
const orgData = await supabaseAdmin | ||
.from("organizations") | ||
.select("data") | ||
.eq("id", organizationId) | ||
|
@@ -51,7 +51,7 @@ Deno.serve(async (req) => { | |
); | ||
} | ||
|
||
const userData = await _supabase | ||
const userData = await supabaseAdmin | ||
.from("user_info") | ||
.select() | ||
.eq("email_readonly", userEmail) | ||
|
@@ -67,14 +67,14 @@ Deno.serve(async (req) => { | |
|
||
const code = Math.floor(100000 + Math.random() * 900000).toString(); | ||
|
||
const { data } = await _supabase.rpc("create_user_in_organization_with_data", { | ||
const { data } = await supabaseAdmin.rpc("create_user_in_organization_with_data", { | ||
org: organizationId, | ||
email: userEmail, | ||
password: code, | ||
data: reqData, | ||
}); | ||
|
||
const template = await _supabase | ||
const template = await supabaseAdmin | ||
.from("email_templates") | ||
.select() | ||
.eq("id", "SIGN_IN_CODE") | ||
|
@@ -93,7 +93,7 @@ Deno.serve(async (req) => { | |
from: `${appName} | Festapp <${_DEFAULT_EMAIL}>`, | ||
}); | ||
|
||
await _supabase | ||
await supabaseAdmin | ||
.from("log_emails") | ||
.insert({ | ||
"from": _DEFAULT_EMAIL, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters