System-Garcia / node-pets

1 stars 1 forks source link

Super Administrator Access and Activity Logs Panel #92

Closed gabrielvaca closed 7 months ago

gabrielvaca commented 7 months ago

Issue: Implementation of Login Logs for Administrator Users

Objective: Create a log system for administrator user logins that saves the information in a .txt file.

Requirements:

  1. Implementation of Logging Middleware:

    • [x] Create a middleware in Node.js that intercepts login requests.
    • [x] Check if the user is an administrator. This may involve checking a specific field in the user's information, such as role or isAdmin.
    • [x] If the user is an administrator, record the date, time, and details of the login in a .txt file.
  2. File Handling with Node.js:

    • [x] Use the fs module of Node.js to manage file operations.
    • [x] Ensure the .txt file is opened in append mode to not overwrite existing records.
  3. Security and Data Validation:

    • [x] Ensure that the middleware properly handles errors, such as problems accessing or writing to the file.
    • [x] Validate that the data input during the login process does not allow injections or attacks that could compromise security.

Acceptance Criteria:

gabrielvaca commented 7 months ago

98