Skip to content

Enable working login/registration flow and enrich CoreFit homepage UI - #2

Merged
JacinthaJanice merged 1 commit into
mainfrom
copilot/make-login-registration-functional
Jul 28, 2026
Merged

Enable working login/registration flow and enrich CoreFit homepage UI#2
JacinthaJanice merged 1 commit into
mainfrom
copilot/make-login-registration-functional

Conversation

Copilot AI commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Login and registration were wired to missing/incompatible backend endpoints, so auth flows could not complete. The homepage also lacked meaningful content, making the post-login experience feel empty.

  • Auth API alignment (server.js)

    • Added GET /api/test health endpoint used by existing frontend checks.
    • Added POST /api/register with required-field validation, duplicate-email prevention, and password hashing (bcryptjs).
    • Added POST /api/login with credential validation and normalized user payload for session storage.
    • Enabled CORS for browser-based local frontend/backend interaction.
  • Registration flow fixes (registration.html)

    • Kept payload shape aligned with backend auth contract.
    • Corrected success redirect to home.html and added direct login path for existing users.
  • Homepage UX upgrade (home.html, index.html)

    • Reworked the main content from a near-empty panel into structured sections (hero, quick overview, feature cards).
    • Added dynamic summary cards populated from sessionStorage (goal, weight, program) to make the landing screen immediately informative.
app.post("/api/login", async (req, res) => {
  const email = normalizeEmail(req.body.email);
  const user = users.find((row) => normalizeEmail(getField(row, ["email", "Email"])) === email);
  const isValidPassword = await bcrypt.compare(password, storedHash);
  if (!isValidPassword) return res.status(401).json({ error: "Invalid email or password" });

  res.json({ success: true, message: "Login successful", user: safeUser });
});

@vercel

vercel Bot commented Jul 28, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
project-phase-ii Error Error Jul 28, 2026 3:36pm

@JacinthaJanice

Copy link
Copy Markdown
Collaborator

is it

@JacinthaJanice
JacinthaJanice marked this pull request as ready for review July 28, 2026 15:37
Copilot AI review requested due to automatic review settings July 28, 2026 15:37
@JacinthaJanice
JacinthaJanice merged commit 3ffb9cb into main Jul 28, 2026
1 of 2 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request aligns the CoreFit frontend authentication flow with a Node/Express backend by adding health/auth endpoints, and upgrades the post-login homepage UI to show a more informative, session-driven overview.

Changes:

  • Added GET /api/test, POST /api/register, and POST /api/login endpoints in server.js, including email normalization and bcrypt password hashing.
  • Updated registration success redirect behavior and expanded homepage layouts with hero/overview/feature sections.
  • Populated new homepage “quick overview” cards from sessionStorage (goal/weight/program).

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
server.js Adds CORS + new health/auth endpoints and user persistence to Excel.
registration.html Tweaks registration UX (login link + redirect to home.html).
index.html Expands homepage UI and adds session-driven overview cards.
home.html Mirrors homepage UI upgrades and session-driven overview cards.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread server.js
Comment on lines 9 to 11
const app = express();
app.use(cors());
app.use(bodyParser.json());
Comment thread server.js
Comment on lines +136 to +140
const storedHash = String(getField(user, ["passwordHash", "PasswordHash", "password", "Password"]));
const isValidPassword = storedHash ? await bcrypt.compare(password, storedHash) : false;
if (!isValidPassword) {
return res.status(401).json({ error: "Invalid email or password" });
}
Comment thread index.html
Comment on lines 279 to 283
@@ -207,6 +282,9 @@ <h2>Welcome to CoreFit!</h2>
<p><i class="fas fa-dumbbell"></i> Goal: ${goal}</p>
<p><i class="fas fa-weight"></i> Weight: ${weight} kg</p>
Comment thread home.html
Comment on lines 279 to 283
@@ -207,6 +282,9 @@ <h2>Welcome to CoreFit!</h2>
<p><i class="fas fa-dumbbell"></i> Goal: ${goal}</p>
<p><i class="fas fa-weight"></i> Weight: ${weight} kg</p>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants