mirror of
https://github.com/bitwarden/browser
synced 2025-12-15 07:43:35 +00:00
Merge master into feature/org-admin-refresh (#4072)
* Remove DDG forwarder from SH (#3888) * [EC-272] Web workers using EncryptionService (#3532) * Add item decryption to encryptService * Create multithreadEncryptService subclass to handle web workers * Create encryption web worker * Refactor cipherService to use new interface * Update dependencies * Don't refresh org vault on filter change (#3879) * Autosync the updated translations (#3914) Co-authored-by: bitwarden-devops-bot <106330231+bitwarden-devops-bot@users.noreply.github.com> * Autosync the updated translations (#3915) Co-authored-by: bitwarden-devops-bot <106330231+bitwarden-devops-bot@users.noreply.github.com> * Autosync the updated translations (#3916) Co-authored-by: bitwarden-devops-bot <106330231+bitwarden-devops-bot@users.noreply.github.com> * Revert "[PS-1465] Fix #2806 - The "Import Data" page's file selector button cannot be translated (#3502)" (#3900) This reverts commit768de03269. * Autosync the updated translations (#3919) Co-authored-by: bitwarden-devops-bot <106330231+bitwarden-devops-bot@users.noreply.github.com> * [SM-260] Hide email verification prompt if already verified (#3922) Co-authored-by: Sammy Chang <sammychang2185@gmail.com> * Two-Step Login (#3852) * [SG-163] Two step login flow web (#3648) * two step login flow * moved code from old branch and reafctored * fixed review comments * [SG-164] Two Step Login Flow - Browser (#3793) * Add new messages * Remove SSO button from home component * Change create account button to text * Add top padding to create account link * Add email input to HomeComponent * Add continue button to email input * Add form to home component * Retreive email from state service * Redirect to login after submit * Add error message for invalid email * Remove email input from login component * Remove loggingInTo from under MP input * Style the MP hint link * Add self hosted domain to email form * Made the mp hint link bold * Add the new login button * Style app-private-mode-warning in its component * Bitwarden -> Login text change * Remove the old login button * Cancel -> Close text change * Add avatar to login header * Login -> LoginWithMasterPassword text change * Add SSO button to login screen * Add not you button * Allow all clients to use the email query param on the login component * Introduct HomeGuard * Clear remembered email when clicking Not You * Make remember email opt-in * Use formGroup.patchValue instead of directly patching individual controls * [SG-165] Desktop login flow changes (#3814) * two step login flow * moved code from old branch and reafctored * fixed review comments * Make toggleValidateEmail in base class public * Add desktop login messages * Desktop login flow changes * Fix known device api error * Only submit if email has been validated * Clear remembered email when switching accounts * Fix merge issue * Add 'login with another device' button * Remove 'log in with another device' button for now * Pin login pag content to top instead of center justified * Leave email if 'Not you?' is clicked * Continue when enter is hit on email input Co-authored-by: gbubemismith <gsmithwalter@gmail.com> * [SG-750] and [SG-751] Web two step login bug fixes (#3843) * Continue when enter is hit on email input * Mark email input as touched on 'continue' so field is validated * disable login with device on self-hosted (#3895) * [SG-753] Keep email after hint component is launched in browser (#3883) * Keep email after hint component is launched in browser * Use query params instead of state for consistency * Send email and rememberEmail to home component on navigation (#3897) * removed avatar and close button from the password screen (#3901) * [SG-781] Remove extra login page and remove rememberEmail code (#3902) * Remove browser home guard * Always remember email for browser * Remove login landing page button * [SG-782] Add login service to streamline login form data persistence (#3911) * Add login service and abstraction * Inject login service into apps * Inject and use new service in login component * Use service in hint component to prefill email * Add method in LoginService to clear service values * Add LoginService to two-factor component to clear values * make login.service variables private Co-authored-by: Gbubemi Smith <gsmith@bitwarden.com> Co-authored-by: Addison Beck <addisonbeck1@gmail.com> Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com> Co-authored-by: gbubemismith <gsmithwalter@gmail.com> * 400s only log out on invalid grant error (#3924) * Fix rust tests apt-get install (#3933) * Added focus to the email and master password fields (#3934) * Ps 1754 community pr reviewed (#3929) * community PR reviewed, Update search cancel button to be visible in all themes * community PR reviewed, Update search cancel button to be visible in all themes 2 * Update search cancel button to be visible in all themes (#3876) * Adding the 'libs/**' directory back to the Desktop build pipeline PR trigger list (#3938) * Re-\added the focusInput method to allow desktop build run (#3937) * [EC-522] Improve handling of rxjs subjects (#3772) * [EC-522] feat: no public rxjs subjects * [EC-522] feat: improve null handling * [EC-552] fix: init subject with empty set instead of null * [EC-552] fix: don't push null into account subject * [EC-522] feat: remove null filter * [EC-641] Browser Ext UI Update (#3842) * more css changes * add icon button hover * Update apps/browser/src/popup/scss/box.scss Co-authored-by: Oscar Hinton <Hinton@users.noreply.github.com> * Update apps/desktop/src/scss/box.scss Co-authored-by: Oscar Hinton <Hinton@users.noreply.github.com> * feedback updates * restore desktop pseudo rule * update to include some variable fixes and deletions * updates per oscar * feedback updates more universal variable, adjusted box padding (per Kyle), and aligned footer text * changes per product design added border for selects, border around generator, and hover for solarizeddark * add more helper text space below for visual separation * group new variable * login page button fix Dflinn found an odd margin on the login page * Revert "Merge branch 'master' into browser-ext-ui-update-test" This reverts commitb8007102f9, reversing changes made to246768cb12. * fix button height * revert file changes * test adjustments Co-authored-by: Oscar Hinton <Hinton@users.noreply.github.com> Co-authored-by: Kyle Spearrin <kyle.spearrin@gmail.com> * [SG-792] Added focus to master password field on browser and desktop (#3939) * Added focus to master password field on browser client * Added focus to master password field on desktop client * Tell eslint & prettier to ignore storybook-static (#3946) * [SG-792] Fixed focus on master password when enter key is pressed (#3948) * Added focus to master password field on browser client * Added focus to master password field on desktop client * fixed focus on master password when enter is pressed * [EC-7] Org Admin Vault Refresh Client V1 (#3925) * [EC-8] Restructure Tabs (#3109) * Cherry pick pending PR for tabs component [CL-17] Tabs - Routing * Update organization tabs from 4 to 6 * Create initial 'Members' tab * Create initial 'Groups' tab * Add initial "Reporting" tab * Use correct report label/layout by product type * Create initial 'Billing' tab * Breakup billing payment and billing history pages * Cleanup org routing and nav permission service * More org tab permission cleanup * Refactor organization billing to use a module * Refactor organization reporting to use module * Cherry pick finished/merged tabs component [CL-17] Tabs - Router (#2952) * This partially reverts commit24bb775to fix tracking of people.component.html rename. * Fix people component file rename * Recover lost member page changes * Undo members component rename as it was causing difficult merge conflicts * Fix member and group page container * Remove unnecessary organization lookup * [EC-8] Some PR suggestions * [EC-8] Reuse user billing history for orgs * [EC-8] Renamed user billing history component * [EC-8] Repurpose payment method component Update end user payment method component to be usable for organizations. * [EC-8] Fix missing verify bank condition * [EC-8] Remove org payment method component * [EC-8] Use CL in payment method component * [EC-8] Extend maxWidth Tailwind theme config * [EC-8] Add lazy loading to org reports * [EC-8] Add lazy loading to org billing * [EC-8] Prettier * [EC-8] Cleanup org reporting component redundancy * [EC-8] Use different class for negative margin * [EC-8] Make billing history component "dumb" * Revert "[EC-8] Cleanup org reporting component redundancy" This reverts commiteca337e89b. * [EC-8] Create and export shared reports module * [EC-8] Use shared reports module in orgs * [EC-8] Use takeUntil pattern * [EC-8] Move org reporting module out of old modules folder * [EC-8] Move org billing module out of old modules folder * [EC-8] Fix some remaining merge conflicts * [EC-8] Move maxWidth into 'extend' key for Tailwind config * [EC-8] Remove unused module * [EC-8] Rename org report list component * Prettier Co-authored-by: Vincent Salucci <vincesalucci21@gmail.com> * [EC-451] Org Admin Refresh Permissions Refactor (#3320) * [EC-451] Update new org permissions for new tabs * [EC-451] Remove redudant route guards * [EC-451] Remove canAccessManageTab() * [EC-451] Use canAccess* callbacks in org routing module * Fix org api service refactor and linting after pulling in master * Fix broken org people and group pages after merge * [EC-18] Reporting side nav direction (#3420) * [EC-18] Re-order side nav for org reports according to Figma * [EC-18] Fix rxjs linter errors and redundant org flag * [EC-526] Default to Event Logs page for Reporting Tab (#3470) * [EC-526] Default to the Events Logs page when navigating to the Reporting tab * [EC-526] Undo default routing redirect when the child path is missing. Avoids defaulting to "/events" in case a user/org doesn't have access to event logs. * [EC-19] Update Organization Settings Page (#3251) * [EC-19] Refactor existing organization settings components to its own module * [EC-19] Move SSO page to settings tab * [EC-19] Move Policies page to Settings tab Refactor Policy components into its own module * [EC-19] Move ImageSubscriptionHiddenComponent * [EC-19] Lazy load org settings module * [EC-19] Add SSO Id to SSO config view * [EC-19] Remove SSO identfier from org info page * [EC-19] Update org settings/policies to follow ADR-0011 * [EC-19] Update two-step login setup description * [EC-19] Revert nested policy components folder * [EC-19] Revert nested org setting components folder * [EC-19] Remove left over image component * [EC-19] Prettier * [EC-19] Fix missing i18n * [EC-19] Update SSO form to use CL * [EC-19] Remove unused SSO input components * [EC-19] Fix bad SSO locale identifier * [EC-19] Fix import order linting * [EC-19] Add explicit whitespace check for launch click directive * [EC-19] Add restricted import paths to eslint config * [EC-19] Tag deprecated field with Jira issue to cleanup in future release * [EC-19] Remove out of date comment * [EC-19] Move policy components to policies module * [EC-19] Remove dityRequired validator * [EC-19] Use explicit type for SSO config form * [EC-19] Fix rxjs linter errors * [EC-19] Fix RxJS eslint comments in org settings component * [EC-19] Use explicit ControlsOf<T> helper for nested SSO form groups. * [EC-19] Attribute source of ControlsOf<T> helper * [EC-19] Fix missing settings side nav links * [EC-19] Fix member/user language for policy modals * [EC-551] Update Event Logs Client Column (#3572) * [EC-551] Fix RxJS warnings * [EC-551] Update page to use CL components and Tailwind classes * [EC-551] Update Client column to use text instead of icon. Update language and i18n. * [EC-14] Refactor vault filter (#3440) * [EC-14] initial refactoring of vault filter * [EC-14] return observable trees for all filters with head node * [EC-14] Remove bindings on callbacks * [EC-14] fix formatting on disabled orgs * [EC-14] hide MyVault if personal org policy * [EC-14] add check for single org policy * [EC-14] add policies to org and change node constructor * [EC-14] don't show options if personal vault policy * [EC-14] default to all vaults * [EC-14] add default selection to filters * [EC-14] finish filter model callbacks * [EC-14] finish filter functionality and begin cleaning up * [EC-14] clean up old components and start on org vault * [EC-14] loop through filters for presentation * [EC-14] refactor VaultFilterService and put filter presentation data back into Vault Filter component. Remove VaultService * [EC-14] begin refactoring org vault * [EC-14] Refactor Vault Filter Service to use observables * [EC-14] finish org vault filter * [EC-14] fix vault model tests * [EC-14] fix org service calls * [EC-14] pull refactor out of shared code * [EC-14] include head node for collections even if collections aren't loaded yet * [EC-14] fix url params for vaults * [EC-14] remove comments * [EC-14] Remove unnecesary getter for org on vault filter * [EC-14] fix linter * [EC-14] fix prettier * [EC-14] add deprecated methods to collection service for desktop and browser * [EC-14] simplify cipher type node check * [EC-14] add getters to vault filter model * [EC-14] refactor how we build the filter list into methods * [EC-14] add getters to build filter method * [EC-14] remove param ids if false * [EC-14] fix collapsing nodes * [EC-14] add specific type to search placeholder * [EC-14] remove extra constructor and comment from org vault filter * [EC-14] extract subscription callback to methods * [EC-14] Remove unecessary await * [EC-14] Remove ternary operators while building org filter * [EC-14] remove unnecessary deps array in vault filter service declaration * [EC-14] consolidate new models into one file * [EC-14] initialize nested observable inside of service Signed-off-by: Jacob Fink <jfink@bitwarden.com> * [EC-14] change how we load orgs into the vault filter and select the default filter * [EC-14] remove get from getters name * [EC-14] remove eslint-disable comment * [EC-14] move vault filter service abstraction to angular folder and separate * [EC-14] rename filter types and delete VaultFilterLabel * [EC-14] remove changes to workspace file * [EC-14] remove deprecated service from jslib module * [EC-14] remove any remaining files from common code * [EC-14] consolidate vault filter components into components folder * [EC-14] simplify method call * [EC-14] refactor the vault filter service - orgs now have observable property - BehaviorSubjects have been migrated to ReplaySubjects if they don't need starting value - added unit tests - fix small error when selecting org badge of personal vault - renamed some properties * [EC-14] replace mergeMap with switchMap in vault filter service * [EC-14] early return to prevent nesting * [EC-14] clean up filterCollections method * [EC-14] use isDeleted helper in html * [EC-14] add jsdoc comments to ServiceUtils * [EC-14] fix linter * [EC-14] use array.slice instead of setting length * Update apps/web/src/app/vault/vault-filter/services/vault-filter.service.ts Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> * [EC-14] add missing high level jsdoc description * [EC-14] fix storybook absolute imports * [EC-14] delete vault-shared.module * [EC-14] change search placeholder text to getter and add missing strings * [EC-14] remove two way binding from search text in vault filter * [EC-14] removed all binding from search text and just use input event * [EC-14] remove async from apply vault filter * [EC-14] remove circular observable calls in vault filter service Co-authored-by: Thomas Rittson <eliykat@users.noreply.github.com> * [EC-14] move collapsed nodes to vault filter section * [EC-14] deconstruct filter section inside component * [EC-14] fix merge conflicts and introduce refactored organization service to vault filter service * [EC-14] remove mutation from filter builders * [EC-14] fix styling on buildFolderTree * [EC-14] remove leftover folder-filters reference and use ternary for collapse icon * [EC-14] remove unecessary checks * [EC-14] stop rebuilding filters when the organization changes * [EC-14] Move subscription out of setter in vault filter section * [EC-14] remove extra policy service methods from vault filter service * [EC-14] remove new methods from old vault-filter.service * [EC-14] Use vault filter service in vault components * [EC-14] reload collections from vault now that we have vault filter service * [EC-14] remove currentFilterCollections in vault filter component * [EC-14] change VaultFilterType to more specific OrganizationFilter in organization-options * [EC-14] include org check in isNodeSelected * [EC-14] add getters to filter function, fix storybook, and add test for All Collections * [EC-14] show org options even if there's a personal vault policy * [EC-14] use !"AllCollections" instead of just !null * [EC-14] Remove extra org Subject in vault filter service * [EC-14] remove null check from vault search text * [EC-14] replace store/build names with set/get. Remove extra call to setOrganizationFilter * [EC-14] add take(1) to subscribe in test * [EC-14] move init logic in org vault filter component to ngOnInit * [EC-14] Fix linter * [EC-14] revert change to vault filter model * [EC-14] be specific about ignoring All Collections * [EC-14] move observable init logic to beforeEach in test * [EC-14] make buildAllFilters return something to reduce side effects Signed-off-by: Jacob Fink <jfink@bitwarden.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Thomas Rittson <eliykat@users.noreply.github.com> * [EC-97] Organization Billing Language / RxJS Warnings (#3688) * [EC-97] Update copy to use the word members in a few places * [EC-97] Cleanup RxJS warnings and unused properties in org billing components * [EC-599] Access Selector Component (#3717) * Add Access Selector Component and Stories * Cherry pick FormSelectionList * Fix some problems caused from cherry-pick * Fix some Web module problems caused from cherry-pick * Move AccessSelector out of the root components directory. Move UserType pipe to AccessSelectorModule * Fix broken member access selector story * Add organization feature module * Undo changes to messages.json * Fix messages.json * Remove redundant CommonModule * [EC-599] Fix avatar/icon sizing * [EC-599] Remove padding in permission column * [EC-599] Make FormSelectionList operations immutable * [EC-599] Integrate the multi-select component * [EC-599] Handle readonly/access all edge cases * [EC-599] Add initial unit tests Also cleans up public interface for the AccessSelectorComponent. Fixes a bug found during unit test creation. * [EC-599] Include item name in control labels * [EC-599] Cleanup member email display * [EC-599] Review suggestions - Change PermissionMode to Enum - Rename permControl to permissionControl to be more clear - Rename FormSelectionList file to kebab case. - Move permission row boolean logic to named function for readability * [EC-599] Cleanup AccessSelectorComponent tests - Clarify test states - Add tests for column rendering - Add tests for permission mode - Add id to column headers for testing - Fix small permissionControl bug found during testing * [EC-599] Add FormSelectionList unit tests * [EC-599] Fix unit test and linter * [EC-599] Update Enums to Pascal case * [EC-599] Undo change to Enum values * [EC-7] fix: broken build * [EC-646] Org Admin Vault Refresh November Release Prep (#3913) * [EC-646] Remove links from Manage component These links are no longer necessary as they are now located in the new OAVR tabs. * [EC-646] Re-introduce the canAccessManageTab helper * [EC-646] Re-introduce /manage route in Organization routing module - Add the parent /manage route - Add child routes for collections, people, and groups * [EC-646] Adjust Org admin tabs Re-introduce the Manage tab and remove Groups and Members tabs. * [EC-646] Change Members title back to People * [EC-646] Move missing billing components Some billing components were in the org settings module and needed to be moved the org billing module * [EC-646] Fix import file upload button -Update to use click event handler and tailwind class to hide input. Avoids inline styles/js blocked by CSP - Fix broken async pipe * [EC-646] Fix groups and people page overflow Remove the container and page-content wrapper as the pages are no longer on their own tab * [EC-646] Change People to Members Change the text regarding managing members from People to Members to more closely follow changes coming later in the OAVR. Also update the URL to use /manage/members * [EC-646] Cherry-pickae39afeto fix tab text color * [EC-646] Fix org routing permissions helpers - Add canAccessVaultTab helper - Update canAccessOrgAdmin include check for vault tab access - Simplify canManageCollections * [EC-646] Fix Manage tab conditional logic - Add *ngIf condition for rendering Manage tab - Re-introduce dynamic route for Manage tab * Revert "[EC-14] Refactor vault filter (#3440)" (#3926) This reverts commit4d83b81d82. * Remove old reference to bit-submit-button that no longer exists (#3927) * [EC-593] Top align event logs row content (#3813) * [EC-593] Top align event log row contents * [EC-593] Prevent event log timestamp from wrapping * [EC-593] Add alignContent input to bitRow directive * [EC-593] Remove ineffective inline styles (CSP) * [EC-593] Remove templated tailwind classes Tailwind minimizes the bundled stylesheet by removing classes that aren't used in code. Using a string template for the classes causes those classes to be ignored. * [EC-593] Introduce alignContent input to table story * [EC-657] Hide Billing History and Payment Method for selfhosted orgs (#3935) Signed-off-by: Jacob Fink <jfink@bitwarden.com> Co-authored-by: Vincent Salucci <vincesalucci21@gmail.com> Co-authored-by: Andreas Coroiu <andreas.coroiu@gmail.com> Co-authored-by: Jake Fink <jfink@bitwarden.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Thomas Rittson <eliykat@users.noreply.github.com> * Add padding to top of Safari extension (#3949) * Use correct provider icon instead of bank icon (#3950) * Fix undefined property error in event logs (#3947) EventService.policies was undefined because the service was erroneously using ngOnInit to subscribe to the policies observable * PS-1763 - handle undefined locale value that exists before a user sets their language (#3952) * Autosync the updated translations (#3968) Co-authored-by: bitwarden-devops-bot <106330231+bitwarden-devops-bot@users.noreply.github.com> * Autosync the updated translations (#3967) Co-authored-by: bitwarden-devops-bot <106330231+bitwarden-devops-bot@users.noreply.github.com> * fixed typo in event log (#3962) * Org admin refresh translation nitpicks (#3971) * Fix use of personal in favor of individual vault * Fix capitalization according to #3577 * Fix capitalization on organizationInfo * Autosync the updated translations (#3974) Co-authored-by: bitwarden-devops-bot <106330231+bitwarden-devops-bot@users.noreply.github.com> * Autosync the updated translations (#3973) Co-authored-by: bitwarden-devops-bot <106330231+bitwarden-devops-bot@users.noreply.github.com> * add csp and only pass hostname to duo init (#3972) * add csp and only pass hostname to duo init * expand style-src * Update apps/web/src/connectors/duo.html Co-authored-by: Oscar Hinton <Hinton@users.noreply.github.com> Co-authored-by: Oscar Hinton <Hinton@users.noreply.github.com> * Move hint button out of the formfield (#3960) * [PS-1734] Send saved urls to autofill script (#3861) * Send all saved url to autofill script * Handle array of matched urls in content script * Prompt at most once to override insecure autofill * Do not send never match URIs to content script We know these URIs did not cause the autofill match, so we can safely remove these from the list of potential matches. * [PS-1804] Display Organization tab for users with custom permissions (#3980) * [EC-584] Fixed OrganizationExportResponse to correctly parse data (#3641) * [EC-584] Fixed OrganizationExportResponse to correctly parse data and use CollectionResponse and CipherResponse constructors * [EC-584] Removed ListResponse from OrganizationExportResponse properties * Bumped web version to 2022.10.3 (#3957) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Revert "Bumped web version to 2022.10.3 (#3957)" This reverts commit5d8d547cd2. * Web version bump to 2022.11.0 for QA testing * Revert "Web version bump to 2022.11.0 for QA testing" This reverts commit484db431ed. Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Joseph Flinn <joseph.s.flinn@gmail.com> * [EC-678] [EC-673] Fix active tab not showing selected while in child route (#3964) * [PS-1114] hide reporting sidebar if only events * [PS-1114] add orgRedirectGuard * [PS-1114] highlight tabs based on route subset * [PS-1114] redirect to correct child route on tab - Use new OrgRedirectGuard * [PS-1114] add settings redirect using guard - refactored guard to accept array of strings * [EC-678] [EC-673] remove remaining methods * [EC-678][EC-673] address PR feedback - change switch to if statements - remove ternary * [EC-672] Update SSO login page language (#3997) - Replace 'Organization Identifier' with 'SSO identifier' - Sentence case 'SSO identifier' - Add 'SSO' to SSO login page helper text * Autosync the updated translations (#3969) Co-authored-by: bitwarden-devops-bot <106330231+bitwarden-devops-bot@users.noreply.github.com> * [EC-661] Add web worker code bundles to Safari browser extension (#3986) * Make browser bundle encrypt-worker.ts into a single named file * Add encrypt-worker bundle to xcode proj * Fixed EC reported event log copy bugs (#3977) * [EC-645] fix: web payment component breaking storybook compilation (#3906) * add run-name for releases to include their workflow trigger (#3996) * add run-name for releases to include their workflow trigger * add edit for linter error * Update .github/workflows/release-web.yml Co-authored-by: Vince Grassia <593223+vgrassia@users.noreply.github.com> Co-authored-by: Vince Grassia <593223+vgrassia@users.noreply.github.com> * Extract and fix trigger for PR auto responses (Translation-PRs) (#3992) * Extract and fix trigger for PR auto responses * Fix permission used for job * [EC-650] Revert observable usage from ImportComponent (#4010) * Run enforce labels workflow on version bump in clients repo (#4006) * Fix version bump to run enforce labels workflow * Add login to Azure * Trigger enforce labels manually from bump version workflow * Update .github/workflows/enforce-labels.yml Co-authored-by: Vince Grassia <593223+vgrassia@users.noreply.github.com> * Update .github/workflows/version-bump.yml Co-authored-by: Vince Grassia <593223+vgrassia@users.noreply.github.com> Co-authored-by: Vince Grassia <593223+vgrassia@users.noreply.github.com> * [EC-670] Update Members tab to support flex wrap (#4003) Use tailwind classes to style the Members page header so that it supports wrapping the controls to a new line should they exceed the width of the container. * [PS-1841] Fix org-* commands for CLI (#4013) * Add getFromState method * Added a method for CLI to get an org from state * Converted all CLI calls to `.get()` * Used `.getFromState` instead of `.get` * Deprecate getFromState method * Remove local vaultFilter (#4014) * Use vault filter item from vaultFilterService * [PS-1843] Sort organizations in `buildOrganizations` (#4015) * Sort organizations in buildOrganizations * Add sort by name to Organization Switcher * [EC-675] Display the Event for “Viewed Card Number for item item-identifier” (#3976) * [EC-675] Add missing Event capture for viewing item Card Number * [EC-675] Fix correct event type for viewing item Card Number * Update apps/web/src/locales/en/messages.json Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> * [EC-449] Event log user for SCIM events (#3643) * [EC-449] Added EventSystemUser Enum and added systemUser property to eventResponse * [EC-449] Add systemUser property to BaseEventsComponent, EventExport and EventView * [EC-449] Set EventSystemUser as string on EventExport * [EC-449] Remove systemUser from EventExport * [EC-449] Rename EventSystemUser file to lowercase * [EC-449] Force git to rename EventSystemUser file * [EC-449] Rename EventSystemUser file to event-system-user.ts * [EC-449] Fix EventSystemUser reference on EventsComponent * [EC-449] Move installationId username logic to BaseEventsComponent * Update libs/common/src/enums/event-system-user.ts Add a note to warn about using the Enum key in the UI. Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> * [EC-449] Remove EventSystemUser from provider events. Remove nested condition on events component Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> * [PS-1840] - fix for covered dropdown on empty vault (#4019) * fix for covered dropdown on empty vault This could be done one of 2-3 ways. I think this might be the least problematic, but could also be done with just changing "position: absolute" to "relative on the ".no-items" class - base.css:461 For some reason, I'm unable to load the spinner to test. * rename class * Remove uses of rxjs in CLI (#4028) * [SM-327] Electron hard reset (#3988) * Add folders to whitelist (#3994) * Defect/sg 650 desktop pw/passphrase gen not auto updating on min value change (#4032) * SG-650 - Desktop - Pw Generation - Min value ctrls now use (change) instead of (blur) for better responsiveness when using arrows on input or arrow keys. Note: (input) has change detection issues for resetting the value to either max pw length or max value of 9 + passwordGeneration.service logic possibly needs refactoring to either enforce max of 9 or not * SG-650 - Desktop - Passphrase Gen - min words now uses (change) instead of (blur) for better responsiveness * Autosync the updated translations (#4035) Co-authored-by: bitwarden-devops-bot <106330231+bitwarden-devops-bot@users.noreply.github.com> * Autosync the updated translations (#4036) Co-authored-by: bitwarden-devops-bot <106330231+bitwarden-devops-bot@users.noreply.github.com> * Autosync the updated translations (#4037) Co-authored-by: bitwarden-devops-bot <106330231+bitwarden-devops-bot@users.noreply.github.com> * Expand serve origin protection warning (#4024) This warning was kept vague during fix rollout, but now that we're more than a release past, we can expand the explanation. * [SM-340] Fix share modal not closing on cancel (#4041) * [EC-739 / EC-740] Add null check to policyFilter on PolicyService (#4039) * [EC-739 / EC-740] Add null check to policyFilter on PolicyService * [EC-739 / EC-740] Add unit tests for policy filter * [PS-1805] BEEEP: Renamed importers based on agreed naming-convention (#3978) * Rename all importer related files Renamed all files based on our naming convention which we decided on with https://github.com/bitwarden/adr/blob/master/decisions/0012-angular-filename-convention.md * Removed entries from whitelist-capital-letters.txt * Rename missing safeInCloud test data * Fix broken import * Renamed folders (removed capital letters) * Fix filename of BitwardenCsvImporter * Fix imports of onepassword mac/win importer tests * Remove already renamed folders from whitelist * Rename dashlaneImporters to dashlane Rename the folder Fix all the imports Remove dashlaneImporters from white-list * Rename keeperImporters to keeper Rename the folder Fix all the imports Remove keeperImporters from white-list * Rename onepasswordImporters to onepassword Rename the folder Fix all the imports Remove onepasswordImporters from white-list * Rename safeinCloud test data folder * Fix onepassword importer type imports * [EC-744] Revert PolicyService back to clearing DecryptedPolicies on StateService (#4042) * [EC-746] Call BaseAddEditComponent.ngOnInit on Desktop AddEditComponent (#4044) * PS-1798 - ensure admin users can edit ciphers (#4025) * Use loginService to get and set remember email values (#3941) * SG-428 - Browser Extension - Send - Expiration / Deletion date calendar icon +… (#4034) * Browser Extension - Send - Expiration / Deletion date calendar icon + datepicker pop up now respect theme better in Chrome / Chromium based browsers and Safari (Firefox datepicker pop up doesn't seem to have an easy mechanism for theming) * SG-428 - Extension - Iconography for date inputs for Chromium browsers now reflects theme colors properly + hover states; icon not shown on non-Chromium browsers * Variables.scss - ran prettier locally after tweaking comments to pass eslint checks * [EC-743] Call super to ngOnInit to include policy observable changes (#4047) * Hide My Vault if Remove Individual Vault is on (#4052) * Devops 1039 update release flow dry run step names (#4016) * Updated workflows to not create Github deployment on Dry Run. (#4049) * Add organization-options menu to single org (#3678) (#4051) Re-apply commit7c3255d(#3678) which was accidentally reverted by the Org Admin Refresh changes in commit09c3bc8(#3925) * SG-725 - Desktop - Moved DuckDuckGo setting down so that the Biometric browser settings are not separated (#4059) * [EC-750] Specify organizationId for credit and adjust payment components (#4061) * [SM-330] Disable managed environments for safari (#3953) * [EC-665] Fix biometrics button style (#3979) * fix biometrics button style * expand button to fill space this is a result of it being used outside the box-content * remove padding from box-footer * Added Mastodon to follow us menu (#4029) * Add branch check for Staged Rollout Desktop workflow (#4062) * [PS-1783] Fix file selector input bug from PS-1465 ( #3502 ) (#3928) * Fix file selector input * Add file selector state changes back * Remove async pipe * Revert "[EC-646] Org Admin Vault Refresh November Release Prep (#3913)" This reverts commit4b57d28e28. * [EC-646] Move missing billing components Some billing components were in the org settings module and needed to be moved the org billing module (cherry picked from commit1c11695f46) * [EC-646] Cherry-pickae39afeto fix tab text color (cherry picked from commit467f584b9e) * Make destroy$ protected to fix linting error Signed-off-by: Jacob Fink <jfink@bitwarden.com> Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: bitwarden-devops-bot <106330231+bitwarden-devops-bot@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> Co-authored-by: Oscar Hinton <Hinton@users.noreply.github.com> Co-authored-by: Sammy Chang <sammychang2185@gmail.com> Co-authored-by: Todd Martin <106564991+trmartin4@users.noreply.github.com> Co-authored-by: Gbubemi Smith <gsmith@bitwarden.com> Co-authored-by: Addison Beck <addisonbeck1@gmail.com> Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com> Co-authored-by: gbubemismith <gsmithwalter@gmail.com> Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com> Co-authored-by: Michał Chęciński <mchecinski@bitwarden.com> Co-authored-by: cd-bitwarden <106776772+cd-bitwarden@users.noreply.github.com> Co-authored-by: Scott McFarlane <91044021+scottmondo@users.noreply.github.com> Co-authored-by: Joseph Flinn <58369717+joseph-flinn@users.noreply.github.com> Co-authored-by: Andreas Coroiu <acoroiu@bitwarden.com> Co-authored-by: DanHillesheim <79476558+DanHillesheim@users.noreply.github.com> Co-authored-by: Kyle Spearrin <kyle.spearrin@gmail.com> Co-authored-by: Vincent Salucci <vincesalucci21@gmail.com> Co-authored-by: Andreas Coroiu <andreas.coroiu@gmail.com> Co-authored-by: Jake Fink <jfink@bitwarden.com> Co-authored-by: Thomas Rittson <eliykat@users.noreply.github.com> Co-authored-by: dgoodman-bw <109169446+dgoodman-bw@users.noreply.github.com> Co-authored-by: Danielle Flinn <43477473+danielleflinn@users.noreply.github.com> Co-authored-by: Matt Gibson <mgibson@bitwarden.com> Co-authored-by: Rui Tomé <108268980+r-tome@users.noreply.github.com> Co-authored-by: Joseph Flinn <joseph.s.flinn@gmail.com> Co-authored-by: Opeyemi <54288773+Eebru-gzy@users.noreply.github.com> Co-authored-by: Vince Grassia <593223+vgrassia@users.noreply.github.com> Co-authored-by: Jared Snider <116684653+JaredSnider-Bitwarden@users.noreply.github.com> Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Co-authored-by: Ash Leece <ash@leece.im>
This commit is contained in:
@@ -1,12 +1,15 @@
|
||||
import { Directive, OnInit } from "@angular/core";
|
||||
import { Router } from "@angular/router";
|
||||
|
||||
import { ApiService } from "@bitwarden/common/abstractions/api.service";
|
||||
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
||||
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
||||
import { LoginService } from "@bitwarden/common/abstractions/login.service";
|
||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||
import { PasswordHintRequest } from "@bitwarden/common/models/request/password-hint.request";
|
||||
|
||||
export class HintComponent {
|
||||
@Directive()
|
||||
export class HintComponent implements OnInit {
|
||||
email = "";
|
||||
formPromise: Promise<any>;
|
||||
|
||||
@@ -18,9 +21,14 @@ export class HintComponent {
|
||||
protected i18nService: I18nService,
|
||||
protected apiService: ApiService,
|
||||
protected platformUtilsService: PlatformUtilsService,
|
||||
private logService: LogService
|
||||
private logService: LogService,
|
||||
private loginService: LoginService
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.email = this.loginService.getEmail() ?? "";
|
||||
}
|
||||
|
||||
async submit() {
|
||||
if (this.email == null || this.email === "") {
|
||||
this.platformUtilsService.showToast(
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import { Directive, NgZone, OnInit } from "@angular/core";
|
||||
import { FormBuilder, Validators } from "@angular/forms";
|
||||
import { Router } from "@angular/router";
|
||||
import { ActivatedRoute, Router } from "@angular/router";
|
||||
import { take } from "rxjs/operators";
|
||||
|
||||
import { ApiService } from "@bitwarden/common/abstractions/api.service";
|
||||
import { AppIdService } from "@bitwarden/common/abstractions/appId.service";
|
||||
import { AuthService } from "@bitwarden/common/abstractions/auth.service";
|
||||
import { CryptoFunctionService } from "@bitwarden/common/abstractions/cryptoFunction.service";
|
||||
import { EnvironmentService } from "@bitwarden/common/abstractions/environment.service";
|
||||
@@ -12,6 +14,7 @@ import {
|
||||
} from "@bitwarden/common/abstractions/formValidationErrors.service";
|
||||
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
||||
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
||||
import { LoginService } from "@bitwarden/common/abstractions/login.service";
|
||||
import { PasswordGenerationService } from "@bitwarden/common/abstractions/passwordGeneration.service";
|
||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
||||
@@ -29,20 +32,30 @@ export class LoginComponent extends CaptchaProtectedComponent implements OnInit
|
||||
onSuccessfulLoginNavigate: () => Promise<any>;
|
||||
onSuccessfulLoginTwoFactorNavigate: () => Promise<any>;
|
||||
onSuccessfulLoginForceResetNavigate: () => Promise<any>;
|
||||
selfHosted = false;
|
||||
private selfHosted = false;
|
||||
showLoginWithDevice: boolean;
|
||||
validatedEmail = false;
|
||||
paramEmailSet = false;
|
||||
|
||||
formGroup = this.formBuilder.group({
|
||||
email: ["", [Validators.required, Validators.email]],
|
||||
masterPassword: ["", [Validators.required, Validators.minLength(8)]],
|
||||
rememberEmail: [true],
|
||||
rememberEmail: [false],
|
||||
});
|
||||
|
||||
protected twoFactorRoute = "2fa";
|
||||
protected successRoute = "vault";
|
||||
protected forcePasswordResetRoute = "update-temp-password";
|
||||
protected alwaysRememberEmail = false;
|
||||
protected skipRememberEmail = false;
|
||||
|
||||
get loggedEmail() {
|
||||
return this.formGroup.value.email;
|
||||
}
|
||||
|
||||
constructor(
|
||||
protected apiService: ApiService,
|
||||
protected appIdService: AppIdService,
|
||||
protected authService: AuthService,
|
||||
protected router: Router,
|
||||
platformUtilsService: PlatformUtilsService,
|
||||
@@ -54,7 +67,9 @@ export class LoginComponent extends CaptchaProtectedComponent implements OnInit
|
||||
protected logService: LogService,
|
||||
protected ngZone: NgZone,
|
||||
protected formBuilder: FormBuilder,
|
||||
protected formValidationErrorService: FormValidationErrorsService
|
||||
protected formValidationErrorService: FormValidationErrorsService,
|
||||
protected route: ActivatedRoute,
|
||||
protected loginService: LoginService
|
||||
) {
|
||||
super(environmentService, i18nService, platformUtilsService);
|
||||
this.selfHosted = platformUtilsService.isSelfHost();
|
||||
@@ -65,19 +80,35 @@ export class LoginComponent extends CaptchaProtectedComponent implements OnInit
|
||||
}
|
||||
|
||||
async ngOnInit() {
|
||||
let email = this.formGroup.value.email;
|
||||
this.route?.queryParams.subscribe((params) => {
|
||||
if (params != null) {
|
||||
const queryParamsEmail = params["email"];
|
||||
if (queryParamsEmail != null && queryParamsEmail.indexOf("@") > -1) {
|
||||
this.formGroup.get("email").setValue(queryParamsEmail);
|
||||
this.paramEmailSet = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
let email = this.loginService.getEmail();
|
||||
|
||||
if (email == null || email === "") {
|
||||
email = await this.stateService.getRememberedEmail();
|
||||
this.formGroup.get("email")?.setValue(email);
|
||||
}
|
||||
|
||||
if (email == null) {
|
||||
this.formGroup.get("email")?.setValue("");
|
||||
}
|
||||
if (!this.paramEmailSet) {
|
||||
this.formGroup.get("email")?.setValue(email ?? "");
|
||||
}
|
||||
if (!this.alwaysRememberEmail) {
|
||||
const rememberEmail = (await this.stateService.getRememberedEmail()) != null;
|
||||
let rememberEmail = this.loginService.getRememberEmail();
|
||||
if (rememberEmail == null) {
|
||||
rememberEmail = (await this.stateService.getRememberedEmail()) != null;
|
||||
}
|
||||
this.formGroup.get("rememberEmail")?.setValue(rememberEmail);
|
||||
}
|
||||
|
||||
if (email) {
|
||||
this.validateEmail();
|
||||
}
|
||||
}
|
||||
|
||||
async submit(showToast = true) {
|
||||
@@ -108,6 +139,7 @@ export class LoginComponent extends CaptchaProtectedComponent implements OnInit
|
||||
);
|
||||
this.formPromise = this.authService.logIn(credentials);
|
||||
const response = await this.formPromise;
|
||||
this.setFormValues();
|
||||
if (data.rememberEmail || this.alwaysRememberEmail) {
|
||||
await this.stateService.setRememberedEmail(data.email);
|
||||
} else {
|
||||
@@ -130,6 +162,7 @@ export class LoginComponent extends CaptchaProtectedComponent implements OnInit
|
||||
} else {
|
||||
const disableFavicon = await this.stateService.getDisableFavicon();
|
||||
await this.stateService.setDisableFavicon(!!disableFavicon);
|
||||
this.loginService.clearValues();
|
||||
if (this.onSuccessfulLogin != null) {
|
||||
this.onSuccessfulLogin();
|
||||
}
|
||||
@@ -191,6 +224,25 @@ export class LoginComponent extends CaptchaProtectedComponent implements OnInit
|
||||
);
|
||||
}
|
||||
|
||||
async validateEmail() {
|
||||
this.formGroup.controls.email.markAsTouched();
|
||||
const emailInvalid = this.formGroup.get("email").invalid;
|
||||
if (!emailInvalid) {
|
||||
this.toggleValidateEmail(true);
|
||||
await this.getLoginWithDevice(this.loggedEmail);
|
||||
}
|
||||
}
|
||||
|
||||
toggleValidateEmail(value: boolean) {
|
||||
this.validatedEmail = value;
|
||||
this.formGroup.controls.masterPassword.reset();
|
||||
}
|
||||
|
||||
setFormValues() {
|
||||
this.loginService.setEmail(this.formGroup.value.email);
|
||||
this.loginService.setRememberEmail(this.formGroup.value.rememberEmail);
|
||||
}
|
||||
|
||||
private getErrorToastMessage() {
|
||||
const error: AllValidationErrors = this.formValidationErrorService
|
||||
.getFormValidationErrors(this.formGroup.controls)
|
||||
@@ -213,8 +265,14 @@ export class LoginComponent extends CaptchaProtectedComponent implements OnInit
|
||||
return `${error.controlName}${name}`;
|
||||
}
|
||||
|
||||
protected focusInput() {
|
||||
const email = this.formGroup.value.email;
|
||||
document.getElementById(email == null || email === "" ? "email" : "masterPassword").focus();
|
||||
private async getLoginWithDevice(email: string) {
|
||||
try {
|
||||
const deviceIdentifier = await this.appIdService.getAppId();
|
||||
const res = await this.apiService.getKnownDevice(email, deviceIdentifier);
|
||||
//ensure the application is not self-hosted
|
||||
this.showLoginWithDevice = res && !this.selfHosted;
|
||||
} catch (e) {
|
||||
this.showLoginWithDevice = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import { AuthService } from "@bitwarden/common/abstractions/auth.service";
|
||||
import { EnvironmentService } from "@bitwarden/common/abstractions/environment.service";
|
||||
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
||||
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
||||
import { LoginService } from "@bitwarden/common/abstractions/login.service";
|
||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
||||
import { TwoFactorService } from "@bitwarden/common/abstractions/twoFactor.service";
|
||||
@@ -59,7 +60,8 @@ export class TwoFactorComponent extends CaptchaProtectedComponent implements OnI
|
||||
protected route: ActivatedRoute,
|
||||
protected logService: LogService,
|
||||
protected twoFactorService: TwoFactorService,
|
||||
protected appIdService: AppIdService
|
||||
protected appIdService: AppIdService,
|
||||
protected loginService: LoginService
|
||||
) {
|
||||
super(environmentService, i18nService, platformUtilsService);
|
||||
this.webAuthnSupported = this.platformUtilsService.supportsWebAuthn(win);
|
||||
@@ -204,6 +206,7 @@ export class TwoFactorComponent extends CaptchaProtectedComponent implements OnI
|
||||
return;
|
||||
}
|
||||
if (this.onSuccessfulLogin != null) {
|
||||
this.loginService.clearValues();
|
||||
this.onSuccessfulLogin();
|
||||
}
|
||||
if (response.resetMasterPassword) {
|
||||
@@ -213,8 +216,10 @@ export class TwoFactorComponent extends CaptchaProtectedComponent implements OnI
|
||||
this.successRoute = "update-temp-password";
|
||||
}
|
||||
if (this.onSuccessfulLoginNavigate != null) {
|
||||
this.loginService.clearValues();
|
||||
this.onSuccessfulLoginNavigate();
|
||||
} else {
|
||||
this.loginService.clearValues();
|
||||
this.router.navigate([this.successRoute], {
|
||||
queryParams: {
|
||||
identifier: this.identifier,
|
||||
|
||||
@@ -257,7 +257,7 @@ export class ViewComponent implements OnDestroy, OnInit {
|
||||
|
||||
this.showCardNumber = !this.showCardNumber;
|
||||
if (this.showCardNumber) {
|
||||
this.eventService.collect(EventType.Cipher_ClientToggledCardCodeVisible, this.cipherId);
|
||||
this.eventService.collect(EventType.Cipher_ClientToggledCardNumberVisible, this.cipherId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { Injector, LOCALE_ID, NgModule } from "@angular/core";
|
||||
|
||||
import { AbstractEncryptService } from "@bitwarden/common/abstractions/abstractEncrypt.service";
|
||||
import { AccountApiService as AccountApiServiceAbstraction } from "@bitwarden/common/abstractions/account/account-api.service";
|
||||
import {
|
||||
InternalAccountService,
|
||||
@@ -18,6 +17,7 @@ import { ConfigApiServiceAbstraction } from "@bitwarden/common/abstractions/conf
|
||||
import { ConfigServiceAbstraction } from "@bitwarden/common/abstractions/config/config.service.abstraction";
|
||||
import { CryptoService as CryptoServiceAbstraction } from "@bitwarden/common/abstractions/crypto.service";
|
||||
import { CryptoFunctionService as CryptoFunctionServiceAbstraction } from "@bitwarden/common/abstractions/cryptoFunction.service";
|
||||
import { EncryptService } from "@bitwarden/common/abstractions/encrypt.service";
|
||||
import { EnvironmentService as EnvironmentServiceAbstraction } from "@bitwarden/common/abstractions/environment.service";
|
||||
import { EventService as EventServiceAbstraction } from "@bitwarden/common/abstractions/event.service";
|
||||
import { ExportService as ExportServiceAbstraction } from "@bitwarden/common/abstractions/export.service";
|
||||
@@ -31,6 +31,7 @@ import { FormValidationErrorsService as FormValidationErrorsServiceAbstraction }
|
||||
import { I18nService as I18nServiceAbstraction } from "@bitwarden/common/abstractions/i18n.service";
|
||||
import { KeyConnectorService as KeyConnectorServiceAbstraction } from "@bitwarden/common/abstractions/keyConnector.service";
|
||||
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
||||
import { LoginService as LoginServiceAbstraction } from "@bitwarden/common/abstractions/login.service";
|
||||
import { MessagingService as MessagingServiceAbstraction } from "@bitwarden/common/abstractions/messaging.service";
|
||||
import { NotificationsService as NotificationsServiceAbstraction } from "@bitwarden/common/abstractions/notifications.service";
|
||||
import { OrganizationApiServiceAbstraction } from "@bitwarden/common/abstractions/organization/organization-api.service.abstraction";
|
||||
@@ -62,6 +63,7 @@ import { ValidationService as ValidationServiceAbstraction } from "@bitwarden/co
|
||||
import { VaultTimeoutService as VaultTimeoutServiceAbstraction } from "@bitwarden/common/abstractions/vaultTimeout/vaultTimeout.service";
|
||||
import { VaultTimeoutSettingsService as VaultTimeoutSettingsServiceAbstraction } from "@bitwarden/common/abstractions/vaultTimeout/vaultTimeoutSettings.service";
|
||||
import { StateFactory } from "@bitwarden/common/factories/stateFactory";
|
||||
import { flagEnabled } from "@bitwarden/common/misc/flags";
|
||||
import { Account } from "@bitwarden/common/models/domain/account";
|
||||
import { GlobalState } from "@bitwarden/common/models/domain/global-state";
|
||||
import { AccountApiServiceImplementation } from "@bitwarden/common/services/account/account-api.service";
|
||||
@@ -77,7 +79,8 @@ import { ConfigApiService } from "@bitwarden/common/services/config/config-api.s
|
||||
import { ConfigService } from "@bitwarden/common/services/config/config.service";
|
||||
import { ConsoleLogService } from "@bitwarden/common/services/consoleLog.service";
|
||||
import { CryptoService } from "@bitwarden/common/services/crypto.service";
|
||||
import { EncryptService } from "@bitwarden/common/services/encrypt.service";
|
||||
import { EncryptServiceImplementation } from "@bitwarden/common/services/cryptography/encrypt.service.implementation";
|
||||
import { MultithreadEncryptServiceImplementation } from "@bitwarden/common/services/cryptography/multithread-encrypt.service.implementation";
|
||||
import { EnvironmentService } from "@bitwarden/common/services/environment.service";
|
||||
import { EventService } from "@bitwarden/common/services/event.service";
|
||||
import { ExportService } from "@bitwarden/common/services/export.service";
|
||||
@@ -86,6 +89,7 @@ import { FolderApiService } from "@bitwarden/common/services/folder/folder-api.s
|
||||
import { FolderService } from "@bitwarden/common/services/folder/folder.service";
|
||||
import { FormValidationErrorsService } from "@bitwarden/common/services/formValidationErrors.service";
|
||||
import { KeyConnectorService } from "@bitwarden/common/services/keyConnector.service";
|
||||
import { LoginService } from "@bitwarden/common/services/login.service";
|
||||
import { NotificationsService } from "@bitwarden/common/services/notifications.service";
|
||||
import { OrganizationApiService } from "@bitwarden/common/services/organization/organization-api.service";
|
||||
import { OrganizationService } from "@bitwarden/common/services/organization/organization.service";
|
||||
@@ -216,7 +220,8 @@ import { AbstractThemingService } from "./theming/theming.service.abstraction";
|
||||
i18nService: I18nServiceAbstraction,
|
||||
injector: Injector,
|
||||
logService: LogService,
|
||||
stateService: StateServiceAbstraction
|
||||
stateService: StateServiceAbstraction,
|
||||
encryptService: EncryptService
|
||||
) =>
|
||||
new CipherService(
|
||||
cryptoService,
|
||||
@@ -226,7 +231,8 @@ import { AbstractThemingService } from "./theming/theming.service.abstraction";
|
||||
i18nService,
|
||||
() => injector.get(SearchServiceAbstraction),
|
||||
logService,
|
||||
stateService
|
||||
stateService,
|
||||
encryptService
|
||||
),
|
||||
deps: [
|
||||
CryptoServiceAbstraction,
|
||||
@@ -237,6 +243,7 @@ import { AbstractThemingService } from "./theming/theming.service.abstraction";
|
||||
Injector, // TODO: Get rid of this circular dependency!
|
||||
LogService,
|
||||
StateServiceAbstraction,
|
||||
EncryptService,
|
||||
],
|
||||
},
|
||||
{
|
||||
@@ -299,7 +306,7 @@ import { AbstractThemingService } from "./theming/theming.service.abstraction";
|
||||
useClass: CryptoService,
|
||||
deps: [
|
||||
CryptoFunctionServiceAbstraction,
|
||||
AbstractEncryptService,
|
||||
EncryptService,
|
||||
PlatformUtilsServiceAbstraction,
|
||||
LogService,
|
||||
StateServiceAbstraction,
|
||||
@@ -442,8 +449,8 @@ import { AbstractThemingService } from "./theming/theming.service.abstraction";
|
||||
deps: [WINDOW],
|
||||
},
|
||||
{
|
||||
provide: AbstractEncryptService,
|
||||
useClass: EncryptService,
|
||||
provide: EncryptService,
|
||||
useFactory: encryptServiceFactory,
|
||||
deps: [CryptoFunctionServiceAbstraction, LogService, LOG_MAC_FAILURES],
|
||||
},
|
||||
{
|
||||
@@ -573,6 +580,20 @@ import { AbstractThemingService } from "./theming/theming.service.abstraction";
|
||||
useClass: ValidationService,
|
||||
deps: [I18nServiceAbstraction, PlatformUtilsServiceAbstraction],
|
||||
},
|
||||
{
|
||||
provide: LoginServiceAbstraction,
|
||||
useClass: LoginService,
|
||||
},
|
||||
],
|
||||
})
|
||||
export class JslibServicesModule {}
|
||||
|
||||
function encryptServiceFactory(
|
||||
cryptoFunctionservice: CryptoFunctionServiceAbstraction,
|
||||
logService: LogService,
|
||||
logMacFailures: boolean
|
||||
): EncryptService {
|
||||
return flagEnabled("multithreadDecryption")
|
||||
? new MultithreadEncryptServiceImplementation(cryptoFunctionservice, logService, logMacFailures)
|
||||
: new EncryptServiceImplementation(cryptoFunctionservice, logService, logMacFailures);
|
||||
}
|
||||
|
||||
@@ -38,8 +38,13 @@ export class VaultFilterService implements DeprecatedVaultFilterServiceAbstracti
|
||||
return new Set(await this.stateService.getCollapsedGroupings());
|
||||
}
|
||||
|
||||
buildOrganizations(): Promise<Organization[]> {
|
||||
return this.organizationService.getAll();
|
||||
async buildOrganizations(): Promise<Organization[]> {
|
||||
let organizations = await this.organizationService.getAll();
|
||||
if (organizations != null) {
|
||||
organizations = organizations.sort((a, b) => a.name.localeCompare(b.name));
|
||||
}
|
||||
|
||||
return organizations;
|
||||
}
|
||||
|
||||
buildNestedFolders(organizationId?: string): Observable<DynamicTreeNode<FolderView>> {
|
||||
|
||||
@@ -3,9 +3,9 @@ import { Substitute, SubstituteOf } from "@fluffy-spoon/substitute";
|
||||
|
||||
import { CryptoService } from "@bitwarden/common/abstractions/crypto.service";
|
||||
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
||||
import { BitwardenJsonImporter } from "@bitwarden/common/importers/bitwardenJsonImporter";
|
||||
import { BitwardenJsonImporter } from "@bitwarden/common/importers/bitwarden-json-importer";
|
||||
|
||||
import { data as passwordProtectedData } from "./testData/bitwardenJson/passwordProtected.json";
|
||||
import { data as passwordProtectedData } from "./test-data/bitwarden-json/password-protected.json";
|
||||
|
||||
describe("bitwarden json importer", () => {
|
||||
let sut: BitwardenJsonImporter;
|
||||
@@ -4,11 +4,11 @@ import { Substitute, Arg, SubstituteOf } from "@fluffy-spoon/substitute";
|
||||
import { CryptoService } from "@bitwarden/common/abstractions/crypto.service";
|
||||
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
||||
import { KdfType } from "@bitwarden/common/enums/kdfType";
|
||||
import { BitwardenPasswordProtectedImporter } from "@bitwarden/common/importers/bitwardenPasswordProtectedImporter";
|
||||
import { BitwardenPasswordProtectedImporter } from "@bitwarden/common/importers/bitwarden-password-protected-importer";
|
||||
import { Utils } from "@bitwarden/common/misc/utils";
|
||||
import { ImportResult } from "@bitwarden/common/models/domain/import-result";
|
||||
|
||||
import { data as emptyDecryptedData } from "./testData/bitwardenJson/empty.json";
|
||||
import { data as emptyDecryptedData } from "./test-data/bitwarden-json/empty.json";
|
||||
|
||||
describe("BitwardenPasswordProtectedImporter", () => {
|
||||
let importer: BitwardenPasswordProtectedImporter;
|
||||
@@ -3,8 +3,8 @@ import { CipherView } from "@bitwarden/common/models/view/cipher.view";
|
||||
import { LoginUriView } from "@bitwarden/common/models/view/login-uri.view";
|
||||
import { LoginView } from "@bitwarden/common/models/view/login.view";
|
||||
|
||||
import { data as androidData } from "./testData/chromeCsv/android-data.csv";
|
||||
import { data as simplePasswordData } from "./testData/chromeCsv/simple-password-data.csv";
|
||||
import { data as androidData } from "./test-data/chrome-csv/android-data.csv";
|
||||
import { data as simplePasswordData } from "./test-data/chrome-csv/simple-password-data.csv";
|
||||
|
||||
const CipherData = [
|
||||
{
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { CipherType } from "@bitwarden/common/enums/cipherType";
|
||||
import { DashlaneCsvImporter as Importer } from "@bitwarden/common/importers/dashlaneImporters/dashlaneCsvImporter";
|
||||
import { DashlaneCsvImporter as Importer } from "@bitwarden/common/importers/dashlane/dashlane-csv-importer";
|
||||
|
||||
import { credentialsData } from "./testData/dashlaneCsv/credentials.csv";
|
||||
import { identityData } from "./testData/dashlaneCsv/id.csv";
|
||||
import { multiplePersonalInfoData } from "./testData/dashlaneCsv/multiplePersonalInfo.csv";
|
||||
import { paymentsData } from "./testData/dashlaneCsv/payments.csv";
|
||||
import { personalInfoData } from "./testData/dashlaneCsv/personalInfo.csv";
|
||||
import { secureNoteData } from "./testData/dashlaneCsv/securenotes.csv";
|
||||
import { credentialsData } from "./test-data/dashlane-csv/credentials.csv";
|
||||
import { identityData } from "./test-data/dashlane-csv/id.csv";
|
||||
import { multiplePersonalInfoData } from "./test-data/dashlane-csv/multiple-personal-info.csv";
|
||||
import { paymentsData } from "./test-data/dashlane-csv/payments.csv";
|
||||
import { personalInfoData } from "./test-data/dashlane-csv/personal-info.csv";
|
||||
import { secureNoteData } from "./test-data/dashlane-csv/securenotes.csv";
|
||||
|
||||
describe("Dashlane CSV Importer", () => {
|
||||
let importer: Importer;
|
||||
@@ -1,10 +1,10 @@
|
||||
import { FirefoxCsvImporter as Importer } from "@bitwarden/common/importers/firefoxCsvImporter";
|
||||
import { FirefoxCsvImporter as Importer } from "@bitwarden/common/importers/firefox-csv-importer";
|
||||
import { CipherView } from "@bitwarden/common/models/view/cipher.view";
|
||||
import { LoginUriView } from "@bitwarden/common/models/view/login-uri.view";
|
||||
import { LoginView } from "@bitwarden/common/models/view/login.view";
|
||||
|
||||
import { data as firefoxAccountsData } from "./testData/firefoxCsv/firefoxAccountsData.csv";
|
||||
import { data as simplePasswordData } from "./testData/firefoxCsv/simplePasswordData.csv";
|
||||
import { data as firefoxAccountsData } from "./test-data/firefox-csv/firefox-accounts-data.csv";
|
||||
import { data as simplePasswordData } from "./test-data/firefox-csv/simple-password-data.csv";
|
||||
|
||||
const CipherData = [
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
import { FSecureFskImporter as Importer } from "@bitwarden/common/importers/fsecureFskImporter";
|
||||
import { FSecureFskImporter as Importer } from "@bitwarden/common/importers/fsecure-fsk-importer";
|
||||
|
||||
const TestDataWithStyleSetToWebsite: string = JSON.stringify({
|
||||
data: {
|
||||
@@ -1,4 +1,4 @@
|
||||
import { KeePass2XmlImporter as Importer } from "@bitwarden/common/importers/keepass2XmlImporter";
|
||||
import { KeePass2XmlImporter as Importer } from "@bitwarden/common/importers/keepass2-xml-importer";
|
||||
|
||||
const TestData = `<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
||||
<KeePassFile>
|
||||
@@ -1,7 +1,7 @@
|
||||
import { KeeperJsonImporter as Importer } from "@bitwarden/common/importers/keeperImporters/keeperJsonImporter";
|
||||
import { KeeperJsonImporter as Importer } from "@bitwarden/common/importers/keeper/keeper-json-importer";
|
||||
import { Utils } from "@bitwarden/common/misc/utils";
|
||||
|
||||
import { testData as TestData } from "./testData/keeperJson/testData";
|
||||
import { testData as TestData } from "./test-data/keeper-json/testdata.json";
|
||||
|
||||
describe("Keeper Json Importer", () => {
|
||||
const testDataJson = JSON.stringify(TestData);
|
||||
@@ -1,6 +1,6 @@
|
||||
import { CipherType } from "@bitwarden/common/enums/cipherType";
|
||||
import { FieldType } from "@bitwarden/common/enums/fieldType";
|
||||
import { LastPassCsvImporter as Importer } from "@bitwarden/common/importers/lastpassCsvImporter";
|
||||
import { LastPassCsvImporter as Importer } from "@bitwarden/common/importers/lastpass-csv-importer";
|
||||
import { ImportResult } from "@bitwarden/common/models/domain/import-result";
|
||||
import { CipherView } from "@bitwarden/common/models/view/cipher.view";
|
||||
import { FieldView } from "@bitwarden/common/models/view/field.view";
|
||||
@@ -1,13 +1,13 @@
|
||||
import { CipherType } from "@bitwarden/common/enums/cipherType";
|
||||
import { MykiCsvImporter as Importer } from "@bitwarden/common/importers/mykiCsvImporter";
|
||||
import { MykiCsvImporter as Importer } from "@bitwarden/common/importers/myki-csv-importer";
|
||||
import { CipherView } from "@bitwarden/common/models/view/cipher.view";
|
||||
|
||||
import { userAccountData } from "./testData/mykiCsv/UserAccount.csv";
|
||||
import { userCreditCardData } from "./testData/mykiCsv/UserCreditCard.csv";
|
||||
import { userIdCardData } from "./testData/mykiCsv/UserIdCard.csv";
|
||||
import { userIdentityData } from "./testData/mykiCsv/UserIdentity.csv";
|
||||
import { userNoteData } from "./testData/mykiCsv/UserNote.csv";
|
||||
import { userTwoFaData } from "./testData/mykiCsv/UserTwofa.csv";
|
||||
import { userAccountData } from "./test-data/myki-csv/user-account.csv";
|
||||
import { userCreditCardData } from "./test-data/myki-csv/user-credit-card.csv";
|
||||
import { userIdCardData } from "./test-data/myki-csv/user-id-card.csv";
|
||||
import { userIdentityData } from "./test-data/myki-csv/user-identity.csv";
|
||||
import { userNoteData } from "./test-data/myki-csv/user-note.csv";
|
||||
import { userTwoFaData } from "./test-data/myki-csv/user-twofa.csv";
|
||||
|
||||
function expectDriversLicense(cipher: CipherView) {
|
||||
expect(cipher.type).toBe(CipherType.Identity);
|
||||
@@ -1,13 +1,13 @@
|
||||
import { CipherType } from "@bitwarden/common/enums/cipherType";
|
||||
import { SecureNoteType } from "@bitwarden/common/enums/secureNoteType";
|
||||
import { NordPassCsvImporter as Importer } from "@bitwarden/common/importers/nordpassCsvImporter";
|
||||
import { NordPassCsvImporter as Importer } from "@bitwarden/common/importers/nordpass-csv-importer";
|
||||
import { CipherView } from "@bitwarden/common/models/view/cipher.view";
|
||||
import { IdentityView } from "@bitwarden/common/models/view/identity.view";
|
||||
|
||||
import { data as creditCardData } from "./testData/nordpassCsv/nordpass.card.csv";
|
||||
import { data as identityData } from "./testData/nordpassCsv/nordpass.identity.csv";
|
||||
import { data as loginData } from "./testData/nordpassCsv/nordpass.login.csv";
|
||||
import { data as secureNoteData } from "./testData/nordpassCsv/nordpass.secureNote.csv";
|
||||
import { data as creditCardData } from "./test-data/nordpass-csv/nordpass.card.csv";
|
||||
import { data as identityData } from "./test-data/nordpass-csv/nordpass.identity.csv";
|
||||
import { data as loginData } from "./test-data/nordpass-csv/nordpass.login.csv";
|
||||
import { data as secureNoteData } from "./test-data/nordpass-csv/nordpass.secure-note.csv";
|
||||
|
||||
const namesTestData = [
|
||||
{
|
||||
@@ -1,5 +1,5 @@
|
||||
import { FieldType } from "@bitwarden/common/enums/fieldType";
|
||||
import { OnePassword1PifImporter as Importer } from "@bitwarden/common/importers/onepasswordImporters/onepassword1PifImporter";
|
||||
import { OnePassword1PifImporter as Importer } from "@bitwarden/common/importers/onepassword/onepassword-1pif-importer";
|
||||
|
||||
const TestData: string =
|
||||
"***aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee***\n" +
|
||||
@@ -1,34 +1,34 @@
|
||||
import { CipherType } from "@bitwarden/common/enums/cipherType";
|
||||
import { FieldType } from "@bitwarden/common/enums/fieldType";
|
||||
import { SecureNoteType } from "@bitwarden/common/enums/secureNoteType";
|
||||
import { OnePassword1PuxImporter as Importer } from "@bitwarden/common/importers/onepasswordImporters/onepassword1PuxImporter";
|
||||
import { OnePassword1PuxImporter as Importer } from "@bitwarden/common/importers/onepassword/onepassword-1pux-importer";
|
||||
import { Utils } from "@bitwarden/common/misc/utils";
|
||||
import { FieldView } from "@bitwarden/common/models/view/field.view";
|
||||
|
||||
import { APICredentialsData } from "./testData/onePassword1Pux/APICredentials";
|
||||
import { BankAccountData } from "./testData/onePassword1Pux/BankAccount";
|
||||
import { CreditCardData } from "./testData/onePassword1Pux/CreditCard";
|
||||
import { DatabaseData } from "./testData/onePassword1Pux/Database";
|
||||
import { DriversLicenseData } from "./testData/onePassword1Pux/DriversLicense";
|
||||
import { EmailAccountData } from "./testData/onePassword1Pux/EmailAccount";
|
||||
import { EmailFieldData } from "./testData/onePassword1Pux/Emailfield";
|
||||
import { EmailFieldOnIdentityData } from "./testData/onePassword1Pux/EmailfieldOnIdentity";
|
||||
import { EmailFieldOnIdentityPrefilledData } from "./testData/onePassword1Pux/EmailfieldOnIdentity_Prefilled";
|
||||
import { IdentityData } from "./testData/onePassword1Pux/IdentityData";
|
||||
import { LoginData } from "./testData/onePassword1Pux/LoginData";
|
||||
import { MedicalRecordData } from "./testData/onePassword1Pux/MedicalRecord";
|
||||
import { MembershipData } from "./testData/onePassword1Pux/Membership";
|
||||
import { OnePuxExampleFile } from "./testData/onePassword1Pux/Onepux_example";
|
||||
import { OutdoorLicenseData } from "./testData/onePassword1Pux/OutdoorLicense";
|
||||
import { PassportData } from "./testData/onePassword1Pux/Passport";
|
||||
import { PasswordData } from "./testData/onePassword1Pux/Password";
|
||||
import { RewardsProgramData } from "./testData/onePassword1Pux/RewardsProgram";
|
||||
import { SSNData } from "./testData/onePassword1Pux/SSN";
|
||||
import { SanitizedExport } from "./testData/onePassword1Pux/SanitizedExport";
|
||||
import { SecureNoteData } from "./testData/onePassword1Pux/SecureNote";
|
||||
import { ServerData } from "./testData/onePassword1Pux/Server";
|
||||
import { SoftwareLicenseData } from "./testData/onePassword1Pux/SoftwareLicense";
|
||||
import { WirelessRouterData } from "./testData/onePassword1Pux/WirelessRouter";
|
||||
import { APICredentialsData } from "./test-data/onepassword-1pux/api-credentials";
|
||||
import { BankAccountData } from "./test-data/onepassword-1pux/bank-account";
|
||||
import { CreditCardData } from "./test-data/onepassword-1pux/credit-card";
|
||||
import { DatabaseData } from "./test-data/onepassword-1pux/database";
|
||||
import { DriversLicenseData } from "./test-data/onepassword-1pux/drivers-license";
|
||||
import { EmailAccountData } from "./test-data/onepassword-1pux/email-account";
|
||||
import { EmailFieldData } from "./test-data/onepassword-1pux/email-field";
|
||||
import { EmailFieldOnIdentityData } from "./test-data/onepassword-1pux/email-field-on-identity";
|
||||
import { EmailFieldOnIdentityPrefilledData } from "./test-data/onepassword-1pux/email-field-on-identity_prefilled";
|
||||
import { IdentityData } from "./test-data/onepassword-1pux/identity-data";
|
||||
import { LoginData } from "./test-data/onepassword-1pux/login-data";
|
||||
import { MedicalRecordData } from "./test-data/onepassword-1pux/medical-record";
|
||||
import { MembershipData } from "./test-data/onepassword-1pux/membership";
|
||||
import { OnePuxExampleFile } from "./test-data/onepassword-1pux/onepux_example";
|
||||
import { OutdoorLicenseData } from "./test-data/onepassword-1pux/outdoor-license";
|
||||
import { PassportData } from "./test-data/onepassword-1pux/passport";
|
||||
import { PasswordData } from "./test-data/onepassword-1pux/password";
|
||||
import { RewardsProgramData } from "./test-data/onepassword-1pux/rewards-program";
|
||||
import { SanitizedExport } from "./test-data/onepassword-1pux/sanitized-export";
|
||||
import { SecureNoteData } from "./test-data/onepassword-1pux/secure-note";
|
||||
import { ServerData } from "./test-data/onepassword-1pux/server";
|
||||
import { SoftwareLicenseData } from "./test-data/onepassword-1pux/software-license";
|
||||
import { SSNData } from "./test-data/onepassword-1pux/ssn";
|
||||
import { WirelessRouterData } from "./test-data/onepassword-1pux/wireless-router";
|
||||
|
||||
function validateCustomField(fields: FieldView[], fieldName: string, expectedValue: any) {
|
||||
expect(fields).toBeDefined();
|
||||
@@ -1,10 +1,10 @@
|
||||
import { CipherType } from "@bitwarden/common/enums/cipherType";
|
||||
import { OnePasswordMacCsvImporter as Importer } from "@bitwarden/common/importers/onepasswordImporters/onepasswordMacCsvImporter";
|
||||
import { OnePasswordMacCsvImporter as Importer } from "@bitwarden/common/importers/onepassword/onepassword-mac-csv-importer";
|
||||
import { CipherView } from "@bitwarden/common/models/view/cipher.view";
|
||||
|
||||
import { data as creditCardData } from "./testData/onePasswordCsv/creditCard.mac.csv";
|
||||
import { data as identityData } from "./testData/onePasswordCsv/identity.mac.csv";
|
||||
import { data as multiTypeData } from "./testData/onePasswordCsv/multipleItems.mac.csv";
|
||||
import { data as creditCardData } from "./test-data/onepassword-csv/credit-card.mac.csv";
|
||||
import { data as identityData } from "./test-data/onepassword-csv/identity.mac.csv";
|
||||
import { data as multiTypeData } from "./test-data/onepassword-csv/multiple-items.mac.csv";
|
||||
|
||||
function expectIdentity(cipher: CipherView) {
|
||||
expect(cipher.type).toBe(CipherType.Identity);
|
||||
@@ -1,12 +1,12 @@
|
||||
import { CipherType } from "@bitwarden/common/enums/cipherType";
|
||||
import { FieldType } from "@bitwarden/common/enums/fieldType";
|
||||
import { OnePasswordWinCsvImporter as Importer } from "@bitwarden/common/importers/onepasswordImporters/onepasswordWinCsvImporter";
|
||||
import { OnePasswordWinCsvImporter as Importer } from "@bitwarden/common/importers/onepassword/onepassword-win-csv-importer";
|
||||
import { CipherView } from "@bitwarden/common/models/view/cipher.view";
|
||||
import { FieldView } from "@bitwarden/common/models/view/field.view";
|
||||
|
||||
import { data as creditCardData } from "./testData/onePasswordCsv/creditCard.windows.csv";
|
||||
import { data as identityData } from "./testData/onePasswordCsv/identity.windows.csv";
|
||||
import { data as multiTypeData } from "./testData/onePasswordCsv/multipleItems.windows.csv";
|
||||
import { data as creditCardData } from "./test-data/onepassword-csv/credit-card.windows.csv";
|
||||
import { data as identityData } from "./test-data/onepassword-csv/identity.windows.csv";
|
||||
import { data as multiTypeData } from "./test-data/onepassword-csv/multiple-items.windows.csv";
|
||||
|
||||
function expectIdentity(cipher: CipherView) {
|
||||
expect(cipher.type).toBe(CipherType.Identity);
|
||||
@@ -1,10 +1,10 @@
|
||||
import { SafariCsvImporter as Importer } from "@bitwarden/common/importers/safariCsvImporter";
|
||||
import { SafariCsvImporter as Importer } from "@bitwarden/common/importers/safari-csv-importer";
|
||||
import { CipherView } from "@bitwarden/common/models/view/cipher.view";
|
||||
import { LoginUriView } from "@bitwarden/common/models/view/login-uri.view";
|
||||
import { LoginView } from "@bitwarden/common/models/view/login.view";
|
||||
|
||||
import { data as oldSimplePasswordData } from "./testData/safariCsv/oldSimplePasswordData.csv";
|
||||
import { data as simplePasswordData } from "./testData/safariCsv/simplePasswordData.csv";
|
||||
import { data as oldSimplePasswordData } from "./test-data/safari-csv/old-simple-password-data.csv";
|
||||
import { data as simplePasswordData } from "./test-data/safari-csv/simple-password-data.csv";
|
||||
|
||||
const CipherData = [
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
import { KeeperJsonExport } from "@bitwarden/common/importers/keeperImporters/types/keeperJsonTypes";
|
||||
import { KeeperJsonExport } from "@bitwarden/common/importers/keeper/types/keeper-json-types";
|
||||
|
||||
export const testData: KeeperJsonExport = {
|
||||
shared_folders: [
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ExportData } from "@bitwarden/common/importers/onepasswordImporters/types/onepassword1PuxImporterTypes";
|
||||
import { ExportData } from "@bitwarden/common/importers/onepassword/types/onepassword-1pux-importer-types";
|
||||
|
||||
export const APICredentialsData: ExportData = {
|
||||
accounts: [
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ExportData } from "@bitwarden/common/importers/onepasswordImporters/types/onepassword1PuxImporterTypes";
|
||||
import { ExportData } from "@bitwarden/common/importers/onepassword/types/onepassword-1pux-importer-types";
|
||||
|
||||
export const BankAccountData: ExportData = {
|
||||
accounts: [
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ExportData } from "@bitwarden/common/importers/onepasswordImporters/types/onepassword1PuxImporterTypes";
|
||||
import { ExportData } from "@bitwarden/common/importers/onepassword/types/onepassword-1pux-importer-types";
|
||||
|
||||
export const CreditCardData: ExportData = {
|
||||
accounts: [
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ExportData } from "@bitwarden/common/importers/onepasswordImporters/types/onepassword1PuxImporterTypes";
|
||||
import { ExportData } from "@bitwarden/common/importers/onepassword/types/onepassword-1pux-importer-types";
|
||||
|
||||
export const DatabaseData: ExportData = {
|
||||
accounts: [
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ExportData } from "@bitwarden/common/importers/onepasswordImporters/types/onepassword1PuxImporterTypes";
|
||||
import { ExportData } from "@bitwarden/common/importers/onepassword/types/onepassword-1pux-importer-types";
|
||||
|
||||
export const DriversLicenseData: ExportData = {
|
||||
accounts: [
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ExportData } from "@bitwarden/common/importers/onepasswordImporters/types/onepassword1PuxImporterTypes";
|
||||
import { ExportData } from "@bitwarden/common/importers/onepassword/types/onepassword-1pux-importer-types";
|
||||
|
||||
export const EmailAccountData: ExportData = {
|
||||
accounts: [
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ExportData } from "@bitwarden/common/importers/onepasswordImporters/types/onepassword1PuxImporterTypes";
|
||||
import { ExportData } from "@bitwarden/common/importers/onepassword/types/onepassword-1pux-importer-types";
|
||||
|
||||
export const EmailFieldOnIdentityData: ExportData = {
|
||||
accounts: [
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ExportData } from "@bitwarden/common/importers/onepasswordImporters/types/onepassword1PuxImporterTypes";
|
||||
import { ExportData } from "@bitwarden/common/importers/onepassword/types/onepassword-1pux-importer-types";
|
||||
|
||||
export const EmailFieldOnIdentityPrefilledData: ExportData = {
|
||||
accounts: [
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ExportData } from "@bitwarden/common/importers/onepasswordImporters/types/onepassword1PuxImporterTypes";
|
||||
import { ExportData } from "@bitwarden/common/importers/onepassword/types/onepassword-1pux-importer-types";
|
||||
|
||||
export const EmailFieldData: ExportData = {
|
||||
accounts: [
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ExportData } from "@bitwarden/common/importers/onepasswordImporters/types/onepassword1PuxImporterTypes";
|
||||
import { ExportData } from "@bitwarden/common/importers/onepassword/types/onepassword-1pux-importer-types";
|
||||
|
||||
export const IdentityData: ExportData = {
|
||||
accounts: [
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ExportData } from "@bitwarden/common/importers/onepasswordImporters/types/onepassword1PuxImporterTypes";
|
||||
import { ExportData } from "@bitwarden/common/importers/onepassword/types/onepassword-1pux-importer-types";
|
||||
|
||||
export const LoginData: ExportData = {
|
||||
accounts: [
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ExportData } from "@bitwarden/common/importers/onepasswordImporters/types/onepassword1PuxImporterTypes";
|
||||
import { ExportData } from "@bitwarden/common/importers/onepassword/types/onepassword-1pux-importer-types";
|
||||
|
||||
export const MedicalRecordData: ExportData = {
|
||||
accounts: [
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ExportData } from "@bitwarden/common/importers/onepasswordImporters/types/onepassword1PuxImporterTypes";
|
||||
import { ExportData } from "@bitwarden/common/importers/onepassword/types/onepassword-1pux-importer-types";
|
||||
|
||||
export const MembershipData: ExportData = {
|
||||
accounts: [
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ExportData } from "@bitwarden/common/importers/onepasswordImporters/types/onepassword1PuxImporterTypes";
|
||||
import { ExportData } from "@bitwarden/common/importers/onepassword/types/onepassword-1pux-importer-types";
|
||||
|
||||
export const OnePuxExampleFile: ExportData = {
|
||||
accounts: [
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ExportData } from "@bitwarden/common/importers/onepasswordImporters/types/onepassword1PuxImporterTypes";
|
||||
import { ExportData } from "@bitwarden/common/importers/onepassword/types/onepassword-1pux-importer-types";
|
||||
|
||||
export const OutdoorLicenseData: ExportData = {
|
||||
accounts: [
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ExportData } from "@bitwarden/common/importers/onepasswordImporters/types/onepassword1PuxImporterTypes";
|
||||
import { ExportData } from "@bitwarden/common/importers/onepassword/types/onepassword-1pux-importer-types";
|
||||
|
||||
export const PassportData: ExportData = {
|
||||
accounts: [
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ExportData } from "@bitwarden/common/importers/onepasswordImporters/types/onepassword1PuxImporterTypes";
|
||||
import { ExportData } from "@bitwarden/common/importers/onepassword/types/onepassword-1pux-importer-types";
|
||||
|
||||
export const PasswordData: ExportData = {
|
||||
accounts: [
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ExportData } from "@bitwarden/common/importers/onepasswordImporters/types/onepassword1PuxImporterTypes";
|
||||
import { ExportData } from "@bitwarden/common/importers/onepassword/types/onepassword-1pux-importer-types";
|
||||
|
||||
export const RewardsProgramData: ExportData = {
|
||||
accounts: [
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ExportData } from "@bitwarden/common/importers/onepasswordImporters/types/onepassword1PuxImporterTypes";
|
||||
import { ExportData } from "@bitwarden/common/importers/onepassword/types/onepassword-1pux-importer-types";
|
||||
|
||||
export const SanitizedExport: ExportData = {
|
||||
accounts: [
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ExportData } from "@bitwarden/common/importers/onepasswordImporters/types/onepassword1PuxImporterTypes";
|
||||
import { ExportData } from "@bitwarden/common/importers/onepassword/types/onepassword-1pux-importer-types";
|
||||
|
||||
export const SecureNoteData: ExportData = {
|
||||
accounts: [
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ExportData } from "@bitwarden/common/importers/onepasswordImporters/types/onepassword1PuxImporterTypes";
|
||||
import { ExportData } from "@bitwarden/common/importers/onepassword/types/onepassword-1pux-importer-types";
|
||||
|
||||
export const ServerData: ExportData = {
|
||||
accounts: [
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ExportData } from "@bitwarden/common/importers/onepasswordImporters/types/onepassword1PuxImporterTypes";
|
||||
import { ExportData } from "@bitwarden/common/importers/onepassword/types/onepassword-1pux-importer-types";
|
||||
|
||||
export const SoftwareLicenseData: ExportData = {
|
||||
accounts: [
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ExportData } from "@bitwarden/common/importers/onepasswordImporters/types/onepassword1PuxImporterTypes";
|
||||
import { ExportData } from "@bitwarden/common/importers/onepassword/types/onepassword-1pux-importer-types";
|
||||
|
||||
export const SSNData: ExportData = {
|
||||
accounts: [
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ExportData } from "@bitwarden/common/importers/onepasswordImporters/types/onepassword1PuxImporterTypes";
|
||||
import { ExportData } from "@bitwarden/common/importers/onepassword/types/onepassword-1pux-importer-types";
|
||||
|
||||
export const WirelessRouterData: ExportData = {
|
||||
accounts: [
|
||||
@@ -1,7 +1,7 @@
|
||||
import { mock, MockProxy } from "jest-mock-extended";
|
||||
|
||||
import { AbstractEncryptService } from "@bitwarden/common/abstractions/abstractEncrypt.service";
|
||||
import { CryptoService } from "@bitwarden/common/abstractions/crypto.service";
|
||||
import { EncryptService } from "@bitwarden/common/abstractions/encrypt.service";
|
||||
import { AttachmentData } from "@bitwarden/common/models/data/attachment.data";
|
||||
import { Attachment } from "@bitwarden/common/models/domain/attachment";
|
||||
import { EncString } from "@bitwarden/common/models/domain/enc-string";
|
||||
@@ -58,11 +58,11 @@ describe("Attachment", () => {
|
||||
|
||||
describe("decrypt", () => {
|
||||
let cryptoService: MockProxy<CryptoService>;
|
||||
let encryptService: MockProxy<AbstractEncryptService>;
|
||||
let encryptService: MockProxy<EncryptService>;
|
||||
|
||||
beforeEach(() => {
|
||||
cryptoService = mock<CryptoService>();
|
||||
encryptService = mock<AbstractEncryptService>();
|
||||
encryptService = mock<EncryptService>();
|
||||
|
||||
(window as any).bitwardenContainerService = new ContainerService(
|
||||
cryptoService,
|
||||
|
||||
@@ -20,6 +20,7 @@ import { SecureNote } from "@bitwarden/common/models/domain/secure-note";
|
||||
import { CardView } from "@bitwarden/common/models/view/card.view";
|
||||
import { IdentityView } from "@bitwarden/common/models/view/identity.view";
|
||||
import { LoginView } from "@bitwarden/common/models/view/login.view";
|
||||
import { InitializerKey } from "@bitwarden/common/services/cryptography/initializer-key";
|
||||
|
||||
import { mockEnc, mockFromJson } from "../../utils";
|
||||
|
||||
@@ -29,6 +30,7 @@ describe("Cipher DTO", () => {
|
||||
const cipher = new Cipher(data);
|
||||
|
||||
expect(cipher).toEqual({
|
||||
initializerKey: InitializerKey.Cipher,
|
||||
id: null,
|
||||
organizationId: null,
|
||||
folderId: null,
|
||||
@@ -120,6 +122,7 @@ describe("Cipher DTO", () => {
|
||||
const cipher = new Cipher(cipherData);
|
||||
|
||||
expect(cipher).toEqual({
|
||||
initializerKey: InitializerKey.Cipher,
|
||||
id: "id",
|
||||
organizationId: "orgId",
|
||||
folderId: "folderId",
|
||||
@@ -271,6 +274,7 @@ describe("Cipher DTO", () => {
|
||||
const cipher = new Cipher(cipherData);
|
||||
|
||||
expect(cipher).toEqual({
|
||||
initializerKey: InitializerKey.Cipher,
|
||||
id: "id",
|
||||
organizationId: "orgId",
|
||||
folderId: "folderId",
|
||||
@@ -379,6 +383,7 @@ describe("Cipher DTO", () => {
|
||||
const cipher = new Cipher(cipherData);
|
||||
|
||||
expect(cipher).toEqual({
|
||||
initializerKey: InitializerKey.Cipher,
|
||||
id: "id",
|
||||
organizationId: "orgId",
|
||||
folderId: "folderId",
|
||||
@@ -512,6 +517,7 @@ describe("Cipher DTO", () => {
|
||||
const cipher = new Cipher(cipherData);
|
||||
|
||||
expect(cipher).toEqual({
|
||||
initializerKey: InitializerKey.Cipher,
|
||||
id: "id",
|
||||
organizationId: "orgId",
|
||||
folderId: "folderId",
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
import { Substitute, Arg } from "@fluffy-spoon/substitute";
|
||||
import { mock, MockProxy } from "jest-mock-extended";
|
||||
|
||||
import { AbstractEncryptService } from "@bitwarden/common/abstractions/abstractEncrypt.service";
|
||||
import { CryptoService } from "@bitwarden/common/abstractions/crypto.service";
|
||||
import { EncryptService } from "@bitwarden/common/abstractions/encrypt.service";
|
||||
import { EncryptionType } from "@bitwarden/common/enums/encryptionType";
|
||||
import { EncString } from "@bitwarden/common/models/domain/enc-string";
|
||||
import { SymmetricCryptoKey } from "@bitwarden/common/models/domain/symmetric-crypto-key";
|
||||
@@ -52,7 +52,7 @@ describe("EncString", () => {
|
||||
const cryptoService = Substitute.for<CryptoService>();
|
||||
cryptoService.getOrgKey(null).resolves(null);
|
||||
|
||||
const encryptService = Substitute.for<AbstractEncryptService>();
|
||||
const encryptService = Substitute.for<EncryptService>();
|
||||
encryptService.decryptToUtf8(encString, Arg.any()).resolves("decrypted");
|
||||
|
||||
beforeEach(() => {
|
||||
@@ -157,12 +157,12 @@ describe("EncString", () => {
|
||||
|
||||
describe("decrypt", () => {
|
||||
let cryptoService: MockProxy<CryptoService>;
|
||||
let encryptService: MockProxy<AbstractEncryptService>;
|
||||
let encryptService: MockProxy<EncryptService>;
|
||||
let encString: EncString;
|
||||
|
||||
beforeEach(() => {
|
||||
cryptoService = mock<CryptoService>();
|
||||
encryptService = mock<AbstractEncryptService>();
|
||||
encryptService = mock<EncryptService>();
|
||||
encString = new EncString(null);
|
||||
|
||||
(window as any).bitwardenContainerService = new ContainerService(
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// eslint-disable-next-line no-restricted-imports
|
||||
import { Substitute, Arg, SubstituteOf } from "@fluffy-spoon/substitute";
|
||||
|
||||
import { AbstractEncryptService } from "@bitwarden/common/abstractions/abstractEncrypt.service";
|
||||
import { CryptoService } from "@bitwarden/common/abstractions/crypto.service";
|
||||
import { EncryptService } from "@bitwarden/common/abstractions/encrypt.service";
|
||||
import { SendType } from "@bitwarden/common/enums/sendType";
|
||||
import { SendData } from "@bitwarden/common/models/data/send.data";
|
||||
import { EncString } from "@bitwarden/common/models/domain/enc-string";
|
||||
@@ -112,7 +112,7 @@ describe("Send", () => {
|
||||
cryptoService.decryptToBytes(send.key, null).resolves(makeStaticByteArray(32));
|
||||
cryptoService.makeSendKey(Arg.any()).resolves("cryptoKey" as any);
|
||||
|
||||
const encryptService = Substitute.for<AbstractEncryptService>();
|
||||
const encryptService = Substitute.for<EncryptService>();
|
||||
|
||||
(window as any).bitwardenContainerService = new ContainerService(cryptoService, encryptService);
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ import { Arg, Substitute, SubstituteOf } from "@fluffy-spoon/substitute";
|
||||
|
||||
import { ApiService } from "@bitwarden/common/abstractions/api.service";
|
||||
import { CryptoService } from "@bitwarden/common/abstractions/crypto.service";
|
||||
import { EncryptService } from "@bitwarden/common/abstractions/encrypt.service";
|
||||
import { FileUploadService } from "@bitwarden/common/abstractions/fileUpload.service";
|
||||
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
||||
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
||||
@@ -27,6 +28,7 @@ describe("Cipher Service", () => {
|
||||
let i18nService: SubstituteOf<I18nService>;
|
||||
let searchService: SubstituteOf<SearchService>;
|
||||
let logService: SubstituteOf<LogService>;
|
||||
let encryptService: SubstituteOf<EncryptService>;
|
||||
|
||||
let cipherService: CipherService;
|
||||
|
||||
@@ -39,6 +41,7 @@ describe("Cipher Service", () => {
|
||||
i18nService = Substitute.for<I18nService>();
|
||||
searchService = Substitute.for<SearchService>();
|
||||
logService = Substitute.for<LogService>();
|
||||
encryptService = Substitute.for<EncryptService>();
|
||||
|
||||
cryptoService.encryptToBytes(Arg.any(), Arg.any()).resolves(ENCRYPTED_BYTES);
|
||||
cryptoService.encrypt(Arg.any(), Arg.any()).resolves(new EncString(ENCRYPTED_TEXT));
|
||||
@@ -51,7 +54,8 @@ describe("Cipher Service", () => {
|
||||
i18nService,
|
||||
() => searchService,
|
||||
logService,
|
||||
stateService
|
||||
stateService,
|
||||
encryptService
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { mock, mockReset } from "jest-mock-extended";
|
||||
|
||||
import { AbstractEncryptService } from "@bitwarden/common/abstractions/abstractEncrypt.service";
|
||||
import { CryptoFunctionService } from "@bitwarden/common/abstractions/cryptoFunction.service";
|
||||
import { EncryptService } from "@bitwarden/common/abstractions/encrypt.service";
|
||||
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
||||
@@ -11,7 +11,7 @@ describe("cryptoService", () => {
|
||||
let cryptoService: CryptoService;
|
||||
|
||||
const cryptoFunctionService = mock<CryptoFunctionService>();
|
||||
const encryptService = mock<AbstractEncryptService>();
|
||||
const encryptService = mock<EncryptService>();
|
||||
const platformUtilService = mock<PlatformUtilsService>();
|
||||
const logService = mock<LogService>();
|
||||
const stateService = mock<StateService>();
|
||||
|
||||
@@ -6,7 +6,7 @@ import { EncryptionType } from "@bitwarden/common/enums/encryptionType";
|
||||
import { EncArrayBuffer } from "@bitwarden/common/models/domain/enc-array-buffer";
|
||||
import { EncString } from "@bitwarden/common/models/domain/enc-string";
|
||||
import { SymmetricCryptoKey } from "@bitwarden/common/models/domain/symmetric-crypto-key";
|
||||
import { EncryptService } from "@bitwarden/common/services/encrypt.service";
|
||||
import { EncryptServiceImplementation } from "@bitwarden/common/services/cryptography/encrypt.service.implementation";
|
||||
|
||||
import { makeStaticByteArray } from "../utils";
|
||||
|
||||
@@ -14,13 +14,13 @@ describe("EncryptService", () => {
|
||||
const cryptoFunctionService = mock<CryptoFunctionService>();
|
||||
const logService = mock<LogService>();
|
||||
|
||||
let encryptService: EncryptService;
|
||||
let encryptService: EncryptServiceImplementation;
|
||||
|
||||
beforeEach(() => {
|
||||
mockReset(cryptoFunctionService);
|
||||
mockReset(logService);
|
||||
|
||||
encryptService = new EncryptService(cryptoFunctionService, logService, true);
|
||||
encryptService = new EncryptServiceImplementation(cryptoFunctionService, logService, true);
|
||||
});
|
||||
|
||||
describe("encryptToBytes", () => {
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
import { Arg, Substitute, SubstituteOf } from "@fluffy-spoon/substitute";
|
||||
import { BehaviorSubject, firstValueFrom } from "rxjs";
|
||||
|
||||
import { AbstractEncryptService } from "@bitwarden/common/abstractions/abstractEncrypt.service";
|
||||
import { CipherService } from "@bitwarden/common/abstractions/cipher.service";
|
||||
import { CryptoService } from "@bitwarden/common/abstractions/crypto.service";
|
||||
import { EncryptService } from "@bitwarden/common/abstractions/encrypt.service";
|
||||
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
||||
import { FolderData } from "@bitwarden/common/models/data/folder.data";
|
||||
import { EncString } from "@bitwarden/common/models/domain/enc-string";
|
||||
@@ -17,7 +17,7 @@ describe("Folder Service", () => {
|
||||
let folderService: FolderService;
|
||||
|
||||
let cryptoService: SubstituteOf<CryptoService>;
|
||||
let encryptService: SubstituteOf<AbstractEncryptService>;
|
||||
let encryptService: SubstituteOf<EncryptService>;
|
||||
let i18nService: SubstituteOf<I18nService>;
|
||||
let cipherService: SubstituteOf<CipherService>;
|
||||
let stateService: SubstituteOf<StateService>;
|
||||
|
||||
@@ -7,7 +7,7 @@ import { CollectionService } from "@bitwarden/common/abstractions/collection.ser
|
||||
import { CryptoService } from "@bitwarden/common/abstractions/crypto.service";
|
||||
import { FolderService } from "@bitwarden/common/abstractions/folder/folder.service.abstraction";
|
||||
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
||||
import { BitwardenPasswordProtectedImporter } from "@bitwarden/common/importers/bitwardenPasswordProtectedImporter";
|
||||
import { BitwardenPasswordProtectedImporter } from "@bitwarden/common/importers/bitwarden-password-protected-importer";
|
||||
import { Importer } from "@bitwarden/common/importers/importer";
|
||||
import { Utils } from "@bitwarden/common/misc/utils";
|
||||
import { ImportService } from "@bitwarden/common/services/import.service";
|
||||
|
||||
@@ -3,6 +3,7 @@ import { Arg, Substitute, SubstituteOf } from "@fluffy-spoon/substitute";
|
||||
import { BehaviorSubject, firstValueFrom } from "rxjs";
|
||||
|
||||
import { CryptoService } from "@bitwarden/common/abstractions/crypto.service";
|
||||
import { EncryptService } from "@bitwarden/common/abstractions/encrypt.service";
|
||||
import { OrganizationService } from "@bitwarden/common/abstractions/organization/organization.service.abstraction";
|
||||
import { OrganizationUserStatusType } from "@bitwarden/common/enums/organizationUserStatusType";
|
||||
import { PolicyType } from "@bitwarden/common/enums/policyType";
|
||||
@@ -16,7 +17,6 @@ import { ResetPasswordPolicyOptions } from "@bitwarden/common/models/domain/rese
|
||||
import { ListResponse } from "@bitwarden/common/models/response/list.response";
|
||||
import { PolicyResponse } from "@bitwarden/common/models/response/policy.response";
|
||||
import { ContainerService } from "@bitwarden/common/services/container.service";
|
||||
import { EncryptService } from "@bitwarden/common/services/encrypt.service";
|
||||
import { PolicyService } from "@bitwarden/common/services/policy/policy.service";
|
||||
import { StateService } from "@bitwarden/common/services/state.service";
|
||||
|
||||
@@ -50,6 +50,12 @@ describe("PolicyService", () => {
|
||||
organizationService.getAll(null).resolves([]);
|
||||
activeAccount = new BehaviorSubject("123");
|
||||
activeAccountUnlocked = new BehaviorSubject(true);
|
||||
stateService.getDecryptedPolicies({ userId: "user" }).resolves(null);
|
||||
stateService.getEncryptedPolicies({ userId: "user" }).resolves({
|
||||
"1": policyData("1", "test-organization", PolicyType.MaximumVaultTimeout, true, {
|
||||
minutes: 14,
|
||||
}),
|
||||
});
|
||||
stateService.getEncryptedPolicies().resolves({
|
||||
"1": policyData("1", "test-organization", PolicyType.MaximumVaultTimeout, true, {
|
||||
minutes: 14,
|
||||
@@ -296,7 +302,7 @@ describe("PolicyService", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("policyAppliesToActiveUser", () => {
|
||||
describe("policyAppliesToActiveUser$", () => {
|
||||
it("MasterPassword does not apply", async () => {
|
||||
const result = await firstValueFrom(
|
||||
policyService.policyAppliesToActiveUser$(PolicyType.MasterPassword)
|
||||
@@ -313,6 +319,14 @@ describe("PolicyService", () => {
|
||||
expect(result).toEqual(true);
|
||||
});
|
||||
|
||||
it("PolicyFilter filters result", async () => {
|
||||
const result = await firstValueFrom(
|
||||
policyService.policyAppliesToActiveUser$(PolicyType.MaximumVaultTimeout, (p) => false)
|
||||
);
|
||||
|
||||
expect(result).toEqual(false);
|
||||
});
|
||||
|
||||
it("DisablePersonalVaultExport does not apply", async () => {
|
||||
const result = await firstValueFrom(
|
||||
policyService.policyAppliesToActiveUser$(PolicyType.DisablePersonalVaultExport)
|
||||
@@ -322,6 +336,48 @@ describe("PolicyService", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("policyAppliesToUser", () => {
|
||||
it("MasterPassword does not apply", async () => {
|
||||
const result = await policyService.policyAppliesToUser(
|
||||
PolicyType.MasterPassword,
|
||||
null,
|
||||
"user"
|
||||
);
|
||||
|
||||
expect(result).toEqual(false);
|
||||
});
|
||||
|
||||
it("MaximumVaultTimeout applies", async () => {
|
||||
const result = await policyService.policyAppliesToUser(
|
||||
PolicyType.MaximumVaultTimeout,
|
||||
null,
|
||||
"user"
|
||||
);
|
||||
|
||||
expect(result).toEqual(true);
|
||||
});
|
||||
|
||||
it("PolicyFilter filters result", async () => {
|
||||
const result = await policyService.policyAppliesToUser(
|
||||
PolicyType.MaximumVaultTimeout,
|
||||
(p) => false,
|
||||
"user"
|
||||
);
|
||||
|
||||
expect(result).toEqual(false);
|
||||
});
|
||||
|
||||
it("DisablePersonalVaultExport does not apply", async () => {
|
||||
const result = await policyService.policyAppliesToUser(
|
||||
PolicyType.DisablePersonalVaultExport,
|
||||
null,
|
||||
"user"
|
||||
);
|
||||
|
||||
expect(result).toEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
function policyData(
|
||||
id: string,
|
||||
organizationId: string,
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
import { Arg, Substitute, SubstituteOf } from "@fluffy-spoon/substitute";
|
||||
import { BehaviorSubject, firstValueFrom } from "rxjs";
|
||||
|
||||
import { AbstractEncryptService } from "@bitwarden/common/abstractions/abstractEncrypt.service";
|
||||
import { CryptoService } from "@bitwarden/common/abstractions/crypto.service";
|
||||
import { EncryptService } from "@bitwarden/common/abstractions/encrypt.service";
|
||||
import { ContainerService } from "@bitwarden/common/services/container.service";
|
||||
import { SettingsService } from "@bitwarden/common/services/settings.service";
|
||||
import { StateService } from "@bitwarden/common/services/state.service";
|
||||
@@ -12,7 +12,7 @@ describe("SettingsService", () => {
|
||||
let settingsService: SettingsService;
|
||||
|
||||
let cryptoService: SubstituteOf<CryptoService>;
|
||||
let encryptService: SubstituteOf<AbstractEncryptService>;
|
||||
let encryptService: SubstituteOf<EncryptService>;
|
||||
let stateService: SubstituteOf<StateService>;
|
||||
let activeAccount: BehaviorSubject<string>;
|
||||
let activeAccountUnlocked: BehaviorSubject<boolean>;
|
||||
|
||||
@@ -479,6 +479,7 @@ export abstract class ApiService {
|
||||
putDeviceVerificationSettings: (
|
||||
request: DeviceVerificationRequest
|
||||
) => Promise<DeviceVerificationResponse>;
|
||||
getKnownDevice: (email: string, deviceIdentifier: string) => Promise<boolean>;
|
||||
|
||||
getEmergencyAccessTrusted: () => Promise<ListResponse<EmergencyAccessGranteeDetailsResponse>>;
|
||||
getEmergencyAccessGranted: () => Promise<ListResponse<EmergencyAccessGrantorDetailsResponse>>;
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import { IEncrypted } from "../interfaces/IEncrypted";
|
||||
import { Decryptable } from "../interfaces/decryptable.interface";
|
||||
import { InitializerMetadata } from "../interfaces/initializer-metadata.interface";
|
||||
import { EncArrayBuffer } from "../models/domain/enc-array-buffer";
|
||||
import { EncString } from "../models/domain/enc-string";
|
||||
import { SymmetricCryptoKey } from "../models/domain/symmetric-crypto-key";
|
||||
|
||||
export abstract class AbstractEncryptService {
|
||||
export abstract class EncryptService {
|
||||
abstract encrypt(plainValue: string | ArrayBuffer, key: SymmetricCryptoKey): Promise<EncString>;
|
||||
abstract encryptToBytes: (
|
||||
plainValue: ArrayBuffer,
|
||||
@@ -12,4 +14,8 @@ export abstract class AbstractEncryptService {
|
||||
abstract decryptToUtf8: (encString: EncString, key: SymmetricCryptoKey) => Promise<string>;
|
||||
abstract decryptToBytes: (encThing: IEncrypted, key: SymmetricCryptoKey) => Promise<ArrayBuffer>;
|
||||
abstract resolveLegacyKey: (key: SymmetricCryptoKey, encThing: IEncrypted) => SymmetricCryptoKey;
|
||||
abstract decryptItems: <T extends InitializerMetadata>(
|
||||
items: Decryptable<T>[],
|
||||
key: SymmetricCryptoKey
|
||||
) => Promise<T[]>;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ImportOption, ImportType } from "../enums/importOptions";
|
||||
import { ImportError } from "../importers/importError";
|
||||
import { ImportError } from "../importers/import-error";
|
||||
import { Importer } from "../importers/importer";
|
||||
|
||||
export abstract class ImportService {
|
||||
|
||||
7
libs/common/src/abstractions/login.service.ts
Normal file
7
libs/common/src/abstractions/login.service.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
export abstract class LoginService {
|
||||
getEmail: () => string;
|
||||
getRememberEmail: () => boolean;
|
||||
setEmail: (value: string) => void;
|
||||
setRememberEmail: (value: boolean) => void;
|
||||
clearValues: () => void;
|
||||
}
|
||||
@@ -4,8 +4,18 @@ import { Utils } from "../../misc/utils";
|
||||
import { Organization } from "../../models/domain/organization";
|
||||
import { I18nService } from "../i18n.service";
|
||||
|
||||
export function canAccessVaultTab(org: Organization): boolean {
|
||||
return org.isManager;
|
||||
}
|
||||
|
||||
export function canAccessSettingsTab(org: Organization): boolean {
|
||||
return org.isOwner;
|
||||
return (
|
||||
org.isOwner ||
|
||||
org.canManagePolicies ||
|
||||
org.canManageSso ||
|
||||
org.canManageScim ||
|
||||
org.canAccessImportExport
|
||||
);
|
||||
}
|
||||
|
||||
export function canAccessMembersTab(org: Organization): boolean {
|
||||
@@ -30,7 +40,8 @@ export function canAccessOrgAdmin(org: Organization): boolean {
|
||||
canAccessGroupsTab(org) ||
|
||||
canAccessReportingTab(org) ||
|
||||
canAccessBillingTab(org) ||
|
||||
canAccessSettingsTab(org)
|
||||
canAccessSettingsTab(org) ||
|
||||
canAccessVaultTab(org)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -50,6 +61,11 @@ export abstract class OrganizationService {
|
||||
get: (id: string) => Organization;
|
||||
getByIdentifier: (identifier: string) => Organization;
|
||||
getAll: (userId?: string) => Promise<Organization[]>;
|
||||
/**
|
||||
* @deprecated For the CLI only
|
||||
* @param id id of the organization
|
||||
*/
|
||||
getFromState: (id: string) => Promise<Organization>;
|
||||
canManageSponsorships: () => Promise<boolean>;
|
||||
hasOrganizations: () => boolean;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BehaviorSubject, Observable } from "rxjs";
|
||||
import { Observable } from "rxjs";
|
||||
|
||||
import { KdfType } from "../enums/kdfType";
|
||||
import { ThemeType } from "../enums/themeType";
|
||||
@@ -27,7 +27,7 @@ import { CollectionView } from "../models/view/collection.view";
|
||||
import { SendView } from "../models/view/send.view";
|
||||
|
||||
export abstract class StateService<T extends Account = Account> {
|
||||
accounts: BehaviorSubject<{ [userId: string]: T }>;
|
||||
accounts$: Observable<{ [userId: string]: T }>;
|
||||
activeAccount$: Observable<string>;
|
||||
activeAccountUnlocked$: Observable<boolean>;
|
||||
|
||||
|
||||
4
libs/common/src/enums/event-system-user.ts
Normal file
4
libs/common/src/enums/event-system-user.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
// Note: the enum key is used to describe the EventSystemUser in the UI. Be careful about changing it.
|
||||
export enum EventSystemUser {
|
||||
SCIM = 1,
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ImportResult } from "../models/domain/import-result";
|
||||
|
||||
import { BaseImporter } from "./baseImporter";
|
||||
import { BaseImporter } from "./base-importer";
|
||||
import { Importer } from "./importer";
|
||||
|
||||
export class AscendoCsvImporter extends BaseImporter implements Importer {
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ImportResult } from "../models/domain/import-result";
|
||||
|
||||
import { BaseImporter } from "./baseImporter";
|
||||
import { BaseImporter } from "./base-importer";
|
||||
import { Importer } from "./importer";
|
||||
|
||||
export class AvastCsvImporter extends BaseImporter implements Importer {
|
||||
@@ -2,7 +2,7 @@ import { CipherType } from "../enums/cipherType";
|
||||
import { SecureNoteType } from "../enums/secureNoteType";
|
||||
import { ImportResult } from "../models/domain/import-result";
|
||||
|
||||
import { BaseImporter } from "./baseImporter";
|
||||
import { BaseImporter } from "./base-importer";
|
||||
import { Importer } from "./importer";
|
||||
|
||||
export class AvastJsonImporter extends BaseImporter implements Importer {
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ImportResult } from "../models/domain/import-result";
|
||||
|
||||
import { BaseImporter } from "./baseImporter";
|
||||
import { BaseImporter } from "./base-importer";
|
||||
import { Importer } from "./importer";
|
||||
|
||||
export class AviraCsvImporter extends BaseImporter implements Importer {
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user