diff --git a/frontend-source.tar.gz b/frontend-source.tar.gz deleted file mode 100644 index 8208f53..0000000 Binary files a/frontend-source.tar.gz and /dev/null differ diff --git a/frontend/src/app/login/page.tsx b/frontend/src/app/login/page.tsx index c16120a..3bafc83 100644 --- a/frontend/src/app/login/page.tsx +++ b/frontend/src/app/login/page.tsx @@ -83,7 +83,15 @@ export default function LoginPage() { } catch (err: any) { console.error('🔥 [LOGIN FRONT] Erro no login:', err); console.error('🔥 [LOGIN FRONT] Detalhes:', err.response?.data || err.message); - setError(err.message || t("auth.login.errors.generic")); + + const errorMessage = err.message; + if (errorMessage === "AUTH_INVALID_CREDENTIALS") { + setError(t("auth.login.errors.invalidCredentials")); + } else if (errorMessage === "AUTH_SERVER_ERROR") { + setError(t("auth.login.errors.serverError")); + } else { + setError(t("auth.login.errors.generic")); + } } finally { setLoading(false); } diff --git a/frontend/src/components/dashboard-header.tsx b/frontend/src/components/dashboard-header.tsx index 1eaec68..ec9ab21 100644 --- a/frontend/src/components/dashboard-header.tsx +++ b/frontend/src/components/dashboard-header.tsx @@ -69,7 +69,11 @@ export function DashboardHeader() { alt={user?.name} /> - {user?.name ? getInitials(user.name) : "U"} + {user?.name + ? getInitials(user.name) + : user?.email + ? getInitials(user.email.split('@')[0]) + : "U"} diff --git a/frontend/src/i18n/en.json b/frontend/src/i18n/en.json index 9208c60..0b80b1b 100644 --- a/frontend/src/i18n/en.json +++ b/frontend/src/i18n/en.json @@ -256,7 +256,8 @@ "password": "Password must be at least 3 characters" }, "errors": { - "invalidCredentials": "Invalid username or password.", + "invalidCredentials": "Incorrect email or password. Please try again.", + "serverError": "Server error. Please try again later.", "generic": "Error signing in. Please try again." } }, diff --git a/frontend/src/i18n/es.json b/frontend/src/i18n/es.json index 4aa95d2..8d2af4b 100644 --- a/frontend/src/i18n/es.json +++ b/frontend/src/i18n/es.json @@ -256,7 +256,8 @@ "password": "La contraseña debe tener al menos 3 caracteres" }, "errors": { - "invalidCredentials": "Usuario o contraseña inválidos.", + "invalidCredentials": "Correo electrónico o contraseña incorrectos. Por favor inténtalo de nuevo.", + "serverError": "Error del servidor. Por favor inténtalo más tarde.", "generic": "Error al iniciar sesión. Inténtalo de nuevo." } }, diff --git a/frontend/src/i18n/pt-BR.json b/frontend/src/i18n/pt-BR.json index 3e91a53..737f7de 100644 --- a/frontend/src/i18n/pt-BR.json +++ b/frontend/src/i18n/pt-BR.json @@ -256,7 +256,8 @@ "password": "Senha deve ter pelo menos 3 caracteres" }, "errors": { - "invalidCredentials": "Usuário ou senha inválidos.", + "invalidCredentials": "E-mail ou senha incorretos. Por favor, tente novamente.", + "serverError": "Erro no servidor. Por favor, tente mais tarde.", "generic": "Erro ao fazer login. Tente novamente." } }, diff --git a/frontend/src/lib/auth.ts b/frontend/src/lib/auth.ts index f9c7bc8..dd6c1e1 100644 --- a/frontend/src/lib/auth.ts +++ b/frontend/src/lib/auth.ts @@ -36,9 +36,9 @@ export async function login( if (!res.ok) { if (res.status === 401) { - throw new Error("Credenciais inválidas"); + throw new Error("AUTH_INVALID_CREDENTIALS"); } - throw new Error("Erro no servidor"); + throw new Error("AUTH_SERVER_ERROR"); } const data: LoginResponse = await res.json(); @@ -199,7 +199,7 @@ export async function registerCandidate(data: RegisterCandidateData): Promise ({})); console.error('[registerCandidate] Error response:', res.status, errorData); - throw new Error(errorData.message || `Erro no registro: ${res.status}`); + throw new Error(errorData.message || `Registration failed: ${res.status}`); } const responseData = await res.json().catch(() => ({})); @@ -246,7 +246,7 @@ export async function registerCompany(data: RegisterCompanyData): Promise if (!res.ok) { const errorData = await res.json().catch(() => ({})); console.error('[registerCompany] Error response:', res.status, errorData); - throw new Error(errorData.message || `Erro no registro: ${res.status}`); + throw new Error(errorData.message || `Registration failed: ${res.status}`); } const responseData = await res.json().catch(() => ({})); diff --git a/seeder-api/src/seeders/location-loader.js b/seeder-api/src/seeders/location-loader.js index c198582..790b0e9 100644 --- a/seeder-api/src/seeders/location-loader.js +++ b/seeder-api/src/seeders/location-loader.js @@ -73,8 +73,9 @@ function transformSubregionsInsert(stmt) { // To: [id, name, continent_id, translations, created, updated, flag, wiki_data_id] if (values.length >= 8) { const [id, name, translations, region_id, created, updated, flag, wikiDataId] = values; + console.log(`DEBUG: Subregions reorder: id=${id}, region=${region_id}`); const reordered = [id, name, region_id, translations, created, updated, flag, wikiDataId]; - return `INSERT INTO subregions (id, name, continent_id, translations, created_at, updated_at, flag, wiki_data_id) VALUES (${reordered.join(', ')});`; + return `INSERT INTO public.subregions (id, name, continent_id, translations, created_at, updated_at, flag, wiki_data_id) VALUES (${reordered.join(', ')});`; } return stmt; @@ -92,7 +93,10 @@ function transformSubregionsInsert(stmt) { */ function transformCountriesInsert(stmt) { const valuesMatch = stmt.match(/VALUES\s*\((.+)\);?$/is); - if (!valuesMatch) return stmt; + if (!valuesMatch) { + console.log('DEBUG: Regex failed for subregions!'); + return stmt; + } const valuesStr = valuesMatch[1]; const values = parseValues(valuesStr); @@ -313,7 +317,8 @@ async function executeSqlFile(filename, tableName) { } // Apply special transformations for subregions (column reordering) - if (pgStmt.includes('INSERT INTO subregions')) { + if (pgStmt.includes('INSERT INTO subregions') || pgStmt.includes('INSERT INTO public.subregions')) { + console.log('DEBUG: Transforming subregions insert...'); pgStmt = transformSubregionsInsert(pgStmt); }