Skip to content

Implement user registration form for new students #19

@aolguin89

Description

@aolguin89

User Story

As a new student
I want to register an account
So that I can enroll in courses and take exams

Description

Create public registration form for students to create their own accounts.

Prerequisites

  • User model and DAO already exist (completed)

Tasks

Servlet

  • Create RegisterServlet.java in controller/ package
  • Handle GET: display registration form
  • Handle POST: process registration
  • Validate input fields (required, format, uniqueness)
  • Hash password with SHA2 before storing
  • Set role to 'student' by default
  • Set is_active to true
  • Redirect to login page on success
  • Configure servlet mapping (/register)

View

  • Create register.jsp (public, not in WEB-INF)
  • Use layout includes (header, footer, navbar)
  • Registration form with fields:
    • Username (required, unique)
    • Email (required, unique)
    • Password (required, min 6 chars)
    • Confirm password (must match)
    • First name (required)
    • Last name (required)
    • DNI (optional)
    • Phone (optional)
    • Birth date (optional)
    • Gender (optional)
  • Client-side validation (HTML5 + optional JavaScript)
  • Display error messages for validation failures

Validation

  • Username: 3-50 chars, alphanumeric + underscore only
  • Email: valid email format, unique in database
  • Password: minimum 6 characters
  • Confirm password matches
  • Check username and email uniqueness before insert
  • Display field-specific error messages

Navbar Update

  • Add "Register" link (only when not logged in)
  • Show on login.jsp and index.jsp

Acceptance Criteria

  • Registration form validates all inputs
  • Duplicate username/email prevented with clear error
  • Password confirmation works
  • New user created with role 'student'
  • Success: redirect to login with message
  • Failure: show form with error messages (preserve valid fields)
  • "Register" link visible to anonymous users only

Metadata

Metadata

Assignees

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions