fix: redirect to /auth/initial-setup after hitting auth rate limit (#3408)

This commit is contained in:
Aditya kumar singh
2026-07-08 23:33:57 +05:30
parent 5cb316f4e9
commit bb5547a157
2 changed files with 14 additions and 4 deletions
+8 -3
View File
@@ -30,14 +30,19 @@ export default async function Page(props: {
const getUser = cache(verifySession);
const user = await getUser({ skipCheckVerifyEmail: true });
let complete = false;
let complete: boolean | null = null; // null means "unknown" (request errored)
try {
const setupRes = await internal.get<
AxiosResponse<InitialSetupCompleteResponse>
>(`/auth/initial-setup-complete`, await authCookieHeader());
complete = setupRes.data.data.complete;
} catch (e) {}
if (!complete) {
} catch (e) {
// Swallow errors (e.g. 429 rate limit, 500, network failure).
// Only redirect to initial-setup when the server *confirms* setup
// is incomplete (complete === false). If the request itself failed we
// cannot tell, so fall through to the login redirect instead.
}
if (complete === false) {
redirect("/auth/initial-setup");
}