Skip to content

feat: Add password reset functionality#958

Open
bitloi wants to merge 57 commits intoeigent-ai:mainfrom
bitloi:feature/password-reset-884
Open

feat: Add password reset functionality#958
bitloi wants to merge 57 commits intoeigent-ai:mainfrom
bitloi:feature/password-reset-884

Conversation

@bitloi
Copy link

@bitloi bitloi commented Jan 19, 2026

Description

This PR adds a password reset feature to the application. Users can now click "Forgot Password?" on the login page, enter their email, and receive a reset link. The reset password page validates the token and allows users to set a new password.

What's included:

  • Backend API endpoints for forgot-password, reset-password, and token verification
  • Database migration for storing password reset tokens
  • Frontend pages for the forgot password and reset password flows
  • i18n support for English and Chinese

Note: Email sending is not yet implemented - tokens are returned in the API response for testing. Email integration will require configuring an email service (SMTP/SendGrid/etc).

What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Screenshots

Screenshot 2026-01-19 082132 Screenshot 2026-01-19 082822

Testing

  1. Go to login page
  2. Click "Forgot Password?"
  3. Enter any email and submit
  4. Check API response for the reset token
  5. Navigate to /reset-password?token=YOUR_TOKEN
  6. Enter new password and confirm
  7. Password reset completes successfully

Closes #884

- Add password reset token model and Pydantic schemas (server)
- Add forgot-password, reset-password, verify-reset-token API endpoints (server + backend)
- Add database migration for password_reset_token table
- Add ForgotPassword.tsx and ResetPassword.tsx frontend pages
- Add 'Forgot Password?' link to Login page
- Add routes for /forgot-password and /reset-password
- Add i18n translations for en-us and zh-Hans

Note: Email sending integration pending - requires email service configuration.
Currently returns token in API response for development/testing.

Closes eigent-ai#884
@bitloi
Copy link
Author

bitloi commented Jan 19, 2026

@4pmtong @Douglasymlai please check the implementation and let me know your opinions

@bitloi
Copy link
Author

bitloi commented Jan 21, 2026

@a7m-1st any update for me?

@LuoPengcheng12138
Copy link
Contributor

