fix(frontend): Use FRONTEND_BASE_URL to make password reset link (#10102)

- Fixes #9215

- [x] ⚠️ Merge first:
https://github.com/Significant-Gravitas/AutoGPT_cloud_infrastructure/pull/93

### Changes 🏗️

- Use `FRONTEND_BASE_URL` instead of Host header to make password reset
redirect link

### Checklist 📋

#### For code changes:
- [x] I have clearly listed my changes in the PR description
- [x] I have made a test plan
- [x] I have tested my changes according to the test plan:
- [x] Resetting password gives an e-mail with a link that points to the
correct URL

#### For configuration changes:
- [x] `.env.example` is updated or already compatible with my changes
- [x] `docker-compose.yml` is updated or already compatible with my
changes
- [x] I have included a list of my configuration changes in the PR
description (under **Changes**)
This commit is contained in:
Reinier van der Leer
2025-06-05 16:48:35 +01:00
committed by GitHub
parent 7d10dc4e7b
commit 96df40f7b6
2 changed files with 4 additions and 7 deletions

View File

@@ -1,3 +1,5 @@
FRONTEND_BASE_URL=http://localhost:3000
NEXT_PUBLIC_AUTH_CALLBACK_URL=http://localhost:8006/auth/callback
NEXT_PUBLIC_AGPT_SERVER_URL=http://localhost:8006/api
NEXT_PUBLIC_AGPT_WS_SERVER_URL=ws://localhost:8001/ws
@@ -19,7 +21,7 @@ NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyAgCiAgICAic
## OAuth Callback URL
## This should be {domain}/auth/callback
## Only used if you're using Supabase and OAuth
AUTH_CALLBACK_URL=http://localhost:3000/auth/callback
AUTH_CALLBACK_URL="${FRONTEND_BASE_URL}/auth/callback"
GA_MEASUREMENT_ID=G-FH2XK2W4GN
# When running locally, set NEXT_PUBLIC_BEHAVE_AS=CLOUD to use the a locally hosted marketplace (as is typical in development, and the cloud deployment), otherwise set it to LOCAL to have the marketplace open in a new tab

View File

@@ -2,7 +2,6 @@
import getServerSupabase from "@/lib/supabase/getServerSupabase";
import { redirect } from "next/navigation";
import * as Sentry from "@sentry/nextjs";
import { headers } from "next/headers";
import { verifyTurnstileToken } from "@/lib/turnstile";
export async function sendResetEmail(email: string, turnstileToken: string) {
@@ -11,11 +10,7 @@ export async function sendResetEmail(email: string, turnstileToken: string) {
{},
async () => {
const supabase = getServerSupabase();
const headersList = await headers();
const host = headersList.get("host");
const protocol =
process.env.NODE_ENV === "development" ? "http" : "https";
const origin = `${protocol}://${host}`;
const origin = process.env.FRONTEND_BASE_URL || "http://localhost:3000";
if (!supabase) {
redirect("/error");