bitwarden:master
← bitwarden:unlock-on-autofill
opened 04:25PM - 19 Oct 21 UTC
## Type of change
- [X] Bug fix
- [X] New feature development
- [ ] Tech debt… (refactoring, code cleanup, dependency upgrades, etc)
- [ ] Build/deploy pipeline (DevOps)
- [ ] Other
## Objective
Before this change, having a locked vault would cause the following actions to not execute
**Keyboard shortcut:**
- Ctrl/CMD + Shift + L
**Browser contextmenu:**
- Auto-Fill
- Copy username
- Copy password
- Copy TOTP
To improve the user experience, we now detect if the vault is locked and prompt the user to log in via a new tab. After the user logs in, we close that tab automagically and execute the previous user-selected action.
This is the same flow as implemented with #2094
Asana tickets:
https://app.asana.com/0/search/1201194531292523/1201228407680432
https://app.asana.com/0/search/1201194531292523/1183005754989927
https://app.asana.com/0/search/1201194531292526/1153357960682206
Closes #645 and #978
Relates to: #1621 and #987
## Code changes
- **src/background/commands.background.ts:**
- Added missing types
- Add `promptForLogin `and send message to `addToLockedVaultPendingNotifications`
- Add messageListener for `unlockCompleted`
- **src/background/contextMenus.background.ts:**
- Added missing types
- Pass `tab` (chrome.tabs.Tab) onto `cipherAction` and onto `startAutofillPage` - removes getting the current tab again
- Pass `tab` (chrome.tabs.Tab) onto `getClickedElement` - removes getting the current tab again
- Removed noop-action (Vault is locked) and the openPopup - the opening of the popup only worked on certain browsers
- Use same login and retry flow as implemented with #2094
- send messages for `promptForLogin` and `addToLockedVaultPendingNotifications`
- Add messageListener for `unlockCompleted`
- If the vault is locked, the user was not able to select a specific entry, so we now check for the first cipher matching the tabs url.
## Notes for QA
All the above mentioned commands or context-menus entries should work as intended, nevermind if the vault was locked or not.
## Before you submit
- [X] I have checked for **linting** errors (`npm run lint`) (required)
- [ ] I have added **unit tests** where it makes sense to do so (encouraged but not required)
- [X] This change requires a **documentation update** (Alert the documentation team in Asana)
- [ ] This change has particular **deployment requirements** (Alert DevOps in Asana)