Skip to content

feat: add remember password function#1317

Draft
bittoby wants to merge 17 commits intoeigent-ai:mainfrom
bittoby:feat/remember-me-login
Draft

feat: add remember password function#1317
bittoby wants to merge 17 commits intoeigent-ai:mainfrom
bittoby:feat/remember-me-login

Conversation

@bittoby
Copy link
Copy Markdown
Contributor

@bittoby bittoby commented Feb 20, 2026

Related Issue

Closes #1316

Description

Adds secure "Remember Me" credential storage for the login page using Electron's built-in safeStorage API, which encrypts credentials via OS-level keychain (macOS Keychain, Windows DPAPI, Linux Secret Service). No new dependencies required.

What it does:

  • Encrypts and persists email/password credentials locally at ~/.eigent/saved_credentials.enc (file permissions 0o600)
  • Auto-fills the most recently used account on login page load
  • Shows a saved accounts dropdown (with masked emails) when focusing the email field, allowing quick account switching
  • Each saved account can be individually removed from the dropdown
  • "Remember Me" checkbox controls whether credentials are saved or cleared after successful login

Files changed:

  • electron/main/index.ts — 3 IPC handlers (credentials-save, credentials-load, credentials-remove) using safeStorage.encryptString() / decryptString()
  • electron/preload/index.ts — Exposed credential APIs to renderer via electronAPI bridge
  • src/types/electron.d.ts — TypeScript declarations for new credential methods
  • src/pages/Login.tsx — Remember Me checkbox, saved accounts dropdown with outside-click dismiss, auto-fill on mount
  • 11 i18n locale files — Added remember-me, saved-accounts, remove-account keys (en, zh-Hans, zh-Hant, ja, ko, de, fr, es, it, ru, ar)

Testing Evidence (REQUIRED)

login.mp4
  • I have included human-verified testing evidence in this PR.
  • This PR includes frontend/UI changes, and I attached screenshot(s) or screen recording(s).
  • No frontend/UI changes in this PR.

What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Contribution Guidelines Acknowledgement

@bittoby bittoby marked this pull request as draft February 20, 2026 10:11
@bittoby bittoby marked this pull request as ready for review February 20, 2026 10:45
@bittoby
Copy link
Copy Markdown
Contributor Author

bittoby commented Feb 20, 2026

@Pakchoioioi @Wendong-Fan Could you please review the PR?
thank you

@Wendong-Fan
Copy link
Copy Markdown
Contributor

thanks @bittoby ! could @4pmtong and @fengju0213 help reviewing this feature?

@bittoby
Copy link
Copy Markdown
Contributor Author

bittoby commented Feb 25, 2026

@Wendong-Fan @4pmtong @fengju0213 I'd really appreciate your feedback!
thank you

Copy link
Copy Markdown
Collaborator

@nitpicker55555 nitpicker55555 left a comment

Choose a reason for hiding this comment

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

This PR has several serious issues. A pure function is wrapped in useMemo even though it does not depend on any state and should be defined outside the component. Returning a function from useMemo with an empty dependency array is meaningless and looks like AI-driven over-optimization. The implementation stores plaintext passwords instead of persisting the existing auth token via setAuth, which indicates the current authentication flow was not properly reviewed. There is also a redundant map in credentials-load where the input and output shapes are identical, making it unnecessary code. In addition, credentialsLoad() has no error handling and lacks a catch on the promise.

Considering the extent of these problems, iterating through review cycles would likely cost more effort than rewriting it. I suggest closing this PR and submitting a clean one instead. @Wendong-Fan @4pmtong

@bittoby
Copy link
Copy Markdown
Contributor Author

bittoby commented Feb 27, 2026

@nitpicker55555 please don't close this PR. I will update in this PR

@bittoby
Copy link
Copy Markdown
Contributor Author

bittoby commented Feb 27, 2026

@nitpicker55555 I updated to follow your feedback.