Hi, @bitloi ,thank you very much for your contribution! I have just discussed this with @Douglasymlai . As you can see in https://github.com/eigent-ai/eigent/blob/main/server/README_EN.md, the server module under eigent is currently designed for Full Local Deployment. Therefore, we need to distinguish between two behaviors:

  • For Full Local Deployment: We can reset the password directly without any authentication such as email verification, and the password will be updated directly to the Docker database.
  • For end users (VITE_USE_LOCAL_PROXY=false): We need to add a "forget password" button, which will then redirect directly to our Eigent website (https://www.eigent.ai/ (the specific URL will be updated later)) for password reset.
    You can refer to the implementation of the register function.

cc @Douglasymlai

@LuoPengcheng12138 LuoPengcheng12138 self-requested a review January 21, 2026 12:38
…loyment

- Login.tsx: Forgot Password button now redirects to Eigent website when
  VITE_USE_LOCAL_PROXY=false, navigates to /forgot-password when true
- ForgotPassword.tsx: Redesigned for local deployment - direct password
  reset with email + new password fields (no email verification needed)
- Added /reset-password-direct endpoint to both server and Electron backends
  for direct password update in Docker database

Behavior:
- Full Local Deployment (VITE_USE_LOCAL_PROXY=true): Direct password reset
  without email verification, updates password in local Docker database
- End Users (VITE_USE_LOCAL_PROXY=false): Redirects to https://www.eigent.ai/forgot-password
@bitloi
Copy link
Author

bitloi commented Jan 21, 2026

Hi, @bitloi ,thank you very much for your contribution! I have just discussed this with @Douglasymlai . As you can see in https://github.com/eigent-ai/eigent/blob/main/server/README_EN.md, the server module under eigent is currently designed for Full Local Deployment. Therefore, we need to distinguish between two behaviors:

  • For Full Local Deployment: We can reset the password directly without any authentication such as email verification, and the password will be updated directly to the Docker database.
  • For end users (VITE_USE_LOCAL_PROXY=false): We need to add a "forget password" button, which will then redirect directly to our Eigent website (https://www.eigent.ai/ (the specific URL will be updated later)) for password reset.
    You can refer to the implementation of the register function.

cc @Douglasymlai

@LuoPengcheng12138 Done! I've updated the PR based on the feedback.

Copy link
Collaborator

@a7m-1st a7m-1st left a comment

Choose a reason for hiding this comment

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

The password validation needs to be abstracted by Pandantic.
I think then we can proceed to test it. Thanks @bitloi

bitloi and others added 2 commits January 21, 2026 14:33
…odels

- Create backend/app/model/password_reset.py with Pydantic models:
  - DirectResetPasswordRequest with field_validator and model_validator
  - ForgotPasswordRequest with email validation
  - ResetPasswordRequest with token and password validation
- Update server/app/model/user/password_reset.py:
  - Add Pydantic validators to ResetPasswordRequest
  - Add DirectResetPasswordRequest model with validators
- Update controllers to use models from model folder
- Remove manual validation from controllers (now handled by Pydantic)

Password validation rules:
- Minimum 8 characters
- Must contain at least one letter
- Must contain at least one number
- Passwords must match
@bitloi bitloi requested a review from a7m-1st January 21, 2026 14:35
@bitloi
Copy link
Author

bitloi commented Jan 21, 2026

The password validation needs to be abstracted by Pandantic. I think then we can proceed to test it. Thanks @bitloi

@a7m-1st Please review the latest changes again. Its implemented and works well.

@a7m-1st
Copy link
Collaborator

a7m-1st commented Jan 21, 2026

All right cool, let me take over tonight. We also need to port your updates the deployed instance.
Thanks @bitloi

bitloi and others added 4 commits January 21, 2026 22:50
Security fix: Remove email addresses from log output to prevent
clear-text logging of sensitive information.

- backend/app/controller/password_reset_controller.py
- server/app/controller/user/password_reset_controller.py
@bitloi
Copy link
Author

bitloi commented Jan 26, 2026

@a7m-1st Can you please check the pr again?

@a7m-1st
Copy link
Collaborator

a7m-1st commented Jan 26, 2026

HI there @LuoPengcheng12138 , do you need help with the backend integrations?

@LuoPengcheng12138
Copy link
Contributor

Sure, as I mentioned in my earlier comment, we need to write separate logic for the Full Local Deployment and endpoint users respectively. For the backend/app/controller/password_reset_controller.py file in the current PR, we can retain only the reset_password_direct function and perform the Docker database update right here. @a7m-1st

…only reset_password_direct

- Remove token-based functions (forgot_password, verify_reset_token, reset_password)
- Remove traceroot_wrapper dependency (deleted upstream)
- Use standard logging
@bitloi
Copy link
Author

bitloi commented Jan 27, 2026

@LuoPengcheng12138 Can you review the pr once more?

@bitloi
Copy link
Author

bitloi commented Feb 21, 2026

@LuoPengcheng12138 Do I still need to wait?

@bitloi
Copy link
Author

bitloi commented Mar 10, 2026

@Wendong-Fan Can we merge this PR?

@Wendong-Fan
Copy link
Contributor

could @4pmtong help tracking this PR?

@4pmtong
Copy link
Collaborator

4pmtong commented Mar 12, 2026

Hi @bitloi , really sorry for the long wait on this — your patience and responsiveness throughout this process is truly appreciated.
I've reviewed the PR and here's the update:
Local Deployment (VITE_USE_LOCAL_PROXY=true) — Looks great, no issues here.
End Users (VITE_USE_LOCAL_PROXY=false) — Our website now uses a magic link login flow (users receive a code via email to sign in directly), so we don't need a dedicated forgot-password page. Could you update the redirect URL from https://www.eigent.ai/forgot-password to https://www.eigent.ai/signin? This way users can simply use the magic link to log in and reset their password from account settings afterward.
Cleanup: Since the token-based reset flow is no longer needed, could you also remove the unused code?

PasswordResetToken model, ForgotPasswordRequest, ResetPasswordRequest
The password_reset_token alembic migration
ResetPassword.tsx and its route

Only DirectResetPasswordRequest and /reset-password-direct are needed for local deployment.
Once these changes are in, we should be good to merge. Thanks again for the contribution!

bitloi added 2 commits March 12, 2026 16:09
- Update end-user forgot-password redirect from /forgot-password to /signin
- Remove PasswordResetToken model, ForgotPasswordRequest, ResetPasswordRequest
- Neutralize password_reset_token alembic migration to no-op
- Remove ResetPassword.tsx content and its route
- Keep DirectResetPasswordRequest and /reset-password-direct for local deployment
@bitloi bitloi force-pushed the feature/password-reset-884 branch from 7fee345 to a7fd245 Compare March 18, 2026 02:24
@bitloi
Copy link
Author

bitloi commented Mar 18, 2026

@Wendong-Fan @4pmtong Sorry for tagging you. Would you mind reviewing the changes?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Password Change Option

6 participants