feat: add remember password function#1317
Conversation
|
@Pakchoioioi @Wendong-Fan Could you please review the PR? |
|
thanks @bittoby ! could @4pmtong and @fengju0213 help reviewing this feature? |
|
@Wendong-Fan @4pmtong @fengju0213 I'd really appreciate your feedback! |
nitpicker55555
left a comment
There was a problem hiding this comment.
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
|
@nitpicker55555 please don't close this PR. I will update in this PR |
|
@nitpicker55555 I updated to follow your feedback. What i have changed:
|
thanks @bittoby will review it asap |
fengju0213
left a comment
There was a problem hiding this comment.
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
2ca5bc1 to
4336b3b
Compare
electron/main/index.ts
Outdated
| user_id: number | ||
| ) => { | ||
| try { | ||
| const accounts = readSavedAccounts(); |
There was a problem hiding this comment.
Should we change readSavedAccounts, writeSavedAccounts etc to async? such as fs.promises so that we do not block the ipc main thread
| email: account.email, | ||
| user_id: account.user_id, | ||
| }); | ||
| setModelType('cloud'); |
There was a problem hiding this comment.
Let's add a todo that we should need to avoid set this as cloud by default in the future
src/pages/Login.tsx
Outdated
| onClick={() => handleSelectAccount(account)} | ||
| > | ||
| <span className="text-label-md text-text-primary"> | ||
| {maskEmail(account.email)} |
There was a problem hiding this comment.
Do we need to mask in this way? maybe we should remove the masking
| state={errors.email ? 'error' : undefined} | ||
| note={errors.email} | ||
| onEnter={handleLogin} | ||
| onFocus={() => { |
There was a problem hiding this comment.
Now there is a problem that for example if we save an email such as abc@gmail.com
then in the email if I typed new one such as def@gmail.com the dropdown including the abc@gmail.com is still available.
We should have that if the prefix does not match with any saved emails then we should not show the dropdown
|
Thanks for your feedback @bytecii . I will check again |
|
@bytecii I have updated all to follow your feedback. please review again. |
Related Issue
Closes #1316
Description
Adds secure "Remember Me" credential storage for the login page using Electron's built-in
safeStorageAPI, which encrypts credentials via OS-level keychain (macOS Keychain, Windows DPAPI, Linux Secret Service). No new dependencies required.What it does:
~/.eigent/saved_credentials.enc(file permissions0o600)Files changed:
electron/main/index.ts— 3 IPC handlers (credentials-save,credentials-load,credentials-remove) usingsafeStorage.encryptString()/decryptString()electron/preload/index.ts— Exposed credential APIs to renderer viaelectronAPIbridgesrc/types/electron.d.ts— TypeScript declarations for new credential methodssrc/pages/Login.tsx— Remember Me checkbox, saved accounts dropdown with outside-click dismiss, auto-fill on mountremember-me,saved-accounts,remove-accountkeys (en, zh-Hans, zh-Hant, ja, ko, de, fr, es, it, ru, ar)Testing Evidence (REQUIRED)
login.mp4
What is the purpose of this pull request?
Contribution Guidelines Acknowledgement