Description: This endpoint allows existing users to log in to their account using their email and password. Upon successful login, an access token is returned.
Input Validation: The API checks if both email and password are provided in the request body. If either is missing, a 400 Bad Request error is returned.
2.
User Retrieval: The API attempts to retrieve the user associated with the provided email address.
3.
Verification Check: If the user is found but their email is not verified, a 403 Forbidden error is returned, prompting the user to verify their email.
4.
Password Comparison: The provided password is compared against the stored hashed password. If the passwords do not match, a 401 Unauthorized error is returned.
5.
Token Generation: If the login is successful, an access token is generated, which includes the user's ID and email.
6.
Response: A success response is sent back to the client, including the access token and user details.