Skip to content

Implement user profile editing for logged-in users #20

@aolguin89

Description

@aolguin89

User Story

As a logged-in user
I want to update my profile information
So that I can keep my account details current

Description

Create profile page where users can update their own information (except username and role).

Prerequisites

  • User model and DAO already exist
  • Login system implemented

Tasks

Servlet

  • Create ProfileServlet.java in controller/ package
  • Handle GET: display current user's profile form
  • Handle POST: process profile update
  • Validate input fields
  • Prevent modification of: username, role, created_at
  • Allow modification of: email, first name, last name, DNI, address, phone, birth date, gender
  • Check email uniqueness (excluding current user)
  • Update database using UserDAO.update()
  • Show success/error message
  • Configure servlet mapping (/profile)

View

  • Create profile.jsp in /WEB-INF/views/
  • Use layout includes
  • Profile form with current values pre-filled
  • Display username and role (read-only/disabled)
  • Editable fields: email, first name, last name, DNI, address, phone, birth date, gender
  • Optional: Change password section (separate form)
  • Success/error messages
  • Cancel button (back to dashboard)

Navbar Update

  • Add "Profile" link in user dropdown menu
  • Show for all authenticated users

Acceptance Criteria

  • User sees their current profile data
  • Can update editable fields
  • Cannot change username or role
  • Email uniqueness validated (excluding self)
  • Success message after update
  • Error message if validation fails
  • Changes persist in database
  • Session user data updated after edit (optional)

Metadata

Metadata

Assignees

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions