Authenticate a user
This endpoint authenticates a user using their email and password credentials.Request parameters
The user’s email address
The user’s password
Request example
Response
Redirects to the home session page upon successful authentication
A new session is created and the session ID is returned in a cookie
Success response
Upon successful authentication, a new session is created and the user is redirected to the home session. Status Code:302 Found
Location: /Home
Set-Cookie: Session cookie with regenerated session ID
Session management
When a user successfully logs in:- The provided credentials (email and password) are verified against the database
- If valid, a new session is created
- The session is regenerated for security purposes
- The user is redirected to the home session page
- Subsequent requests must include the session cookie for authentication
Error responses
Invalid credentials
Returned when the email or password is incorrect. Status Code:302 Found
Location: /Login (redirects back to login form)
Session Message: error_credentials
Missing credentials
Returned when email or password is not provided. Status Code:422 Unprocessable Entity
Security
- Passwords are hashed using bcrypt before storage
- Sessions are regenerated on successful login to prevent session fixation attacks
- Failed login attempts redirect back to the login form with an error message