Skip to content

feature/logout#79

Merged
mdawoud27 merged 5 commits into
mainfrom
feature/78/logout
Apr 6, 2025
Merged

feature/logout#79
mdawoud27 merged 5 commits into
mainfrom
feature/78/logout

Conversation

@mdawoud27
Copy link
Copy Markdown
Contributor

PR Checklist (required)

Please check if your PR fulfills the following requirements:

  • The commit message follows our guidelines.

  • Tests for the changes have been added (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation changes
  • Other... Please describe:

Related Issue

Closes #78

@mdawoud27 mdawoud27 requested a review from Copilot April 6, 2025 12:03
@mdawoud27 mdawoud27 self-assigned this Apr 6, 2025
@mdawoud27 mdawoud27 linked an issue Apr 6, 2025 that may be closed by this pull request
@mdawoud27 mdawoud27 added the enhancement New feature or request label Apr 6, 2025
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 3 out of 5 changed files in this pull request and generated 1 comment.

Files not reviewed (2)
  • prisma/migrations/20250406115517_logout/migration.sql: Language not supported
  • prisma/schema/models/user.model.prisma: Language not supported
Comments suppressed due to low confidence (1)

src/middlewares/auth.middleware.js:11

  • The decoded token is not attached to req, causing subsequent handlers (like logout) to lack user information. Consider setting req.user = decoded after verifying the token.
const decoded = jwt.verify(token, process.env.JWT_ACCESS_SECRET);

export const logout = async (req, res, next) => {
try {
// Get user ID from the authenticated request
const userId = req.user.id;
Copy link

Copilot AI Apr 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logout function assumes req.user is present, but the verifyAccessToken middleware does not attach the decoded token to req. This may lead to a runtime error if req.user is undefined.

Copilot uses AI. Check for mistakes.
@mdawoud27 mdawoud27 merged commit 4c9afff into main Apr 6, 2025
11 checks passed
@mdawoud27 mdawoud27 deleted the feature/78/logout branch April 6, 2025 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Log out

2 participants