What i have changed:

  • Password storage removed - the implementation now persists the auth token (token, username, user_id) returned by the login API, not the user's password. Selecting a saved account calls setAuth directly and navigates without re-entering credentials.
  • useMemo misuse removed - maskEmail is now a plain module-level function outside the component.
  • Redundant .map() removed - credentials-load returns the accounts array directly.
  • Error handling added - credentialsLoad is now wrapped in try/catch.
  • Runtime bug fixed - the account filter was rejecting all saved entries because user_id from the API is a string at runtime, not a number. The filter now only validates email and token, which is sufficient.

@bittoby bittoby marked this pull request as draft February 27, 2026 16:30
@bittoby bittoby marked this pull request as ready for review February 27, 2026 16:42
@fengju0213
Copy link
Copy Markdown
Collaborator

@nitpicker55555 I updated to follow your feedback.

What i have changed:

  • Password storage removed - the implementation now persists the auth token (token, username, user_id) returned by the login API, not the user's password. Selecting a saved account calls setAuth directly and navigates without re-entering credentials.
  • useMemo misuse removed - maskEmail is now a plain module-level function outside the component.
  • Redundant .map() removed - credentials-load returns the accounts array directly.
  • Error handling added - credentialsLoad is now wrapped in try/catch.
  • Runtime bug fixed - the account filter was rejecting all saved entries because user_id from the API is a string at runtime, not a number. The filter now only validates email and token, which is sufficient.

thanks @bittoby will review it asap

Copy link
Copy Markdown
Collaborator

@fengju0213 fengju0213 left a comment

Choose a reason for hiding this comment

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

thanks @bittoby overall its good,I'm wondering if automatic autofill is sufficient, and automatic login isn't necessary, because there might be other operations on this login page later, such as changing the password, etc.
cc @Pakchoioioi

@bittoby bittoby force-pushed the feat/remember-me-login branch from 2ca5bc1 to 4336b3b Compare March 3, 2026 15:31
@bittoby bittoby requested a review from fengju0213 March 5, 2026 02:05
@bittoby
Copy link
Copy Markdown
Contributor Author

bittoby commented Mar 6, 2026

@fengju0213 It passed all tests

@bittoby
Copy link
Copy Markdown
Contributor Author

bittoby commented Mar 9, 2026

@Wendong-Fan @bytecii Any update for me, please

@fengju0213
Copy link
Copy Markdown
Collaborator

@Wendong-Fan @bytecii Any update for me, please

Sorry for the late reply. Since this involves user experience, I will ask our product team to provide feedback today.

@bittoby
Copy link
Copy Markdown
Contributor Author

bittoby commented Mar 9, 2026

Thank you @fengju0213

@bittoby
Copy link
Copy Markdown
Contributor Author

bittoby commented Mar 10, 2026

Would someone please merge this PR?

@Pakchoioioi
Copy link
Copy Markdown
Contributor

Pakchoioioi commented Mar 11, 2026

Hi @bittoby Thanks for contribution, just let product team test.

Right now the redirect feels a bit too sudden, but it can be improved with slight modifications:
https://github.com/user-attachments/assets/c15440f7-6f67-41ba-a10e-0902810b0005

  1. When the user enters the login page, the fields should initially be empty.
image
  1. When the user clicks on the email input field, the browser should display suggestions of previously stored accounts.
image
  1. After the user selects a stored account from the suggestion list, the email and password should be autofilled automatically, while the password remains hidden.
eb32c46fedb929dc32d78a3b83e1eeb1
  1. The user then clicks “Sign In” to enter the Eigent homepage.

@bittoby bittoby force-pushed the feat/remember-me-login branch from f7f6104 to 0306741 Compare March 11, 2026 01:55
@bittoby
Copy link
Copy Markdown
Contributor Author

bittoby commented Mar 11, 2026

@Pakchoioioi I updated logic based on your feedbacks. thanks for your feedback. And Testing fails doesn't seem to relate to my changes. Please check.

