会话Bug演示登录应用

一个用于演示密码重置后会话失效Bug的登录应用,包含复现步骤和修复说明。

  • by v-im-sampm
  • HTML
  • 本地部署
  • 更新于
在 GitHub 查看 im-sampm/mcp-demo

使用说明

MCP Demo - Login App with Session Bug

Demo repository for the "Extend Copilot's Reach with MCP Servers" video.

The Bug

After resetting a password, logged-in users see "Session expired" error.

Root cause: auth/session.js validates sessions by comparing session.passwordVersion with user.passwordVersion. When password is reset, the user's version increments, but the session's version doesn't get updated.

Fix: In server.js after auth.resetPassword(), update req.session.passwordVersion to match the new version.

Quick Start

npm install
npm start

Open http://localhost:3000

Reproduce the Bug

  1. Login as demo / password123
  2. See the dashboard (session works)
  3. Open /reset-password in a new tab
  4. Reset password for demo to anything
  5. Go back to dashboard and refresh
  6. BUG: "Session expired" error!

Demo Credentials

Username Password
demo password123
testuser test123