mirror of
https://github.com/jcreek/LivingDexTracker.git
synced 2026-09-14 17:42:17 +00:00
fix: remediate branch review findings
This commit is contained in:
@@ -43,34 +43,6 @@ export async function deleteAllPokedexes(state: ScenarioState): Promise<void> {
|
||||
if (!response.ok) throw new Error(`Unable to clear Pokédexes: ${await response.text()}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asks Supabase for a real recovery action link - the same token-bearing URL the emailed link
|
||||
* carries - so the reset scenarios exercise token verification rather than an ordinary session.
|
||||
* `redirectTo` must be listed in `auth.additional_redirect_urls` in supabase/config.toml.
|
||||
*/
|
||||
export async function createRecoveryLink(
|
||||
state: ScenarioState,
|
||||
redirectTo: string
|
||||
): Promise<string> {
|
||||
const key = requireServiceRoleKey();
|
||||
const response = await fetch(`${SUPABASE_URL}/auth/v1/admin/generate_link`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
apikey: key,
|
||||
Authorization: `Bearer ${key}`,
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({ type: 'recovery', email: state.email, redirect_to: redirectTo })
|
||||
});
|
||||
if (!response.ok)
|
||||
throw new Error(
|
||||
`Unable to generate a recovery link: ${response.status} ${await response.text()}`
|
||||
);
|
||||
const body = (await response.json()) as { action_link?: string };
|
||||
if (!body.action_link) throw new Error('Supabase returned no recovery action link');
|
||||
return body.action_link;
|
||||
}
|
||||
|
||||
export async function signIn(page: Page, state: ScenarioState, password = state.password) {
|
||||
await page.goto('/signin');
|
||||
await page.getByLabel('Email').fill(state.email);
|
||||
|
||||
Reference in New Issue
Block a user