test.webm

@4pmtong
Copy link
Copy Markdown
Collaborator

4pmtong commented Mar 11, 2026

Thanks @bittoby . Could @Pakchoioioi @Douglasymlai help review whether the current approach makes sense?

@fengju0213
Copy link
Copy Markdown
Collaborator

@Pakchoioioi I updated logic based on your feedbacks. thanks for your feedback. And Testing fails doesn't seem to relate to my changes. Please check.

test.webm

thanks @bittoby I think the "remember me" status should be persisted?

@bittoby
Copy link
Copy Markdown
Contributor Author

bittoby commented Mar 11, 2026

@fengju0213 Good point! I solved that.
thank you

@bittoby
Copy link
Copy Markdown
Contributor Author

bittoby commented Mar 13, 2026

@Wendong-Fan @Pakchoioioi please any updates for me...

@bittoby
Copy link
Copy Markdown
Contributor Author

bittoby commented Mar 14, 2026

@Wendong-Fan @Pakchoioioi Please review this PR. I opened this PR last 3 weeks. I think it is ready to merge now.
Please give me any updates 🙏

@fengju0213
Copy link
Copy Markdown
Collaborator

@nitpicker55555 i think pr can be merged now

@bittoby bittoby force-pushed the feat/remember-me-login branch from f792313 to 53f1f33 Compare March 16, 2026 17:02
@Pakchoioioi
Copy link
Copy Markdown
Contributor

Hi @bittoby We truly appreciate your commitment and the valuable work you’ve contributed to the login in feature

I would like to explain the situation regarding this feature. As our product client offers both download and local deployment versions, our design philosophy is to centralize all login, management, and privacy settings on the Eigent website. This allows the client to remain fully simplified while keeping the architecture consistent with mainstream coworking products.

We have already implemented support for this login method in the main branch as well as in version 0.0.88. Unfortunately, this means that merging your proposed feature as-is would conflict with our current product design.

To ensure your work is not lost, we will keep your branch as a reference for future development.

Once again, thank you for your understanding, patience, and generous support of the project.

@bittoby
Copy link
Copy Markdown
Contributor Author

bittoby commented Mar 17, 2026

So you mean, you can't merge my pr in the future?

@bittoby
Copy link
Copy Markdown
Contributor Author

bittoby commented Mar 18, 2026

@Wendong-Fan @Pakchoioioi I have spent many time and effort for this pr last one month. If possible, would appreciate to merge this pr. I can update to avoid conflicts with your current product design. please help me 🙏

@Pakchoioioi
Copy link
Copy Markdown
Contributor

Sorry about that, and I really appreciate the effort you’ve put into this PR. @bittoby

I won’t be able to merge it into the main branch, as it’s no longer aligned with the current login and signup logic. We also won’t have a login page in the client for now.

That said, your work is still valuable, so the best I can do is keep this branch as a reference for potential future iterations if the direction evolves.

Maintaining consistency and simplicity in the core system is important for the long-term health of the project. Thanks for your understanding.

@bittoby
Copy link
Copy Markdown
Contributor Author

bittoby commented Mar 18, 2026

Ok, @Pakchoioioi, I understand and agree your decision.
If possible, please avoid closing this pr. I’m concerned it may reflect negatively on my profile.
Also, if you know of any valuable issues I could help, please let me know. As a top contributor here, I’ve submitted several prs to this project before and still happy to take on more. Feel free to assign me anything. Thanks.

@bittoby bittoby marked this pull request as draft April 6, 2026 12:19
bittoby added 3 commits April 7, 2026 22:36
Revert remember-me credential storage and login form changes to match main.
Keep a single fix: include setModelType, setInitState, and setIsFirstLaunch in
the ProtectedRoute useEffect dependency list (same as main, one line).

Made-with: Cursor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Support "Remember Me" / Auto-fill for Email & Password Login

7 participants