Fix captcha not rendering on admin login: route through /api/gateway proxy
All checks were successful
build-and-release / build (push) Successful in 47s
All checks were successful
build-and-release / build (push) Successful in 47s
/api/auth/captcha has no server route in this SolidStart app (only /api/admin/* and /api/gateway/* are proxied to the backend), so the request was silently falling through to the SPA's index.html (200, text/html) instead of hitting the real endpoint — captchaChallenge stayed empty and the canvas rendered blank. Use the existing generic /api/gateway/* proxy instead, which already resolves auth/* paths correctly. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
47f36a3d69
commit
69479291c9
1 changed files with 4 additions and 1 deletions
|
|
@ -40,10 +40,13 @@ export default function LoginPage() {
|
|||
// The employees service (which backs /api/admin/auth/login) requires the
|
||||
// same server-side captcha challenge the public site uses — generated by
|
||||
// the users service at /api/auth/captcha and verified against shared Redis.
|
||||
// Routed through /api/gateway/* (this app's generic gateway proxy) rather
|
||||
// than a bare /api/auth/* path — there is no server route for that prefix,
|
||||
// so it would otherwise silently fall through to the SPA's index.html.
|
||||
const loadCaptcha = async () => {
|
||||
setCaptchaInput('');
|
||||
try {
|
||||
const r = await fetch('/api/auth/captcha', { method: 'POST', headers: { Accept: 'application/json' }, credentials: 'include' });
|
||||
const r = await fetch('/api/gateway/auth/captcha', { method: 'POST', headers: { Accept: 'application/json' }, credentials: 'include' });
|
||||
const payload = await r.json().catch(() => ({}));
|
||||
setCaptchaId(String(payload?.captcha_id || ''));
|
||||
setCaptchaChallenge(String(payload?.challenge || ''));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue