Skip to content

feat: Login/Auth/i18n: TDD implementation with post-login UX fixes#42

Draft
Copilot wants to merge 17 commits intomainfrom
copilot/add-login-auth-i18n-tests
Draft

feat: Login/Auth/i18n: TDD implementation with post-login UX fixes#42
Copilot wants to merge 17 commits intomainfrom
copilot/add-login-auth-i18n-tests

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 5, 2026

Adds full authentication flow, bilingual support (PT-BR/EN-US), and post-login UX improvements to DataForgeTest following strict TDD (Red → Green → Refactor).

Auth & Session (Backend + Frontend)

  • POST /api/auth/validate Flask blueprint — 200/401/400; password_hash never leaves the server
  • authStorage.jslocalStorage session with 8h/7d (rememberMe) expiry; passwordHash never persisted
  • data/users.js — in-memory user store (3 demo accounts); migration path to API documented inline
  • useAuth.jshandleLogin with 1200ms simulated latency + bilingual error objects { 'pt-BR': '...', 'en-US': '...' }

Routing & Protection

  • ProtectedRoute — three states: loading spinner → /login + state.from (unauthenticated) → /login + state.step (no profile) → children
  • App.js/login public; all other routes wrapped in <ProtectedRoute>; SupportButton hidden on /login
  • index.js<LanguageProvider><AuthProvider><App />

i18n

  • LanguageContextuseLanguage() hook, persists to localStorage('dataforgetest_language')
  • LanguageToggle — PT-BR/EN-US toggle with data-testid="language-toggle"; size='sm'|'md'
  • MethodologyPage migrated from local useState('pt-BR') to global useLanguage()
  • commonTranslations.js — shared keys (backToHome, loading, etc.) for internal pages

LoginPage

Full-page component: AnimatedBackground (25 floating tech-label nodes), two-step machine (login → profile), 8 role cards, right panel with pipeline + stats. Live detection feed removed — the setInterval AnimatePresence feed caused page-jump artifacts on every 3s update with no real data value.

HomePage Additions

  • HomeHeader — sticky top bar with logo, translated nav links, LanguageToggle, user avatar/name, logout
  • HomeFooter — copyright, tech stack, version; translations shared with LoginPage footer
  • All hero/section/button text driven by translations[language]

Tests

7 new test files (TDD commit 1), then implementation (commit 2). Updated App.test.js and MethodologyPage.test.js for new context providers. 502 frontend tests passing.

Note: frontend/src/data/users.js required a .gitignore exception — root data/ glob was silently excluding it. src/auth/ uses werkzeug password hashing; useAuth.js has a TODO comment marking the swap point from REGISTERED_USERS to fetch('/api/auth/validate').


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 5, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
data-forge-test Ready Ready Preview, Comment Mar 20, 2026 3:20am
smart-data-test Ready Ready Preview, Comment Mar 20, 2026 3:20am

Co-authored-by: Icar0S <39846852+Icar0S@users.noreply.github.com>
Co-authored-by: Icar0S <39846852+Icar0S@users.noreply.github.com>
…green

Co-authored-by: Icar0S <39846852+Icar0S@users.noreply.github.com>
Copilot AI changed the title [WIP] Add tests for login page and authentication components Add Login Page, Auth system, and i18n (PT-BR/EN-US) via TDD Mar 5, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 5, 2026

🧪 PR Test Summary

Suite Status
Backend — Unit ✅ success
Backend — API ✅ success
Backend — Security ✅ success
Frontend — Coverage ✅ success

Coverage thresholds: Statements 80% · Branches 70% · Functions 75% · Lines 80%

📦 View artifacts

@Icar0S Icar0S changed the title Add Login Page, Auth system, and i18n (PT-BR/EN-US) via TDD feat: add Login Page, Auth system, and i18n (PT-BR/EN-US) using TDD Mar 5, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 5, 2026

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
1373 1188 87% 80% 🟢

New Files

File Coverage Status
frontend/src/components/LanguageToggle.js 100% 🟢
frontend/src/components/ProtectedRoute.js 100% 🟢
frontend/src/context/AuthContext.js 100% 🟢
frontend/src/context/LanguageContext.js 100% 🟢
frontend/src/data/users.js 100% 🟢
frontend/src/hooks/useAuth.js 100% 🟢
frontend/src/hooks/useStats.js 100% 🟢
frontend/src/pages/LoginPage.js 100% 🟢
frontend/src/utils/authStorage.js 100% 🟢
frontend/src/utils/commonTranslations.js 100% 🟢
TOTAL 100% 🟢

Modified Files

File Coverage Status
frontend/src/App.js 100% 🟢
frontend/src/components/HomePage.js 93% 🟢
frontend/src/pages/MethodologyPage.js 83% 🟢
frontend/src/styles/animations.js 100% 🟢
TOTAL 94% 🟢

updated for commit: e087bac by action🐍

Co-authored-by: Icar0S <39846852+Icar0S@users.noreply.github.com>
Copilot AI changed the title feat: add Login Page, Auth system, and i18n (PT-BR/EN-US) using TDD Login/Auth/i18n: TDD implementation with post-login UX fixes Mar 5, 2026
@Icar0S Icar0S changed the title Login/Auth/i18n: TDD implementation with post-login UX fixes feat: Login/Auth/i18n: TDD implementation with post-login UX fixes Mar 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants