chore(admin-ui): generic login copy; trim infra hints in comments and .env.example
This commit is contained in:
1 parent
83308b465b
commit
a3b65b4b3f
3 files changed
+7
-14
No files matched your search
@@ -1,10 +1,8 @@
|
||||
# Base URL da API admin (Fastify) quando existir (BIT-179). Sem trailing slash.
|
||||
# Usada pelo servidor Next para SSR (pode ser http://127.0.0.1:3200 no LXC).
|
||||
# URL base da API para dados no servidor (SSR). Sem trailing slash.
|
||||
# ERROR_REPORTING_ADMIN_API_BASE=http://127.0.0.1:3200
|
||||
|
||||
# Origem que o *browser* usa para POST /admin/auth/login (mesmo hostname que a UI
|
||||
# quando o proxy encaminha /admin/* para a API). Opcional: omite para usar window.location.origin.
|
||||
# NEXT_PUBLIC_ERROR_REPORTING_AUTH_ORIGIN=https://errors.bitreport.pt
|
||||
# Origem opcional para pedidos de login no browser; por omissão usa o hostname actual.
|
||||
# NEXT_PUBLIC_ERROR_REPORTING_AUTH_ORIGIN=https://example.invalid
|
||||
|
||||
# Apenas com NODE_ENV=development: dados fictícios sem API (não confiar em "!== production" no Edge).
|
||||
# ERROR_REPORTING_UI_DEMO=1
|
||||
|
||||
@@ -3,11 +3,7 @@
|
||||
import { useSearchParams } from "next/navigation";
|
||||
import { type FormEvent, Suspense, useState } from "react";
|
||||
|
||||
/**
|
||||
* Public origin for admin auth API (browser). Prefer same host as this UI so
|
||||
* `__Host-access` cookies apply (NPM should proxy `/admin/*` to Fastify `api/`).
|
||||
* Fallback: current origin.
|
||||
*/
|
||||
/** Base URL for the login request; defaults to this site’s origin. */
|
||||
function _authBase(): string {
|
||||
const _env = process.env.NEXT_PUBLIC_ERROR_REPORTING_AUTH_ORIGIN?.trim();
|
||||
if (_env) {
|
||||
@@ -50,7 +46,7 @@ function LoginForm() {
|
||||
const _data = (await _res.json().catch(() => ({}))) as { error?: string; message?: string };
|
||||
setError(_data?.message ?? _data?.error ?? "Credenciais inválidas.");
|
||||
} catch {
|
||||
setError("Não foi possível contactar o servidor. Verifique a rede e o proxy `/admin/*`.");
|
||||
setError("Não foi possível completar o pedido. Tente novamente ou contacte o suporte.");
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
@@ -111,8 +107,7 @@ function LoginForm() {
|
||||
</form>
|
||||
|
||||
<p className="text-muted small mt-3 mb-0">
|
||||
O proxy público deve encaminhar <code>/admin/*</code> para a API Fastify (porta do
|
||||
serviço <code>api/</code>) no mesmo hostname, para as cookies HTTP-only funcionarem.
|
||||
Precisa de ajuda? Contacte o administrador da sua organização.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { NextRequest } from "next/server";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
/** Matches Fastify admin auth cookie name (`api/src/plugins/auth.ts`). */
|
||||
/** Admin session cookie checked by middleware. */
|
||||
const ACCESS_COOKIE = "__Host-access";
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user