mirror of
https://github.com/bitwarden/jslib
synced 2025-12-22 19:23:24 +00:00
Changes after npm run prettier
This commit is contained in:
11
.github/PULL_REQUEST_TEMPLATE.md
vendored
11
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -1,4 +1,5 @@
|
|||||||
## Type of change
|
## Type of change
|
||||||
|
|
||||||
- [ ] Bug fix
|
- [ ] Bug fix
|
||||||
- [ ] New feature development
|
- [ ] New feature development
|
||||||
- [ ] Tech debt (refactoring, code cleanup, dependency upgrades, etc)
|
- [ ] Tech debt (refactoring, code cleanup, dependency upgrades, etc)
|
||||||
@@ -6,22 +7,22 @@
|
|||||||
- [ ] Other
|
- [ ] Other
|
||||||
|
|
||||||
## Objective
|
## Objective
|
||||||
|
|
||||||
<!--Describe what the purpose of this PR is. For example: what bug you're fixing or what new feature you're adding-->
|
<!--Describe what the purpose of this PR is. For example: what bug you're fixing or what new feature you're adding-->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Code changes
|
## Code changes
|
||||||
|
|
||||||
<!--Explain the changes you've made to each file or major component. This should help the reviewer understand your changes-->
|
<!--Explain the changes you've made to each file or major component. This should help the reviewer understand your changes-->
|
||||||
<!--Also refer to any related changes or PRs in other repositories-->
|
<!--Also refer to any related changes or PRs in other repositories-->
|
||||||
|
|
||||||
* **file.ext:** Description of what was changed and why
|
- **file.ext:** Description of what was changed and why
|
||||||
|
|
||||||
## Testing requirements
|
## Testing requirements
|
||||||
|
|
||||||
<!--What functionality requires testing by QA? This includes testing new behavior and regression testing-->
|
<!--What functionality requires testing by QA? This includes testing new behavior and regression testing-->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Before you submit
|
## Before you submit
|
||||||
|
|
||||||
- [ ] I have checked for **linting** errors (`npm run lint`) (required)
|
- [ ] I have checked for **linting** errors (`npm run lint`) (required)
|
||||||
- [ ] I have added **unit tests** where it makes sense to do so (encouraged but not required)
|
- [ ] I have added **unit tests** where it makes sense to do so (encouraged but not required)
|
||||||
- [ ] This change requires a **documentation update** (notify the documentation team)
|
- [ ] This change requires a **documentation update** (notify the documentation team)
|
||||||
|
|||||||
3
.github/workflows/build.yml
vendored
3
.github/workflows/build.yml
vendored
@@ -20,7 +20,6 @@ jobs:
|
|||||||
- name: Print lines of code
|
- name: Print lines of code
|
||||||
run: cloc --include-lang TypeScript,JavaScript,HTML,Sass,CSS --vcs git
|
run: cloc --include-lang TypeScript,JavaScript,HTML,Sass,CSS --vcs git
|
||||||
|
|
||||||
|
|
||||||
build:
|
build:
|
||||||
name: Build jslib
|
name: Build jslib
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
@@ -33,7 +32,7 @@ jobs:
|
|||||||
- name: Set up Node
|
- name: Set up Node
|
||||||
uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea
|
uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea
|
||||||
with:
|
with:
|
||||||
node-version: '16'
|
node-version: "16"
|
||||||
|
|
||||||
- name: Install node-gyp
|
- name: Install node-gyp
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
4
.vscode/launch.json
vendored
4
.vscode/launch.json
vendored
@@ -10,9 +10,7 @@
|
|||||||
"name": "Jasmine Individual Test",
|
"name": "Jasmine Individual Test",
|
||||||
"program": "${workspaceRoot}\\node_modules\\jasmine\\bin\\jasmine.js",
|
"program": "${workspaceRoot}\\node_modules\\jasmine\\bin\\jasmine.js",
|
||||||
"preLaunchTask": "npm run build",
|
"preLaunchTask": "npm run build",
|
||||||
"args": [
|
"args": ["${workspaceFolder}/dist\\spec\\node\\services\\nodeCryptoFunction.service.spec.js"]
|
||||||
"${workspaceFolder}/dist\\spec\\node\\services\\nodeCryptoFunction.service.spec.js"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -6,15 +6,11 @@ Please visit our [Community Forums](https://community.bitwarden.com/) for genera
|
|||||||
|
|
||||||
Here is how you can get involved:
|
Here is how you can get involved:
|
||||||
|
|
||||||
* **Request a new feature:** Go to the [Feature Requests category](https://community.bitwarden.com/c/feature-requests/) of the Community Forums. Please search existing feature requests before making a new one
|
- **Request a new feature:** Go to the [Feature Requests category](https://community.bitwarden.com/c/feature-requests/) of the Community Forums. Please search existing feature requests before making a new one
|
||||||
|
- **Write code for a new feature:** Make a new post in the [Github Contributions category](https://community.bitwarden.com/c/github-contributions/) of the Community Forums. Include a description of your proposed contribution, screeshots, and links to any relevant feature requests. This helps get feedback from the community and Bitwarden team members before you start writing code
|
||||||
* **Write code for a new feature:** Make a new post in the [Github Contributions category](https://community.bitwarden.com/c/github-contributions/) of the Community Forums. Include a description of your proposed contribution, screeshots, and links to any relevant feature requests. This helps get feedback from the community and Bitwarden team members before you start writing code
|
- **Report a bug or submit a bugfix:** Use Github issues and pull requests
|
||||||
|
- **Write documentation:** Submit a pull request to the [Bitwarden help repository](https://github.com/bitwarden/help)
|
||||||
* **Report a bug or submit a bugfix:** Use Github issues and pull requests
|
- **Help other users:** Go to the [User-to-User Support category](https://community.bitwarden.com/c/support/) on the Community Forums
|
||||||
|
|
||||||
* **Write documentation:** Submit a pull request to the [Bitwarden help repository](https://github.com/bitwarden/help)
|
|
||||||
|
|
||||||
* **Help other users:** Go to the [User-to-User Support category](https://community.bitwarden.com/c/support/) on the Community Forums
|
|
||||||
|
|
||||||
## Contributor Agreement
|
## Contributor Agreement
|
||||||
|
|
||||||
@@ -22,9 +18,9 @@ Please sign the [Contributor Agreement](https://cla-assistant.io/bitwarden/jslib
|
|||||||
|
|
||||||
## Pull Request Guidelines
|
## Pull Request Guidelines
|
||||||
|
|
||||||
* use `npm run lint` and fix any linting suggestions before submitting a pull request
|
- use `npm run lint` and fix any linting suggestions before submitting a pull request
|
||||||
* commit any pull requests against the `master` branch
|
- commit any pull requests against the `master` branch
|
||||||
* include a link to your Community Forums post
|
- include a link to your Community Forums post
|
||||||
|
|
||||||
# Introduction to jslib and git submodules
|
# Introduction to jslib and git submodules
|
||||||
|
|
||||||
@@ -33,36 +29,39 @@ jslib is a repository that contains shared code for all Bitwarden Typescript/Jav
|
|||||||
If you haven't worked with submodules before, you should start by reading some basic guides (such as the [git scm chapter](https://git-scm.com/book/en/v2/Git-Tools-Submodules) or the [Atlassian tutorial](https://www.atlassian.com/git/tutorials/git-submodule)).
|
If you haven't worked with submodules before, you should start by reading some basic guides (such as the [git scm chapter](https://git-scm.com/book/en/v2/Git-Tools-Submodules) or the [Atlassian tutorial](https://www.atlassian.com/git/tutorials/git-submodule)).
|
||||||
|
|
||||||
# Setting up your Local Dev environment for jslib
|
# Setting up your Local Dev environment for jslib
|
||||||
|
|
||||||
In order to easily develop local changes to jslib across each of the TypeScript/JavaScript clients, we recommend using symlinks for the submodule so that you only have to make the change once for it to be reflected across all your local repos.
|
In order to easily develop local changes to jslib across each of the TypeScript/JavaScript clients, we recommend using symlinks for the submodule so that you only have to make the change once for it to be reflected across all your local repos.
|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
1. git bash or other git command line
|
1. git bash or other git command line
|
||||||
2. In order for this to work well, you need to use a consistent relative directory structure. Repos should be cloned in the following way:
|
2. In order for this to work well, you need to use a consistent relative directory structure. Repos should be cloned in the following way:
|
||||||
|
|
||||||
* `./<your project(s) directory>`; we'll call this `/dev` ('cause why not)
|
- `./<your project(s) directory>`; we'll call this `/dev` ('cause why not)
|
||||||
* jslib - `git clone https://github.com/bitwarden/jslib.git` (/dev/jslib)
|
- jslib - `git clone https://github.com/bitwarden/jslib.git` (/dev/jslib)
|
||||||
* web - `git clone --recurse-submodules https://github.com/bitwarden/web.git` (/dev/web)
|
- web - `git clone --recurse-submodules https://github.com/bitwarden/web.git` (/dev/web)
|
||||||
* desktop - `git clone --recurse-submodules https://github.com/bitwarden/desktop.git` (/dev/desktop)
|
- desktop - `git clone --recurse-submodules https://github.com/bitwarden/desktop.git` (/dev/desktop)
|
||||||
* browser - `git clone --recurse-submodules https://github.com/bitwarden/browser.git` (/dev/browser)
|
- browser - `git clone --recurse-submodules https://github.com/bitwarden/browser.git` (/dev/browser)
|
||||||
* cli - `git clone --recurse-submodules https://github.com/bitwarden/cli` (/dev/cli)
|
- cli - `git clone --recurse-submodules https://github.com/bitwarden/cli` (/dev/cli)
|
||||||
|
|
||||||
You should notice web, desktop, browser and cli each reference jslib as a git submodule. If you've already cloned the repos but didn't use `--recurse-submodules` then you'll need to init the submodule with `npm run sub:init`.
|
You should notice web, desktop, browser and cli each reference jslib as a git submodule. If you've already cloned the repos but didn't use `--recurse-submodules` then you'll need to init the submodule with `npm run sub:init`.
|
||||||
|
|
||||||
## Configure Symlinks
|
## Configure Symlinks
|
||||||
|
|
||||||
Using `git clone` will make symlinks added to your repo be seen by git as plain text file paths. We need to prevent that. In the project root run, `git config core.symlinks true`.
|
Using `git clone` will make symlinks added to your repo be seen by git as plain text file paths. We need to prevent that. In the project root run, `git config core.symlinks true`.
|
||||||
|
|
||||||
For each project other than jslib, run the following:
|
For each project other than jslib, run the following:
|
||||||
|
|
||||||
* For macOS/Linux: `npm run symlink:mac`
|
- For macOS/Linux: `npm run symlink:mac`
|
||||||
* For Windows: `npm run symlink:win`
|
- For Windows: `npm run symlink:win`
|
||||||
|
|
||||||
Your client repos will now be pointing to your local jslib repo. You can now make changes in jslib and they will be immediately shared by the clients (just like they will be in production).
|
Your client repos will now be pointing to your local jslib repo. You can now make changes in jslib and they will be immediately shared by the clients (just like they will be in production).
|
||||||
|
|
||||||
## Committing and pushing jslib changes
|
## Committing and pushing jslib changes
|
||||||
|
|
||||||
* You work on jslib like any other repo. Check out a new branch, make some commits, and push to remote when you're ready to submit a PR.
|
- You work on jslib like any other repo. Check out a new branch, make some commits, and push to remote when you're ready to submit a PR.
|
||||||
* Do not commit your jslib changes in the client repo. Your changes to the client and your changes to jslib should stay completely separate.
|
- Do not commit your jslib changes in the client repo. Your changes to the client and your changes to jslib should stay completely separate.
|
||||||
* When submitting a client PR that depends on a jslib PR, please include a link to the jslib PR so that the reviewer knows there are jslib changes.
|
- When submitting a client PR that depends on a jslib PR, please include a link to the jslib PR so that the reviewer knows there are jslib changes.
|
||||||
|
|
||||||
### Updating jslib on a feature branch
|
### Updating jslib on a feature branch
|
||||||
|
|
||||||
@@ -70,8 +69,8 @@ If you've submitted a client PR and a jslib PR, your jslib PR will be approved a
|
|||||||
|
|
||||||
1. If you've symlinked the client's jslib directory following the steps above, you'll need to delete that symlink and then run `npm run sub:init`.
|
1. If you've symlinked the client's jslib directory following the steps above, you'll need to delete that symlink and then run `npm run sub:init`.
|
||||||
2. Update the jslib submodule:
|
2. Update the jslib submodule:
|
||||||
* if you're working on your own fork, run `git submodule update --remote --reference upstream`.
|
- if you're working on your own fork, run `git submodule update --remote --reference upstream`.
|
||||||
* if you're working on a branch on the official repo, run `npm run sub:update`
|
- if you're working on a branch on the official repo, run `npm run sub:update`
|
||||||
3. To check you've done this correctly, you can `cd` into your jslib directory and run `git log`. You should see your recent changes in the log. This will also show you the most recent commit hash, which should match the most recent commit hash on [Github](https://github.com/bitwarden/jslib).
|
3. To check you've done this correctly, you can `cd` into your jslib directory and run `git log`. You should see your recent changes in the log. This will also show you the most recent commit hash, which should match the most recent commit hash on [Github](https://github.com/bitwarden/jslib).
|
||||||
4. Add your changes: `git add jslib`
|
4. Add your changes: `git add jslib`
|
||||||
5. Commit your changes: `git commit -m "update jslib version"`
|
5. Commit your changes: `git commit -m "update jslib version"`
|
||||||
@@ -89,7 +88,8 @@ If you've made changes to jslib without needing to make any changes to the clien
|
|||||||
4. Create a new PR to the client repo. Please include a link to your jslib PR so that reviewers know why you're updating jslib.
|
4. Create a new PR to the client repo. Please include a link to your jslib PR so that reviewers know why you're updating jslib.
|
||||||
|
|
||||||
## Merge Conflicts
|
## Merge Conflicts
|
||||||
At times when you need to perform a `git merge master` into your feature or local branch, and there are conflicting version references to the *jslib* repo from your other clients, you will not be able to use the traditional merge or stage functions you would normally use for a file.
|
|
||||||
|
At times when you need to perform a `git merge master` into your feature or local branch, and there are conflicting version references to the _jslib_ repo from your other clients, you will not be able to use the traditional merge or stage functions you would normally use for a file.
|
||||||
|
|
||||||
To resolve you must use either `git reset` or update the index directly using `git update-index`. You can use (depending on whether you have symlink'd jslib) one of the following:
|
To resolve you must use either `git reset` or update the index directly using `git update-index`. You can use (depending on whether you have symlink'd jslib) one of the following:
|
||||||
|
|
||||||
|
|||||||
@@ -1,26 +1,18 @@
|
|||||||
import {
|
import { Directive, Input, OnChanges, SimpleChanges } from "@angular/core";
|
||||||
Directive,
|
|
||||||
Input,
|
|
||||||
OnChanges,
|
|
||||||
SimpleChanges,
|
|
||||||
} from '@angular/core';
|
|
||||||
|
|
||||||
import {
|
import { CdkDragDrop, moveItemInArray } from "@angular/cdk/drag-drop";
|
||||||
CdkDragDrop,
|
|
||||||
moveItemInArray,
|
|
||||||
} from '@angular/cdk/drag-drop';
|
|
||||||
|
|
||||||
import { EventService } from 'jslib-common/abstractions/event.service';
|
import { EventService } from "jslib-common/abstractions/event.service";
|
||||||
import { I18nService } from 'jslib-common/abstractions/i18n.service';
|
import { I18nService } from "jslib-common/abstractions/i18n.service";
|
||||||
|
|
||||||
import { CipherView } from 'jslib-common/models/view/cipherView';
|
import { CipherView } from "jslib-common/models/view/cipherView";
|
||||||
import { FieldView } from 'jslib-common/models/view/fieldView';
|
import { FieldView } from "jslib-common/models/view/fieldView";
|
||||||
|
|
||||||
import { CipherType } from 'jslib-common/enums/cipherType';
|
import { CipherType } from "jslib-common/enums/cipherType";
|
||||||
import { EventType } from 'jslib-common/enums/eventType';
|
import { EventType } from "jslib-common/enums/eventType";
|
||||||
import { FieldType } from 'jslib-common/enums/fieldType';
|
import { FieldType } from "jslib-common/enums/fieldType";
|
||||||
|
|
||||||
import { Utils } from 'jslib-common/misc/utils';
|
import { Utils } from "jslib-common/misc/utils";
|
||||||
|
|
||||||
@Directive()
|
@Directive()
|
||||||
export class AddEditCustomFieldsComponent implements OnChanges {
|
export class AddEditCustomFieldsComponent implements OnChanges {
|
||||||
@@ -39,11 +31,14 @@ export class AddEditCustomFieldsComponent implements OnChanges {
|
|||||||
|
|
||||||
constructor(private i18nService: I18nService, private eventService: EventService) {
|
constructor(private i18nService: I18nService, private eventService: EventService) {
|
||||||
this.addFieldTypeOptions = [
|
this.addFieldTypeOptions = [
|
||||||
{ name: i18nService.t('cfTypeText'), value: FieldType.Text },
|
{ name: i18nService.t("cfTypeText"), value: FieldType.Text },
|
||||||
{ name: i18nService.t('cfTypeHidden'), value: FieldType.Hidden },
|
{ name: i18nService.t("cfTypeHidden"), value: FieldType.Hidden },
|
||||||
{ name: i18nService.t('cfTypeBoolean'), value: FieldType.Boolean },
|
{ name: i18nService.t("cfTypeBoolean"), value: FieldType.Boolean },
|
||||||
];
|
];
|
||||||
this.addFieldLinkedTypeOption = { name: this.i18nService.t('cfTypeLinked'), value: FieldType.Linked };
|
this.addFieldLinkedTypeOption = {
|
||||||
|
name: this.i18nService.t("cfTypeLinked"),
|
||||||
|
value: FieldType.Linked,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnChanges(changes: SimpleChanges) {
|
ngOnChanges(changes: SimpleChanges) {
|
||||||
@@ -80,7 +75,7 @@ export class AddEditCustomFieldsComponent implements OnChanges {
|
|||||||
}
|
}
|
||||||
|
|
||||||
toggleFieldValue(field: FieldView) {
|
toggleFieldValue(field: FieldView) {
|
||||||
const f = (field as any);
|
const f = field as any;
|
||||||
f.showValue = !f.showValue;
|
f.showValue = !f.showValue;
|
||||||
if (this.editMode && f.showValue) {
|
if (this.editMode && f.showValue) {
|
||||||
this.eventService.collect(EventType.Cipher_ClientToggledHiddenFieldVisible, this.cipher.id);
|
this.eventService.collect(EventType.Cipher_ClientToggledHiddenFieldVisible, this.cipher.id);
|
||||||
@@ -102,8 +97,9 @@ export class AddEditCustomFieldsComponent implements OnChanges {
|
|||||||
|
|
||||||
const options: any = [];
|
const options: any = [];
|
||||||
this.cipher.linkedFieldOptions.forEach((linkedFieldOption, id) =>
|
this.cipher.linkedFieldOptions.forEach((linkedFieldOption, id) =>
|
||||||
options.push({ name: this.i18nService.t(linkedFieldOption.i18nKey), value: id }));
|
options.push({ name: this.i18nService.t(linkedFieldOption.i18nKey), value: id })
|
||||||
this.linkedFieldOptions = options.sort(Utils.getSortFunction(this.i18nService, 'name'));
|
);
|
||||||
|
this.linkedFieldOptions = options.sort(Utils.getSortFunction(this.i18nService, "name"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private resetCipherLinkedFields() {
|
private resetCipherLinkedFields() {
|
||||||
@@ -113,12 +109,12 @@ export class AddEditCustomFieldsComponent implements OnChanges {
|
|||||||
|
|
||||||
// Delete any Linked custom fields if the item type does not support them
|
// Delete any Linked custom fields if the item type does not support them
|
||||||
if (this.cipher.linkedFieldOptions == null) {
|
if (this.cipher.linkedFieldOptions == null) {
|
||||||
this.cipher.fields = this.cipher.fields.filter(f => f.type !== FieldType.Linked);
|
this.cipher.fields = this.cipher.fields.filter((f) => f.type !== FieldType.Linked);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.cipher.fields
|
this.cipher.fields
|
||||||
.filter(f => f.type === FieldType.Linked)
|
.filter((f) => f.type === FieldType.Linked)
|
||||||
.forEach(f => f.linkedId = this.linkedFieldOptions[0].value);
|
.forEach((f) => (f.linkedId = this.linkedFieldOptions[0].value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
<div #callout class="callout callout-{{calloutStyle}}" [ngClass]="{'clickable': clickable}"
|
<div
|
||||||
[attr.role]="useAlertRole ? 'alert' : null">
|
#callout
|
||||||
|
class="callout callout-{{ calloutStyle }}"
|
||||||
|
[ngClass]="{ clickable: clickable }"
|
||||||
|
[attr.role]="useAlertRole ? 'alert' : null"
|
||||||
|
>
|
||||||
<h3 class="callout-heading" *ngIf="title">
|
<h3 class="callout-heading" *ngIf="title">
|
||||||
<i class="fa {{ icon }}" *ngIf="icon" aria-hidden="true"></i>
|
<i class="fa {{ icon }}" *ngIf="icon" aria-hidden="true"></i>
|
||||||
{{ title }}
|
{{ title }}
|
||||||
@@ -8,19 +12,23 @@
|
|||||||
{{ enforcedPolicyMessage }}
|
{{ enforcedPolicyMessage }}
|
||||||
<ul>
|
<ul>
|
||||||
<li *ngIf="enforcedPolicyOptions?.minComplexity > 0">
|
<li *ngIf="enforcedPolicyOptions?.minComplexity > 0">
|
||||||
{{'policyInEffectMinComplexity' | i18n : getPasswordScoreAlertDisplay()}}
|
{{ "policyInEffectMinComplexity" | i18n: getPasswordScoreAlertDisplay() }}
|
||||||
</li>
|
</li>
|
||||||
<li *ngIf="enforcedPolicyOptions?.minLength > 0">
|
<li *ngIf="enforcedPolicyOptions?.minLength > 0">
|
||||||
{{'policyInEffectMinLength' | i18n : enforcedPolicyOptions?.minLength.toString()}}
|
{{ "policyInEffectMinLength" | i18n: enforcedPolicyOptions?.minLength.toString() }}
|
||||||
</li>
|
</li>
|
||||||
<li *ngIf="enforcedPolicyOptions?.requireUpper">
|
<li *ngIf="enforcedPolicyOptions?.requireUpper">
|
||||||
{{'policyInEffectUppercase' | i18n}}</li>
|
{{ "policyInEffectUppercase" | i18n }}
|
||||||
|
</li>
|
||||||
<li *ngIf="enforcedPolicyOptions?.requireLower">
|
<li *ngIf="enforcedPolicyOptions?.requireLower">
|
||||||
{{'policyInEffectLowercase' | i18n}}</li>
|
{{ "policyInEffectLowercase" | i18n }}
|
||||||
|
</li>
|
||||||
<li *ngIf="enforcedPolicyOptions?.requireNumbers">
|
<li *ngIf="enforcedPolicyOptions?.requireNumbers">
|
||||||
{{'policyInEffectNumbers' | i18n}}</li>
|
{{ "policyInEffectNumbers" | i18n }}
|
||||||
|
</li>
|
||||||
<li *ngIf="enforcedPolicyOptions?.requireSpecial">
|
<li *ngIf="enforcedPolicyOptions?.requireSpecial">
|
||||||
{{'policyInEffectSpecial' | i18n : '!@#$%^&*'}}</li>
|
{{ "policyInEffectSpecial" | i18n: "!@#$%^&*" }}
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<ng-content></ng-content>
|
<ng-content></ng-content>
|
||||||
|
|||||||
@@ -1,19 +1,15 @@
|
|||||||
import {
|
import { Component, Input, OnInit } from "@angular/core";
|
||||||
Component,
|
|
||||||
Input,
|
|
||||||
OnInit,
|
|
||||||
} from '@angular/core';
|
|
||||||
|
|
||||||
import { I18nService } from 'jslib-common/abstractions/i18n.service';
|
import { I18nService } from "jslib-common/abstractions/i18n.service";
|
||||||
|
|
||||||
import { MasterPasswordPolicyOptions } from 'jslib-common/models/domain/masterPasswordPolicyOptions';
|
import { MasterPasswordPolicyOptions } from "jslib-common/models/domain/masterPasswordPolicyOptions";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-callout',
|
selector: "app-callout",
|
||||||
templateUrl: 'callout.component.html',
|
templateUrl: "callout.component.html",
|
||||||
})
|
})
|
||||||
export class CalloutComponent implements OnInit {
|
export class CalloutComponent implements OnInit {
|
||||||
@Input() type = 'info';
|
@Input() type = "info";
|
||||||
@Input() icon: string;
|
@Input() icon: string;
|
||||||
@Input() title: string;
|
@Input() title: string;
|
||||||
@Input() clickable: boolean;
|
@Input() clickable: boolean;
|
||||||
@@ -29,55 +25,55 @@ export class CalloutComponent implements OnInit {
|
|||||||
this.calloutStyle = this.type;
|
this.calloutStyle = this.type;
|
||||||
|
|
||||||
if (this.enforcedPolicyMessage === undefined) {
|
if (this.enforcedPolicyMessage === undefined) {
|
||||||
this.enforcedPolicyMessage = this.i18nService.t('masterPasswordPolicyInEffect');
|
this.enforcedPolicyMessage = this.i18nService.t("masterPasswordPolicyInEffect");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.type === 'warning' || this.type === 'danger') {
|
if (this.type === "warning" || this.type === "danger") {
|
||||||
if (this.type === 'danger') {
|
if (this.type === "danger") {
|
||||||
this.calloutStyle = 'danger';
|
this.calloutStyle = "danger";
|
||||||
}
|
}
|
||||||
if (this.title === undefined) {
|
if (this.title === undefined) {
|
||||||
this.title = this.i18nService.t('warning');
|
this.title = this.i18nService.t("warning");
|
||||||
}
|
}
|
||||||
if (this.icon === undefined) {
|
if (this.icon === undefined) {
|
||||||
this.icon = 'fa-warning';
|
this.icon = "fa-warning";
|
||||||
}
|
}
|
||||||
} else if (this.type === 'error') {
|
} else if (this.type === "error") {
|
||||||
this.calloutStyle = 'danger';
|
this.calloutStyle = "danger";
|
||||||
if (this.title === undefined) {
|
if (this.title === undefined) {
|
||||||
this.title = this.i18nService.t('error');
|
this.title = this.i18nService.t("error");
|
||||||
}
|
}
|
||||||
if (this.icon === undefined) {
|
if (this.icon === undefined) {
|
||||||
this.icon = 'fa-bolt';
|
this.icon = "fa-bolt";
|
||||||
}
|
}
|
||||||
} else if (this.type === 'tip') {
|
} else if (this.type === "tip") {
|
||||||
this.calloutStyle = 'success';
|
this.calloutStyle = "success";
|
||||||
if (this.title === undefined) {
|
if (this.title === undefined) {
|
||||||
this.title = this.i18nService.t('tip');
|
this.title = this.i18nService.t("tip");
|
||||||
}
|
}
|
||||||
if (this.icon === undefined) {
|
if (this.icon === undefined) {
|
||||||
this.icon = 'fa-lightbulb-o';
|
this.icon = "fa-lightbulb-o";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getPasswordScoreAlertDisplay() {
|
getPasswordScoreAlertDisplay() {
|
||||||
if (this.enforcedPolicyOptions == null) {
|
if (this.enforcedPolicyOptions == null) {
|
||||||
return '';
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
let str: string;
|
let str: string;
|
||||||
switch (this.enforcedPolicyOptions.minComplexity) {
|
switch (this.enforcedPolicyOptions.minComplexity) {
|
||||||
case 4:
|
case 4:
|
||||||
str = this.i18nService.t('strong');
|
str = this.i18nService.t("strong");
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
str = this.i18nService.t('good');
|
str = this.i18nService.t("good");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
str = this.i18nService.t('weak');
|
str = this.i18nService.t("weak");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return str + ' (' + this.enforcedPolicyOptions.minComplexity + ')';
|
return str + " (" + this.enforcedPolicyOptions.minComplexity + ")";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import { Directive, Input } from '@angular/core';
|
import { Directive, Input } from "@angular/core";
|
||||||
|
|
||||||
import { EnvironmentService } from 'jslib-common/abstractions/environment.service';
|
import { EnvironmentService } from "jslib-common/abstractions/environment.service";
|
||||||
import { I18nService } from 'jslib-common/abstractions/i18n.service';
|
import { I18nService } from "jslib-common/abstractions/i18n.service";
|
||||||
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.service";
|
||||||
|
|
||||||
import { CaptchaIFrame } from 'jslib-common/misc/captcha_iframe';
|
import { CaptchaIFrame } from "jslib-common/misc/captcha_iframe";
|
||||||
|
|
||||||
import { Utils } from 'jslib-common/misc/utils';
|
import { Utils } from "jslib-common/misc/utils";
|
||||||
|
|
||||||
@Directive()
|
@Directive()
|
||||||
export abstract class CaptchaProtectedComponent {
|
export abstract class CaptchaProtectedComponent {
|
||||||
@@ -14,19 +14,27 @@ export abstract class CaptchaProtectedComponent {
|
|||||||
captchaToken: string = null;
|
captchaToken: string = null;
|
||||||
captcha: CaptchaIFrame;
|
captcha: CaptchaIFrame;
|
||||||
|
|
||||||
constructor(protected environmentService: EnvironmentService, protected i18nService: I18nService,
|
constructor(
|
||||||
protected platformUtilsService: PlatformUtilsService) { }
|
protected environmentService: EnvironmentService,
|
||||||
|
protected i18nService: I18nService,
|
||||||
|
protected platformUtilsService: PlatformUtilsService
|
||||||
|
) {}
|
||||||
|
|
||||||
async setupCaptcha() {
|
async setupCaptcha() {
|
||||||
const webVaultUrl = this.environmentService.getWebVaultUrl();
|
const webVaultUrl = this.environmentService.getWebVaultUrl();
|
||||||
|
|
||||||
this.captcha = new CaptchaIFrame(window, webVaultUrl,
|
this.captcha = new CaptchaIFrame(
|
||||||
this.i18nService, (token: string) => {
|
window,
|
||||||
|
webVaultUrl,
|
||||||
|
this.i18nService,
|
||||||
|
(token: string) => {
|
||||||
this.captchaToken = token;
|
this.captchaToken = token;
|
||||||
}, (error: string) => {
|
},
|
||||||
this.platformUtilsService.showToast('error', this.i18nService.t('errorOccurred'), error);
|
(error: string) => {
|
||||||
}, (info: string) => {
|
this.platformUtilsService.showToast("error", this.i18nService.t("errorOccurred"), error);
|
||||||
this.platformUtilsService.showToast('info', this.i18nService.t('info'), info);
|
},
|
||||||
|
(info: string) => {
|
||||||
|
this.platformUtilsService.showToast("info", this.i18nService.t("info"), info);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -35,7 +43,7 @@ export abstract class CaptchaProtectedComponent {
|
|||||||
return !Utils.isNullOrWhitespace(this.captchaSiteKey);
|
return !Utils.isNullOrWhitespace(this.captchaSiteKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected handleCaptchaRequired(response: { captchaSiteKey: string; }): boolean {
|
protected handleCaptchaRequired(response: { captchaSiteKey: string }): boolean {
|
||||||
if (Utils.isNullOrWhitespace(response.captchaSiteKey)) {
|
if (Utils.isNullOrWhitespace(response.captchaSiteKey)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,8 @@
|
|||||||
import {
|
import { Directive, EventEmitter, Input, Output } from "@angular/core";
|
||||||
Directive,
|
|
||||||
EventEmitter,
|
|
||||||
Input,
|
|
||||||
Output,
|
|
||||||
} from '@angular/core';
|
|
||||||
|
|
||||||
import { SearchService } from 'jslib-common/abstractions/search.service';
|
import { SearchService } from "jslib-common/abstractions/search.service";
|
||||||
|
|
||||||
import { CipherView } from 'jslib-common/models/view/cipherView';
|
import { CipherView } from "jslib-common/models/view/cipherView";
|
||||||
|
|
||||||
@Directive()
|
@Directive()
|
||||||
export class CiphersComponent {
|
export class CiphersComponent {
|
||||||
@@ -87,9 +82,13 @@ export class CiphersComponent {
|
|||||||
return !this.searchPending && this.searchService.isSearchable(this.searchText);
|
return !this.searchPending && this.searchService.isSearchable(this.searchText);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected deletedFilter: (cipher: CipherView) => boolean = c => c.isDeleted === this.deleted;
|
protected deletedFilter: (cipher: CipherView) => boolean = (c) => c.isDeleted === this.deleted;
|
||||||
|
|
||||||
protected async doSearch(indexedCiphers?: CipherView[]) {
|
protected async doSearch(indexedCiphers?: CipherView[]) {
|
||||||
this.ciphers = await this.searchService.searchCiphers(this.searchText, [this.filter, this.deletedFilter], indexedCiphers);
|
this.ciphers = await this.searchService.searchCiphers(
|
||||||
|
this.searchText,
|
||||||
|
[this.filter, this.deletedFilter],
|
||||||
|
indexedCiphers
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,21 +1,15 @@
|
|||||||
import {
|
import { Directive, EventEmitter, Input, OnInit, Output } from "@angular/core";
|
||||||
Directive,
|
|
||||||
EventEmitter,
|
|
||||||
Input,
|
|
||||||
OnInit,
|
|
||||||
Output,
|
|
||||||
} from '@angular/core';
|
|
||||||
|
|
||||||
import { CipherService } from 'jslib-common/abstractions/cipher.service';
|
import { CipherService } from "jslib-common/abstractions/cipher.service";
|
||||||
import { CollectionService } from 'jslib-common/abstractions/collection.service';
|
import { CollectionService } from "jslib-common/abstractions/collection.service";
|
||||||
import { I18nService } from 'jslib-common/abstractions/i18n.service';
|
import { I18nService } from "jslib-common/abstractions/i18n.service";
|
||||||
import { LogService } from 'jslib-common/abstractions/log.service';
|
import { LogService } from "jslib-common/abstractions/log.service";
|
||||||
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.service";
|
||||||
|
|
||||||
import { CipherView } from 'jslib-common/models/view/cipherView';
|
import { CipherView } from "jslib-common/models/view/cipherView";
|
||||||
import { CollectionView } from 'jslib-common/models/view/collectionView';
|
import { CollectionView } from "jslib-common/models/view/collectionView";
|
||||||
|
|
||||||
import { Cipher } from 'jslib-common/models/domain/cipher';
|
import { Cipher } from "jslib-common/models/domain/cipher";
|
||||||
|
|
||||||
@Directive()
|
@Directive()
|
||||||
export class CollectionsComponent implements OnInit {
|
export class CollectionsComponent implements OnInit {
|
||||||
@@ -30,8 +24,13 @@ export class CollectionsComponent implements OnInit {
|
|||||||
|
|
||||||
protected cipherDomain: Cipher;
|
protected cipherDomain: Cipher;
|
||||||
|
|
||||||
constructor(protected collectionService: CollectionService, protected platformUtilsService: PlatformUtilsService,
|
constructor(
|
||||||
protected i18nService: I18nService, protected cipherService: CipherService, private logService: LogService) { }
|
protected collectionService: CollectionService,
|
||||||
|
protected platformUtilsService: PlatformUtilsService,
|
||||||
|
protected i18nService: I18nService,
|
||||||
|
protected cipherService: CipherService,
|
||||||
|
private logService: LogService
|
||||||
|
) {}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
await this.load();
|
await this.load();
|
||||||
@@ -43,9 +42,9 @@ export class CollectionsComponent implements OnInit {
|
|||||||
this.cipher = await this.cipherDomain.decrypt();
|
this.cipher = await this.cipherDomain.decrypt();
|
||||||
this.collections = await this.loadCollections();
|
this.collections = await this.loadCollections();
|
||||||
|
|
||||||
this.collections.forEach(c => (c as any).checked = false);
|
this.collections.forEach((c) => ((c as any).checked = false));
|
||||||
if (this.collectionIds != null) {
|
if (this.collectionIds != null) {
|
||||||
this.collections.forEach(c => {
|
this.collections.forEach((c) => {
|
||||||
(c as any).checked = this.collectionIds != null && this.collectionIds.indexOf(c.id) > -1;
|
(c as any).checked = this.collectionIds != null && this.collectionIds.indexOf(c.id) > -1;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -53,11 +52,14 @@ export class CollectionsComponent implements OnInit {
|
|||||||
|
|
||||||
async submit() {
|
async submit() {
|
||||||
const selectedCollectionIds = this.collections
|
const selectedCollectionIds = this.collections
|
||||||
.filter(c => !!(c as any).checked)
|
.filter((c) => !!(c as any).checked)
|
||||||
.map(c => c.id);
|
.map((c) => c.id);
|
||||||
if (!this.allowSelectNone && selectedCollectionIds.length === 0) {
|
if (!this.allowSelectNone && selectedCollectionIds.length === 0) {
|
||||||
this.platformUtilsService.showToast('error', this.i18nService.t('errorOccurred'),
|
this.platformUtilsService.showToast(
|
||||||
this.i18nService.t('selectOneCollection'));
|
"error",
|
||||||
|
this.i18nService.t("errorOccurred"),
|
||||||
|
this.i18nService.t("selectOneCollection")
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.cipherDomain.collectionIds = selectedCollectionIds;
|
this.cipherDomain.collectionIds = selectedCollectionIds;
|
||||||
@@ -65,7 +67,7 @@ export class CollectionsComponent implements OnInit {
|
|||||||
this.formPromise = this.saveCollections();
|
this.formPromise = this.saveCollections();
|
||||||
await this.formPromise;
|
await this.formPromise;
|
||||||
this.onSavedCollections.emit();
|
this.onSavedCollections.emit();
|
||||||
this.platformUtilsService.showToast('success', null, this.i18nService.t('editedItem'));
|
this.platformUtilsService.showToast("success", null, this.i18nService.t("editedItem"));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.logService.error(e);
|
this.logService.error(e);
|
||||||
}
|
}
|
||||||
@@ -81,7 +83,9 @@ export class CollectionsComponent implements OnInit {
|
|||||||
|
|
||||||
protected async loadCollections() {
|
protected async loadCollections() {
|
||||||
const allCollections = await this.collectionService.getAllDecrypted();
|
const allCollections = await this.collectionService.getAllDecrypted();
|
||||||
return allCollections.filter(c => !c.readOnly && c.organizationId === this.cipher.organizationId);
|
return allCollections.filter(
|
||||||
|
(c) => !c.readOnly && c.organizationId === this.cipher.organizationId
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected saveCollections() {
|
protected saveCollections() {
|
||||||
|
|||||||
@@ -1,12 +1,8 @@
|
|||||||
import {
|
import { Directive, EventEmitter, Output } from "@angular/core";
|
||||||
Directive,
|
|
||||||
EventEmitter,
|
|
||||||
Output,
|
|
||||||
} from '@angular/core';
|
|
||||||
|
|
||||||
import { EnvironmentService } from 'jslib-common/abstractions/environment.service';
|
import { EnvironmentService } from "jslib-common/abstractions/environment.service";
|
||||||
import { I18nService } from 'jslib-common/abstractions/i18n.service';
|
import { I18nService } from "jslib-common/abstractions/i18n.service";
|
||||||
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.service";
|
||||||
|
|
||||||
@Directive()
|
@Directive()
|
||||||
export class EnvironmentComponent {
|
export class EnvironmentComponent {
|
||||||
@@ -20,17 +16,19 @@ export class EnvironmentComponent {
|
|||||||
baseUrl: string;
|
baseUrl: string;
|
||||||
showCustom = false;
|
showCustom = false;
|
||||||
|
|
||||||
constructor(protected platformUtilsService: PlatformUtilsService, protected environmentService: EnvironmentService,
|
constructor(
|
||||||
protected i18nService: I18nService) {
|
protected platformUtilsService: PlatformUtilsService,
|
||||||
|
protected environmentService: EnvironmentService,
|
||||||
|
protected i18nService: I18nService
|
||||||
|
) {
|
||||||
const urls = this.environmentService.getUrls();
|
const urls = this.environmentService.getUrls();
|
||||||
|
|
||||||
this.baseUrl = urls.base || '';
|
this.baseUrl = urls.base || "";
|
||||||
this.webVaultUrl = urls.webVault || '';
|
this.webVaultUrl = urls.webVault || "";
|
||||||
this.apiUrl = urls.api || '';
|
this.apiUrl = urls.api || "";
|
||||||
this.identityUrl = urls.identity || '';
|
this.identityUrl = urls.identity || "";
|
||||||
this.iconsUrl = urls.icons || '';
|
this.iconsUrl = urls.icons || "";
|
||||||
this.notificationsUrl = urls.notifications || '';
|
this.notificationsUrl = urls.notifications || "";
|
||||||
}
|
}
|
||||||
|
|
||||||
async submit() {
|
async submit() {
|
||||||
@@ -51,7 +49,7 @@ export class EnvironmentComponent {
|
|||||||
this.iconsUrl = resUrls.icons;
|
this.iconsUrl = resUrls.icons;
|
||||||
this.notificationsUrl = resUrls.notifications;
|
this.notificationsUrl = resUrls.notifications;
|
||||||
|
|
||||||
this.platformUtilsService.showToast('success', null, this.i18nService.t('environmentSaved'));
|
this.platformUtilsService.showToast("success", null, this.i18nService.t("environmentSaved"));
|
||||||
this.saved();
|
this.saved();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,22 +1,17 @@
|
|||||||
import {
|
import { Directive, EventEmitter, OnInit, Output } from "@angular/core";
|
||||||
Directive,
|
import { FormBuilder } from "@angular/forms";
|
||||||
EventEmitter,
|
|
||||||
OnInit,
|
|
||||||
Output,
|
|
||||||
} from '@angular/core';
|
|
||||||
import { FormBuilder } from '@angular/forms';
|
|
||||||
|
|
||||||
import { CryptoService } from 'jslib-common/abstractions/crypto.service';
|
import { CryptoService } from "jslib-common/abstractions/crypto.service";
|
||||||
import { EventService } from 'jslib-common/abstractions/event.service';
|
import { EventService } from "jslib-common/abstractions/event.service";
|
||||||
import { ExportService } from 'jslib-common/abstractions/export.service';
|
import { ExportService } from "jslib-common/abstractions/export.service";
|
||||||
import { I18nService } from 'jslib-common/abstractions/i18n.service';
|
import { I18nService } from "jslib-common/abstractions/i18n.service";
|
||||||
import { LogService } from 'jslib-common/abstractions/log.service';
|
import { LogService } from "jslib-common/abstractions/log.service";
|
||||||
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.service";
|
||||||
import { PolicyService } from 'jslib-common/abstractions/policy.service';
|
import { PolicyService } from "jslib-common/abstractions/policy.service";
|
||||||
import { UserVerificationService } from 'jslib-common/abstractions/userVerification.service';
|
import { UserVerificationService } from "jslib-common/abstractions/userVerification.service";
|
||||||
|
|
||||||
import { EventType } from 'jslib-common/enums/eventType';
|
import { EventType } from "jslib-common/enums/eventType";
|
||||||
import { PolicyType } from 'jslib-common/enums/policyType';
|
import { PolicyType } from "jslib-common/enums/policyType";
|
||||||
|
|
||||||
@Directive()
|
@Directive()
|
||||||
export class ExportComponent implements OnInit {
|
export class ExportComponent implements OnInit {
|
||||||
@@ -26,40 +21,53 @@ export class ExportComponent implements OnInit {
|
|||||||
disabledByPolicy: boolean = false;
|
disabledByPolicy: boolean = false;
|
||||||
|
|
||||||
exportForm = this.fb.group({
|
exportForm = this.fb.group({
|
||||||
format: ['json'],
|
format: ["json"],
|
||||||
secret: [''],
|
secret: [""],
|
||||||
});
|
});
|
||||||
|
|
||||||
formatOptions = [
|
formatOptions = [
|
||||||
{ name: '.json', value: 'json' },
|
{ name: ".json", value: "json" },
|
||||||
{ name: '.csv', value: 'csv' },
|
{ name: ".csv", value: "csv" },
|
||||||
{ name: '.json (Encrypted)', value: 'encrypted_json' },
|
{ name: ".json (Encrypted)", value: "encrypted_json" },
|
||||||
];
|
];
|
||||||
|
|
||||||
constructor(protected cryptoService: CryptoService, protected i18nService: I18nService,
|
constructor(
|
||||||
protected platformUtilsService: PlatformUtilsService, protected exportService: ExportService,
|
protected cryptoService: CryptoService,
|
||||||
protected eventService: EventService, private policyService: PolicyService, protected win: Window,
|
protected i18nService: I18nService,
|
||||||
private logService: LogService, private userVerificationService: UserVerificationService,
|
protected platformUtilsService: PlatformUtilsService,
|
||||||
private fb: FormBuilder) { }
|
protected exportService: ExportService,
|
||||||
|
protected eventService: EventService,
|
||||||
|
private policyService: PolicyService,
|
||||||
|
protected win: Window,
|
||||||
|
private logService: LogService,
|
||||||
|
private userVerificationService: UserVerificationService,
|
||||||
|
private fb: FormBuilder
|
||||||
|
) {}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
await this.checkExportDisabled();
|
await this.checkExportDisabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
async checkExportDisabled() {
|
async checkExportDisabled() {
|
||||||
this.disabledByPolicy = await this.policyService.policyAppliesToUser(PolicyType.DisablePersonalVaultExport);
|
this.disabledByPolicy = await this.policyService.policyAppliesToUser(
|
||||||
|
PolicyType.DisablePersonalVaultExport
|
||||||
|
);
|
||||||
if (this.disabledByPolicy) {
|
if (this.disabledByPolicy) {
|
||||||
this.exportForm.disable();
|
this.exportForm.disable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
get encryptedFormat() {
|
get encryptedFormat() {
|
||||||
return this.format === 'encrypted_json';
|
return this.format === "encrypted_json";
|
||||||
}
|
}
|
||||||
|
|
||||||
async submit() {
|
async submit() {
|
||||||
if (this.disabledByPolicy) {
|
if (this.disabledByPolicy) {
|
||||||
this.platformUtilsService.showToast('error', null, this.i18nService.t('personalVaultExportPolicyInEffect'));
|
this.platformUtilsService.showToast(
|
||||||
|
"error",
|
||||||
|
null,
|
||||||
|
this.i18nService.t("personalVaultExportPolicyInEffect")
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,11 +76,11 @@ export class ExportComponent implements OnInit {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const secret = this.exportForm.get('secret').value;
|
const secret = this.exportForm.get("secret").value;
|
||||||
try {
|
try {
|
||||||
await this.userVerificationService.verifyUser(secret);
|
await this.userVerificationService.verifyUser(secret);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.platformUtilsService.showToast('error', this.i18nService.t('errorOccurred'), e.message);
|
this.platformUtilsService.showToast("error", this.i18nService.t("errorOccurred"), e.message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,7 +90,7 @@ export class ExportComponent implements OnInit {
|
|||||||
this.downloadFile(data);
|
this.downloadFile(data);
|
||||||
this.saved();
|
this.saved();
|
||||||
await this.collectEvent();
|
await this.collectEvent();
|
||||||
this.exportForm.get('secret').setValue('');
|
this.exportForm.get("secret").setValue("");
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.logService.error(e);
|
this.logService.error(e);
|
||||||
}
|
}
|
||||||
@@ -91,16 +99,24 @@ export class ExportComponent implements OnInit {
|
|||||||
async warningDialog() {
|
async warningDialog() {
|
||||||
if (this.encryptedFormat) {
|
if (this.encryptedFormat) {
|
||||||
return await this.platformUtilsService.showDialog(
|
return await this.platformUtilsService.showDialog(
|
||||||
'<p>' + this.i18nService.t('encExportKeyWarningDesc') +
|
"<p>" +
|
||||||
'<p>' + this.i18nService.t('encExportAccountWarningDesc'),
|
this.i18nService.t("encExportKeyWarningDesc") +
|
||||||
this.i18nService.t('confirmVaultExport'), this.i18nService.t('exportVault'),
|
"<p>" +
|
||||||
this.i18nService.t('cancel'), 'warning',
|
this.i18nService.t("encExportAccountWarningDesc"),
|
||||||
true);
|
this.i18nService.t("confirmVaultExport"),
|
||||||
|
this.i18nService.t("exportVault"),
|
||||||
|
this.i18nService.t("cancel"),
|
||||||
|
"warning",
|
||||||
|
true
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
return await this.platformUtilsService.showDialog(
|
return await this.platformUtilsService.showDialog(
|
||||||
this.i18nService.t('exportWarningDesc'),
|
this.i18nService.t("exportWarningDesc"),
|
||||||
this.i18nService.t('confirmVaultExport'), this.i18nService.t('exportVault'),
|
this.i18nService.t("confirmVaultExport"),
|
||||||
this.i18nService.t('cancel'), 'warning');
|
this.i18nService.t("exportVault"),
|
||||||
|
this.i18nService.t("cancel"),
|
||||||
|
"warning"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,13 +130,13 @@ export class ExportComponent implements OnInit {
|
|||||||
|
|
||||||
protected getFileName(prefix?: string) {
|
protected getFileName(prefix?: string) {
|
||||||
let extension = this.format;
|
let extension = this.format;
|
||||||
if (this.format === 'encrypted_json') {
|
if (this.format === "encrypted_json") {
|
||||||
if (prefix == null) {
|
if (prefix == null) {
|
||||||
prefix = 'encrypted';
|
prefix = "encrypted";
|
||||||
} else {
|
} else {
|
||||||
prefix = 'encrypted_' + prefix;
|
prefix = "encrypted_" + prefix;
|
||||||
}
|
}
|
||||||
extension = 'json';
|
extension = "json";
|
||||||
}
|
}
|
||||||
return this.exportService.getFileName(prefix, extension);
|
return this.exportService.getFileName(prefix, extension);
|
||||||
}
|
}
|
||||||
@@ -130,11 +146,11 @@ export class ExportComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get format() {
|
get format() {
|
||||||
return this.exportForm.get('format').value;
|
return this.exportForm.get("format").value;
|
||||||
}
|
}
|
||||||
|
|
||||||
private downloadFile(csv: string): void {
|
private downloadFile(csv: string): void {
|
||||||
const fileName = this.getFileName();
|
const fileName = this.getFileName();
|
||||||
this.platformUtilsService.saveFile(this.win, csv, { type: 'text/plain' }, fileName);
|
this.platformUtilsService.saveFile(this.win, csv, { type: "text/plain" }, fileName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,11 @@
|
|||||||
import {
|
import { Directive, EventEmitter, Input, OnInit, Output } from "@angular/core";
|
||||||
Directive,
|
|
||||||
EventEmitter,
|
|
||||||
Input,
|
|
||||||
OnInit,
|
|
||||||
Output,
|
|
||||||
} from '@angular/core';
|
|
||||||
|
|
||||||
import { FolderService } from 'jslib-common/abstractions/folder.service';
|
import { FolderService } from "jslib-common/abstractions/folder.service";
|
||||||
import { I18nService } from 'jslib-common/abstractions/i18n.service';
|
import { I18nService } from "jslib-common/abstractions/i18n.service";
|
||||||
import { LogService } from 'jslib-common/abstractions/log.service';
|
import { LogService } from "jslib-common/abstractions/log.service";
|
||||||
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.service";
|
||||||
|
|
||||||
import { FolderView } from 'jslib-common/models/view/folderView';
|
import { FolderView } from "jslib-common/models/view/folderView";
|
||||||
|
|
||||||
@Directive()
|
@Directive()
|
||||||
export class FolderAddEditComponent implements OnInit {
|
export class FolderAddEditComponent implements OnInit {
|
||||||
@@ -25,17 +19,24 @@ export class FolderAddEditComponent implements OnInit {
|
|||||||
formPromise: Promise<any>;
|
formPromise: Promise<any>;
|
||||||
deletePromise: Promise<any>;
|
deletePromise: Promise<any>;
|
||||||
|
|
||||||
constructor(protected folderService: FolderService, protected i18nService: I18nService,
|
constructor(
|
||||||
protected platformUtilsService: PlatformUtilsService, private logService: LogService) { }
|
protected folderService: FolderService,
|
||||||
|
protected i18nService: I18nService,
|
||||||
|
protected platformUtilsService: PlatformUtilsService,
|
||||||
|
private logService: LogService
|
||||||
|
) {}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
await this.init();
|
await this.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
async submit(): Promise<boolean> {
|
async submit(): Promise<boolean> {
|
||||||
if (this.folder.name == null || this.folder.name === '') {
|
if (this.folder.name == null || this.folder.name === "") {
|
||||||
this.platformUtilsService.showToast('error', this.i18nService.t('errorOccurred'),
|
this.platformUtilsService.showToast(
|
||||||
this.i18nService.t('nameRequired'));
|
"error",
|
||||||
|
this.i18nService.t("errorOccurred"),
|
||||||
|
this.i18nService.t("nameRequired")
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,8 +44,11 @@ export class FolderAddEditComponent implements OnInit {
|
|||||||
const folder = await this.folderService.encrypt(this.folder);
|
const folder = await this.folderService.encrypt(this.folder);
|
||||||
this.formPromise = this.folderService.saveWithServer(folder);
|
this.formPromise = this.folderService.saveWithServer(folder);
|
||||||
await this.formPromise;
|
await this.formPromise;
|
||||||
this.platformUtilsService.showToast('success', null,
|
this.platformUtilsService.showToast(
|
||||||
this.i18nService.t(this.editMode ? 'editedFolder' : 'addedFolder'));
|
"success",
|
||||||
|
null,
|
||||||
|
this.i18nService.t(this.editMode ? "editedFolder" : "addedFolder")
|
||||||
|
);
|
||||||
this.onSavedFolder.emit(this.folder);
|
this.onSavedFolder.emit(this.folder);
|
||||||
return true;
|
return true;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -56,8 +60,12 @@ export class FolderAddEditComponent implements OnInit {
|
|||||||
|
|
||||||
async delete(): Promise<boolean> {
|
async delete(): Promise<boolean> {
|
||||||
const confirmed = await this.platformUtilsService.showDialog(
|
const confirmed = await this.platformUtilsService.showDialog(
|
||||||
this.i18nService.t('deleteFolderConfirmation'), this.i18nService.t('deleteFolder'),
|
this.i18nService.t("deleteFolderConfirmation"),
|
||||||
this.i18nService.t('yes'), this.i18nService.t('no'), 'warning');
|
this.i18nService.t("deleteFolder"),
|
||||||
|
this.i18nService.t("yes"),
|
||||||
|
this.i18nService.t("no"),
|
||||||
|
"warning"
|
||||||
|
);
|
||||||
if (!confirmed) {
|
if (!confirmed) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -65,7 +73,7 @@ export class FolderAddEditComponent implements OnInit {
|
|||||||
try {
|
try {
|
||||||
this.deletePromise = this.folderService.deleteWithServer(this.folder.id);
|
this.deletePromise = this.folderService.deleteWithServer(this.folder.id);
|
||||||
await this.deletePromise;
|
await this.deletePromise;
|
||||||
this.platformUtilsService.showToast('success', null, this.i18nService.t('deletedFolder'));
|
this.platformUtilsService.showToast("success", null, this.i18nService.t("deletedFolder"));
|
||||||
this.onDeletedFolder.emit(this.folder);
|
this.onDeletedFolder.emit(this.folder);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.logService.error(e);
|
this.logService.error(e);
|
||||||
@@ -79,11 +87,11 @@ export class FolderAddEditComponent implements OnInit {
|
|||||||
|
|
||||||
if (this.editMode) {
|
if (this.editMode) {
|
||||||
this.editMode = true;
|
this.editMode = true;
|
||||||
this.title = this.i18nService.t('editFolder');
|
this.title = this.i18nService.t("editFolder");
|
||||||
const folder = await this.folderService.get(this.folderId);
|
const folder = await this.folderService.get(this.folderId);
|
||||||
this.folder = await folder.decrypt();
|
this.folder = await folder.decrypt();
|
||||||
} else {
|
} else {
|
||||||
this.title = this.i18nService.t('addFolder');
|
this.title = this.i18nService.t("addFolder");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,39 +1,49 @@
|
|||||||
import { Router } from '@angular/router';
|
import { Router } from "@angular/router";
|
||||||
|
|
||||||
import { PasswordHintRequest } from 'jslib-common/models/request/passwordHintRequest';
|
import { PasswordHintRequest } from "jslib-common/models/request/passwordHintRequest";
|
||||||
|
|
||||||
import { ApiService } from 'jslib-common/abstractions/api.service';
|
import { ApiService } from "jslib-common/abstractions/api.service";
|
||||||
import { I18nService } from 'jslib-common/abstractions/i18n.service';
|
import { I18nService } from "jslib-common/abstractions/i18n.service";
|
||||||
import { LogService } from 'jslib-common/abstractions/log.service';
|
import { LogService } from "jslib-common/abstractions/log.service";
|
||||||
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.service";
|
||||||
|
|
||||||
export class HintComponent {
|
export class HintComponent {
|
||||||
email: string = '';
|
email: string = "";
|
||||||
formPromise: Promise<any>;
|
formPromise: Promise<any>;
|
||||||
|
|
||||||
protected successRoute = 'login';
|
protected successRoute = "login";
|
||||||
protected onSuccessfulSubmit: () => void;
|
protected onSuccessfulSubmit: () => void;
|
||||||
|
|
||||||
constructor(protected router: Router, protected i18nService: I18nService,
|
constructor(
|
||||||
protected apiService: ApiService, protected platformUtilsService: PlatformUtilsService,
|
protected router: Router,
|
||||||
private logService: LogService) { }
|
protected i18nService: I18nService,
|
||||||
|
protected apiService: ApiService,
|
||||||
|
protected platformUtilsService: PlatformUtilsService,
|
||||||
|
private logService: LogService
|
||||||
|
) {}
|
||||||
|
|
||||||
async submit() {
|
async submit() {
|
||||||
if (this.email == null || this.email === '') {
|
if (this.email == null || this.email === "") {
|
||||||
this.platformUtilsService.showToast('error', this.i18nService.t('errorOccurred'),
|
this.platformUtilsService.showToast(
|
||||||
this.i18nService.t('emailRequired'));
|
"error",
|
||||||
|
this.i18nService.t("errorOccurred"),
|
||||||
|
this.i18nService.t("emailRequired")
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (this.email.indexOf('@') === -1) {
|
if (this.email.indexOf("@") === -1) {
|
||||||
this.platformUtilsService.showToast('error', this.i18nService.t('errorOccurred'),
|
this.platformUtilsService.showToast(
|
||||||
this.i18nService.t('invalidEmail'));
|
"error",
|
||||||
|
this.i18nService.t("errorOccurred"),
|
||||||
|
this.i18nService.t("invalidEmail")
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.formPromise = this.apiService.postPasswordHint(new PasswordHintRequest(this.email));
|
this.formPromise = this.apiService.postPasswordHint(new PasswordHintRequest(this.email));
|
||||||
await this.formPromise;
|
await this.formPromise;
|
||||||
this.platformUtilsService.showToast('success', null, this.i18nService.t('masterPassSent'));
|
this.platformUtilsService.showToast("success", null, this.i18nService.t("masterPassSent"));
|
||||||
if (this.onSuccessfulSubmit != null) {
|
if (this.onSuccessfulSubmit != null) {
|
||||||
this.onSuccessfulSubmit();
|
this.onSuccessfulSubmit();
|
||||||
} else if (this.router != null) {
|
} else if (this.router != null) {
|
||||||
|
|||||||
@@ -7,35 +7,37 @@ import {
|
|||||||
OnDestroy,
|
OnDestroy,
|
||||||
Type,
|
Type,
|
||||||
ViewChild,
|
ViewChild,
|
||||||
ViewContainerRef
|
ViewContainerRef,
|
||||||
} from '@angular/core';
|
} from "@angular/core";
|
||||||
|
|
||||||
import {
|
import { ConfigurableFocusTrap, ConfigurableFocusTrapFactory } from "@angular/cdk/a11y";
|
||||||
ConfigurableFocusTrap,
|
|
||||||
ConfigurableFocusTrapFactory,
|
|
||||||
} from '@angular/cdk/a11y';
|
|
||||||
|
|
||||||
import { ModalService } from '../../services/modal.service';
|
import { ModalService } from "../../services/modal.service";
|
||||||
|
|
||||||
import { ModalRef } from './modal.ref';
|
import { ModalRef } from "./modal.ref";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-modal',
|
selector: "app-modal",
|
||||||
template: '<ng-template #modalContent></ng-template>',
|
template: "<ng-template #modalContent></ng-template>",
|
||||||
})
|
})
|
||||||
export class DynamicModalComponent implements AfterViewInit, OnDestroy {
|
export class DynamicModalComponent implements AfterViewInit, OnDestroy {
|
||||||
componentRef: ComponentRef<any>;
|
componentRef: ComponentRef<any>;
|
||||||
|
|
||||||
@ViewChild('modalContent', { read: ViewContainerRef, static: true }) modalContentRef: ViewContainerRef;
|
@ViewChild("modalContent", { read: ViewContainerRef, static: true })
|
||||||
|
modalContentRef: ViewContainerRef;
|
||||||
|
|
||||||
childComponentType: Type<any>;
|
childComponentType: Type<any>;
|
||||||
setComponentParameters: (component: any) => void;
|
setComponentParameters: (component: any) => void;
|
||||||
|
|
||||||
private focusTrap: ConfigurableFocusTrap;
|
private focusTrap: ConfigurableFocusTrap;
|
||||||
|
|
||||||
constructor(private modalService: ModalService, private cd: ChangeDetectorRef,
|
constructor(
|
||||||
private el: ElementRef<HTMLElement>, private focusTrapFactory: ConfigurableFocusTrapFactory,
|
private modalService: ModalService,
|
||||||
public modalRef: ModalRef) { }
|
private cd: ChangeDetectorRef,
|
||||||
|
private el: ElementRef<HTMLElement>,
|
||||||
|
private focusTrapFactory: ConfigurableFocusTrapFactory,
|
||||||
|
public modalRef: ModalRef
|
||||||
|
) {}
|
||||||
|
|
||||||
ngAfterViewInit() {
|
ngAfterViewInit() {
|
||||||
this.loadChildComponent(this.childComponentType);
|
this.loadChildComponent(this.childComponentType);
|
||||||
@@ -45,8 +47,10 @@ export class DynamicModalComponent implements AfterViewInit, OnDestroy {
|
|||||||
this.cd.detectChanges();
|
this.cd.detectChanges();
|
||||||
|
|
||||||
this.modalRef.created(this.el.nativeElement);
|
this.modalRef.created(this.el.nativeElement);
|
||||||
this.focusTrap = this.focusTrapFactory.create(this.el.nativeElement.querySelector('.modal-dialog'));
|
this.focusTrap = this.focusTrapFactory.create(
|
||||||
if (this.el.nativeElement.querySelector('[appAutoFocus]') == null) {
|
this.el.nativeElement.querySelector(".modal-dialog")
|
||||||
|
);
|
||||||
|
if (this.el.nativeElement.querySelector("[appAutoFocus]") == null) {
|
||||||
this.focusTrap.focusFirstTabbableElementWhenReady();
|
this.focusTrap.focusFirstTabbableElementWhenReady();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -70,7 +74,7 @@ export class DynamicModalComponent implements AfterViewInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getFocus() {
|
getFocus() {
|
||||||
const autoFocusEl = this.el.nativeElement.querySelector('[appAutoFocus]') as HTMLElement;
|
const autoFocusEl = this.el.nativeElement.querySelector("[appAutoFocus]") as HTMLElement;
|
||||||
autoFocusEl?.focus();
|
autoFocusEl?.focus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,4 @@
|
|||||||
import {
|
import { InjectFlags, InjectionToken, Injector, Type } from "@angular/core";
|
||||||
InjectFlags,
|
|
||||||
InjectionToken,
|
|
||||||
Injector,
|
|
||||||
Type
|
|
||||||
} from '@angular/core';
|
|
||||||
|
|
||||||
export class ModalInjector implements Injector {
|
export class ModalInjector implements Injector {
|
||||||
constructor(private _parentInjector: Injector, private _additionalTokens: WeakMap<any, any>) {}
|
constructor(private _parentInjector: Injector, private _additionalTokens: WeakMap<any, any>) {}
|
||||||
|
|||||||
@@ -1,18 +1,21 @@
|
|||||||
import { Directive, OnInit } from '@angular/core';
|
import { Directive, OnInit } from "@angular/core";
|
||||||
|
|
||||||
import { I18nService } from 'jslib-common/abstractions/i18n.service';
|
import { I18nService } from "jslib-common/abstractions/i18n.service";
|
||||||
import { PasswordGenerationService } from 'jslib-common/abstractions/passwordGeneration.service';
|
import { PasswordGenerationService } from "jslib-common/abstractions/passwordGeneration.service";
|
||||||
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.service";
|
||||||
|
|
||||||
import { GeneratedPasswordHistory } from 'jslib-common/models/domain/generatedPasswordHistory';
|
import { GeneratedPasswordHistory } from "jslib-common/models/domain/generatedPasswordHistory";
|
||||||
|
|
||||||
@Directive()
|
@Directive()
|
||||||
export class PasswordGeneratorHistoryComponent implements OnInit {
|
export class PasswordGeneratorHistoryComponent implements OnInit {
|
||||||
history: GeneratedPasswordHistory[] = [];
|
history: GeneratedPasswordHistory[] = [];
|
||||||
|
|
||||||
constructor(protected passwordGenerationService: PasswordGenerationService,
|
constructor(
|
||||||
protected platformUtilsService: PlatformUtilsService, protected i18nService: I18nService,
|
protected passwordGenerationService: PasswordGenerationService,
|
||||||
private win: Window) { }
|
protected platformUtilsService: PlatformUtilsService,
|
||||||
|
protected i18nService: I18nService,
|
||||||
|
private win: Window
|
||||||
|
) {}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
this.history = await this.passwordGenerationService.getHistory();
|
this.history = await this.passwordGenerationService.getHistory();
|
||||||
@@ -26,7 +29,10 @@ export class PasswordGeneratorHistoryComponent implements OnInit {
|
|||||||
copy(password: string) {
|
copy(password: string) {
|
||||||
const copyOptions = this.win != null ? { window: this.win } : null;
|
const copyOptions = this.win != null ? { window: this.win } : null;
|
||||||
this.platformUtilsService.copyToClipboard(password, copyOptions);
|
this.platformUtilsService.copyToClipboard(password, copyOptions);
|
||||||
this.platformUtilsService.showToast('info', null,
|
this.platformUtilsService.showToast(
|
||||||
this.i18nService.t('valueCopied', this.i18nService.t('password')));
|
"info",
|
||||||
|
null,
|
||||||
|
this.i18nService.t("valueCopied", this.i18nService.t("password"))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,10 @@
|
|||||||
import {
|
import { Directive, EventEmitter, Input, OnInit, Output } from "@angular/core";
|
||||||
Directive,
|
|
||||||
EventEmitter,
|
|
||||||
Input,
|
|
||||||
OnInit,
|
|
||||||
Output,
|
|
||||||
} from '@angular/core';
|
|
||||||
|
|
||||||
import { I18nService } from 'jslib-common/abstractions/i18n.service';
|
import { I18nService } from "jslib-common/abstractions/i18n.service";
|
||||||
import { PasswordGenerationService } from 'jslib-common/abstractions/passwordGeneration.service';
|
import { PasswordGenerationService } from "jslib-common/abstractions/passwordGeneration.service";
|
||||||
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.service";
|
||||||
|
|
||||||
import { PasswordGeneratorPolicyOptions } from 'jslib-common/models/domain/passwordGeneratorPolicyOptions';
|
import { PasswordGeneratorPolicyOptions } from "jslib-common/models/domain/passwordGeneratorPolicyOptions";
|
||||||
|
|
||||||
@Directive()
|
@Directive()
|
||||||
export class PasswordGeneratorComponent implements OnInit {
|
export class PasswordGeneratorComponent implements OnInit {
|
||||||
@@ -19,17 +13,20 @@ export class PasswordGeneratorComponent implements OnInit {
|
|||||||
|
|
||||||
passTypeOptions: any[];
|
passTypeOptions: any[];
|
||||||
options: any = {};
|
options: any = {};
|
||||||
password: string = '-';
|
password: string = "-";
|
||||||
showOptions = false;
|
showOptions = false;
|
||||||
avoidAmbiguous = false;
|
avoidAmbiguous = false;
|
||||||
enforcedPolicyOptions: PasswordGeneratorPolicyOptions;
|
enforcedPolicyOptions: PasswordGeneratorPolicyOptions;
|
||||||
|
|
||||||
constructor(protected passwordGenerationService: PasswordGenerationService,
|
constructor(
|
||||||
protected platformUtilsService: PlatformUtilsService, protected i18nService: I18nService,
|
protected passwordGenerationService: PasswordGenerationService,
|
||||||
private win: Window) {
|
protected platformUtilsService: PlatformUtilsService,
|
||||||
|
protected i18nService: I18nService,
|
||||||
|
private win: Window
|
||||||
|
) {
|
||||||
this.passTypeOptions = [
|
this.passTypeOptions = [
|
||||||
{ name: i18nService.t('password'), value: 'password' },
|
{ name: i18nService.t("password"), value: "password" },
|
||||||
{ name: i18nService.t('passphrase'), value: 'passphrase' },
|
{ name: i18nService.t("passphrase"), value: "passphrase" },
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,7 +35,7 @@ export class PasswordGeneratorComponent implements OnInit {
|
|||||||
this.options = optionsResponse[0];
|
this.options = optionsResponse[0];
|
||||||
this.enforcedPolicyOptions = optionsResponse[1];
|
this.enforcedPolicyOptions = optionsResponse[1];
|
||||||
this.avoidAmbiguous = !this.options.ambiguous;
|
this.avoidAmbiguous = !this.options.ambiguous;
|
||||||
this.options.type = this.options.type === 'passphrase' ? 'passphrase' : 'password';
|
this.options.type = this.options.type === "passphrase" ? "passphrase" : "password";
|
||||||
this.password = await this.passwordGenerationService.generatePassword(this.options);
|
this.password = await this.passwordGenerationService.generatePassword(this.options);
|
||||||
await this.passwordGenerationService.addHistory(this.password);
|
await this.passwordGenerationService.addHistory(this.password);
|
||||||
}
|
}
|
||||||
@@ -70,8 +67,11 @@ export class PasswordGeneratorComponent implements OnInit {
|
|||||||
copy() {
|
copy() {
|
||||||
const copyOptions = this.win != null ? { window: this.win } : null;
|
const copyOptions = this.win != null ? { window: this.win } : null;
|
||||||
this.platformUtilsService.copyToClipboard(this.password, copyOptions);
|
this.platformUtilsService.copyToClipboard(this.password, copyOptions);
|
||||||
this.platformUtilsService.showToast('info', null,
|
this.platformUtilsService.showToast(
|
||||||
this.i18nService.t('valueCopied', this.i18nService.t('password')));
|
"info",
|
||||||
|
null,
|
||||||
|
this.i18nService.t("valueCopied", this.i18nService.t("password"))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
select() {
|
select() {
|
||||||
@@ -86,10 +86,15 @@ export class PasswordGeneratorComponent implements OnInit {
|
|||||||
// Application level normalize options depedent on class variables
|
// Application level normalize options depedent on class variables
|
||||||
this.options.ambiguous = !this.avoidAmbiguous;
|
this.options.ambiguous = !this.avoidAmbiguous;
|
||||||
|
|
||||||
if (!this.options.uppercase && !this.options.lowercase && !this.options.number && !this.options.special) {
|
if (
|
||||||
|
!this.options.uppercase &&
|
||||||
|
!this.options.lowercase &&
|
||||||
|
!this.options.number &&
|
||||||
|
!this.options.special
|
||||||
|
) {
|
||||||
this.options.lowercase = true;
|
this.options.lowercase = true;
|
||||||
if (this.win != null) {
|
if (this.win != null) {
|
||||||
const lowercase = this.win.document.querySelector('#lowercase') as HTMLInputElement;
|
const lowercase = this.win.document.querySelector("#lowercase") as HTMLInputElement;
|
||||||
if (lowercase) {
|
if (lowercase) {
|
||||||
lowercase.checked = true;
|
lowercase.checked = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,18 +1,22 @@
|
|||||||
import { Directive, OnInit } from '@angular/core';
|
import { Directive, OnInit } from "@angular/core";
|
||||||
|
|
||||||
import { CipherService } from 'jslib-common/abstractions/cipher.service';
|
import { CipherService } from "jslib-common/abstractions/cipher.service";
|
||||||
import { I18nService } from 'jslib-common/abstractions/i18n.service';
|
import { I18nService } from "jslib-common/abstractions/i18n.service";
|
||||||
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.service";
|
||||||
|
|
||||||
import { PasswordHistoryView } from 'jslib-common/models/view/passwordHistoryView';
|
import { PasswordHistoryView } from "jslib-common/models/view/passwordHistoryView";
|
||||||
|
|
||||||
@Directive()
|
@Directive()
|
||||||
export class PasswordHistoryComponent implements OnInit {
|
export class PasswordHistoryComponent implements OnInit {
|
||||||
cipherId: string;
|
cipherId: string;
|
||||||
history: PasswordHistoryView[] = [];
|
history: PasswordHistoryView[] = [];
|
||||||
|
|
||||||
constructor(protected cipherService: CipherService, protected platformUtilsService: PlatformUtilsService,
|
constructor(
|
||||||
protected i18nService: I18nService, private win: Window) { }
|
protected cipherService: CipherService,
|
||||||
|
protected platformUtilsService: PlatformUtilsService,
|
||||||
|
protected i18nService: I18nService,
|
||||||
|
private win: Window
|
||||||
|
) {}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
await this.init();
|
await this.init();
|
||||||
@@ -21,8 +25,11 @@ export class PasswordHistoryComponent implements OnInit {
|
|||||||
copy(password: string) {
|
copy(password: string) {
|
||||||
const copyOptions = this.win != null ? { window: this.win } : null;
|
const copyOptions = this.win != null ? { window: this.win } : null;
|
||||||
this.platformUtilsService.copyToClipboard(password, copyOptions);
|
this.platformUtilsService.copyToClipboard(password, copyOptions);
|
||||||
this.platformUtilsService.showToast('info', null,
|
this.platformUtilsService.showToast(
|
||||||
this.i18nService.t('valueCopied', this.i18nService.t('password')));
|
"info",
|
||||||
|
null,
|
||||||
|
this.i18nService.t("valueCopied", this.i18nService.t("password"))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async init() {
|
protected async init() {
|
||||||
|
|||||||
@@ -1,27 +1,33 @@
|
|||||||
import { Directive } from '@angular/core';
|
import { Directive } from "@angular/core";
|
||||||
|
|
||||||
import { CryptoService } from 'jslib-common/abstractions/crypto.service';
|
import { CryptoService } from "jslib-common/abstractions/crypto.service";
|
||||||
import { I18nService } from 'jslib-common/abstractions/i18n.service';
|
import { I18nService } from "jslib-common/abstractions/i18n.service";
|
||||||
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.service";
|
||||||
import { ModalRef } from './modal/modal.ref';
|
import { ModalRef } from "./modal/modal.ref";
|
||||||
|
|
||||||
@Directive()
|
@Directive()
|
||||||
export class PasswordRepromptComponent {
|
export class PasswordRepromptComponent {
|
||||||
|
|
||||||
showPassword = false;
|
showPassword = false;
|
||||||
masterPassword = '';
|
masterPassword = "";
|
||||||
|
|
||||||
constructor(private modalRef: ModalRef, private cryptoService: CryptoService, private platformUtilsService: PlatformUtilsService,
|
constructor(
|
||||||
private i18nService: I18nService) {}
|
private modalRef: ModalRef,
|
||||||
|
private cryptoService: CryptoService,
|
||||||
|
private platformUtilsService: PlatformUtilsService,
|
||||||
|
private i18nService: I18nService
|
||||||
|
) {}
|
||||||
|
|
||||||
togglePassword() {
|
togglePassword() {
|
||||||
this.showPassword = !this.showPassword;
|
this.showPassword = !this.showPassword;
|
||||||
}
|
}
|
||||||
|
|
||||||
async submit() {
|
async submit() {
|
||||||
if (!await this.cryptoService.compareAndUpdateKeyHash(this.masterPassword, null)) {
|
if (!(await this.cryptoService.compareAndUpdateKeyHash(this.masterPassword, null))) {
|
||||||
this.platformUtilsService.showToast('error', this.i18nService.t('errorOccurred'),
|
this.platformUtilsService.showToast(
|
||||||
this.i18nService.t('invalidMasterPassword'));
|
"error",
|
||||||
|
this.i18nService.t("errorOccurred"),
|
||||||
|
this.i18nService.t("invalidMasterPassword")
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,34 +1,28 @@
|
|||||||
import { DatePipe } from '@angular/common';
|
import { DatePipe } from "@angular/common";
|
||||||
import {
|
import { Directive, EventEmitter, Input, OnInit, Output } from "@angular/core";
|
||||||
Directive,
|
import { FormControl, FormGroup } from "@angular/forms";
|
||||||
EventEmitter,
|
|
||||||
Input,
|
|
||||||
OnInit,
|
|
||||||
Output
|
|
||||||
} from '@angular/core';
|
|
||||||
import { FormControl, FormGroup } from '@angular/forms';
|
|
||||||
|
|
||||||
import { I18nService } from 'jslib-common/abstractions/i18n.service';
|
import { I18nService } from "jslib-common/abstractions/i18n.service";
|
||||||
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.service";
|
||||||
|
|
||||||
// Different BrowserPath = different controls.
|
// Different BrowserPath = different controls.
|
||||||
enum BrowserPath {
|
enum BrowserPath {
|
||||||
// Native datetime-locale.
|
// Native datetime-locale.
|
||||||
// We are happy.
|
// We are happy.
|
||||||
Default = 'default',
|
Default = "default",
|
||||||
|
|
||||||
// Native date and time inputs, but no datetime-locale.
|
// Native date and time inputs, but no datetime-locale.
|
||||||
// We use individual date and time inputs and create a datetime programatically on submit.
|
// We use individual date and time inputs and create a datetime programatically on submit.
|
||||||
Firefox = 'firefox',
|
Firefox = "firefox",
|
||||||
|
|
||||||
// No native date, time, or datetime-locale inputs.
|
// No native date, time, or datetime-locale inputs.
|
||||||
// We use a polyfill for dates and a dropdown for times.
|
// We use a polyfill for dates and a dropdown for times.
|
||||||
Safari = 'safari',
|
Safari = "safari",
|
||||||
}
|
}
|
||||||
|
|
||||||
enum DateField {
|
enum DateField {
|
||||||
DeletionDate = 'deletion',
|
DeletionDate = "deletion",
|
||||||
ExpriationDate = 'expiration',
|
ExpriationDate = "expiration",
|
||||||
}
|
}
|
||||||
|
|
||||||
// Value = hours
|
// Value = hours
|
||||||
@@ -57,7 +51,7 @@ export class EffluxDatesComponent implements OnInit {
|
|||||||
@Input() readonly editMode: boolean;
|
@Input() readonly editMode: boolean;
|
||||||
@Input() readonly disabled: boolean;
|
@Input() readonly disabled: boolean;
|
||||||
|
|
||||||
@Output() datesChanged = new EventEmitter<{deletionDate: string, expirationDate: string}>();
|
@Output() datesChanged = new EventEmitter<{ deletionDate: string; expirationDate: string }>();
|
||||||
|
|
||||||
get browserPath(): BrowserPath {
|
get browserPath(): BrowserPath {
|
||||||
if (this.platformUtilsService.isFirefox()) {
|
if (this.platformUtilsService.isFirefox()) {
|
||||||
@@ -80,49 +74,49 @@ export class EffluxDatesComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
|
|
||||||
deletionDatePresets: any[] = [
|
deletionDatePresets: any[] = [
|
||||||
{ name: this.i18nService.t('oneHour'), value: DatePreset.OneHour },
|
{ name: this.i18nService.t("oneHour"), value: DatePreset.OneHour },
|
||||||
{ name: this.i18nService.t('oneDay'), value: DatePreset.OneDay },
|
{ name: this.i18nService.t("oneDay"), value: DatePreset.OneDay },
|
||||||
{ name: this.i18nService.t('days', '2'), value: DatePreset.TwoDays },
|
{ name: this.i18nService.t("days", "2"), value: DatePreset.TwoDays },
|
||||||
{ name: this.i18nService.t('days', '3'), value: DatePreset.ThreeDays },
|
{ name: this.i18nService.t("days", "3"), value: DatePreset.ThreeDays },
|
||||||
{ name: this.i18nService.t('days', '7'), value: DatePreset.SevenDays },
|
{ name: this.i18nService.t("days", "7"), value: DatePreset.SevenDays },
|
||||||
{ name: this.i18nService.t('days', '30'), value: DatePreset.ThirtyDays },
|
{ name: this.i18nService.t("days", "30"), value: DatePreset.ThirtyDays },
|
||||||
{ name: this.i18nService.t('custom'), value: DatePreset.Custom },
|
{ name: this.i18nService.t("custom"), value: DatePreset.Custom },
|
||||||
];
|
];
|
||||||
|
|
||||||
expirationDatePresets: any[] = [
|
expirationDatePresets: any[] = [
|
||||||
{ name: this.i18nService.t('never'), value: DatePreset.Never },
|
{ name: this.i18nService.t("never"), value: DatePreset.Never },
|
||||||
].concat([...this.deletionDatePresets]);
|
].concat([...this.deletionDatePresets]);
|
||||||
|
|
||||||
get selectedDeletionDatePreset(): FormControl {
|
get selectedDeletionDatePreset(): FormControl {
|
||||||
return this.datesForm.get('selectedDeletionDatePreset') as FormControl;
|
return this.datesForm.get("selectedDeletionDatePreset") as FormControl;
|
||||||
}
|
}
|
||||||
|
|
||||||
get selectedExpirationDatePreset(): FormControl {
|
get selectedExpirationDatePreset(): FormControl {
|
||||||
return this.datesForm.get('selectedExpirationDatePreset') as FormControl;
|
return this.datesForm.get("selectedExpirationDatePreset") as FormControl;
|
||||||
}
|
}
|
||||||
|
|
||||||
get defaultDeletionDateTime(): FormControl {
|
get defaultDeletionDateTime(): FormControl {
|
||||||
return this.datesForm.get('defaultDeletionDateTime') as FormControl;
|
return this.datesForm.get("defaultDeletionDateTime") as FormControl;
|
||||||
}
|
}
|
||||||
|
|
||||||
get defaultExpirationDateTime(): FormControl {
|
get defaultExpirationDateTime(): FormControl {
|
||||||
return this.datesForm.get('defaultExpirationDateTime') as FormControl;
|
return this.datesForm.get("defaultExpirationDateTime") as FormControl;
|
||||||
}
|
}
|
||||||
|
|
||||||
get fallbackDeletionDate(): FormControl {
|
get fallbackDeletionDate(): FormControl {
|
||||||
return this.datesForm.get('fallbackDeletionDate') as FormControl;
|
return this.datesForm.get("fallbackDeletionDate") as FormControl;
|
||||||
}
|
}
|
||||||
|
|
||||||
get fallbackDeletionTime(): FormControl {
|
get fallbackDeletionTime(): FormControl {
|
||||||
return this.datesForm.get('fallbackDeletionTime') as FormControl;
|
return this.datesForm.get("fallbackDeletionTime") as FormControl;
|
||||||
}
|
}
|
||||||
|
|
||||||
get fallbackExpirationDate(): FormControl {
|
get fallbackExpirationDate(): FormControl {
|
||||||
return this.datesForm.get('fallbackExpirationDate') as FormControl;
|
return this.datesForm.get("fallbackExpirationDate") as FormControl;
|
||||||
}
|
}
|
||||||
|
|
||||||
get fallbackExpirationTime(): FormControl {
|
get fallbackExpirationTime(): FormControl {
|
||||||
return this.datesForm.get('fallbackExpirationTime') as FormControl;
|
return this.datesForm.get("fallbackExpirationTime") as FormControl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Should be able to call these at any time and compute a submitable value
|
// Should be able to call these at any time and compute a submitable value
|
||||||
@@ -135,14 +129,15 @@ export class EffluxDatesComponent implements OnInit {
|
|||||||
switch (this.browserPath) {
|
switch (this.browserPath) {
|
||||||
case BrowserPath.Safari:
|
case BrowserPath.Safari:
|
||||||
case BrowserPath.Firefox:
|
case BrowserPath.Firefox:
|
||||||
return this.fallbackDeletionDate.value + 'T' + this.fallbackDeletionTime.value;
|
return this.fallbackDeletionDate.value + "T" + this.fallbackDeletionTime.value;
|
||||||
default:
|
default:
|
||||||
return this.defaultDeletionDateTime.value;
|
return this.defaultDeletionDateTime.value;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
const miliseconds = now.setTime(now.getTime() +
|
const miliseconds = now.setTime(
|
||||||
(this.selectedDeletionDatePreset.value as number * 60 * 60 * 1000)) ;
|
now.getTime() + (this.selectedDeletionDatePreset.value as number) * 60 * 60 * 1000
|
||||||
|
);
|
||||||
return new Date(miliseconds).toString();
|
return new Date(miliseconds).toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -155,11 +150,13 @@ export class EffluxDatesComponent implements OnInit {
|
|||||||
switch (this.browserPath) {
|
switch (this.browserPath) {
|
||||||
case BrowserPath.Safari:
|
case BrowserPath.Safari:
|
||||||
case BrowserPath.Firefox:
|
case BrowserPath.Firefox:
|
||||||
if ((!this.fallbackExpirationDate.value || !this.fallbackExpirationTime.value) &&
|
if (
|
||||||
this.editMode) {
|
(!this.fallbackExpirationDate.value || !this.fallbackExpirationTime.value) &&
|
||||||
|
this.editMode
|
||||||
|
) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return this.fallbackExpirationDate.value + 'T' + this.fallbackExpirationTime.value;
|
return this.fallbackExpirationDate.value + "T" + this.fallbackExpirationTime.value;
|
||||||
default:
|
default:
|
||||||
if (!this.defaultExpirationDateTime.value) {
|
if (!this.defaultExpirationDateTime.value) {
|
||||||
return null;
|
return null;
|
||||||
@@ -168,8 +165,9 @@ export class EffluxDatesComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
const miliseconds = now.setTime(now.getTime() +
|
const miliseconds = now.setTime(
|
||||||
(this.selectedExpirationDatePreset.value as number * 60 * 60 * 1000));
|
now.getTime() + (this.selectedExpirationDatePreset.value as number) * 60 * 60 * 1000
|
||||||
|
);
|
||||||
return new Date(miliseconds).toString();
|
return new Date(miliseconds).toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -189,9 +187,11 @@ export class EffluxDatesComponent implements OnInit {
|
|||||||
return nextWeek;
|
return nextWeek;
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(protected i18nService: I18nService, protected platformUtilsService: PlatformUtilsService,
|
constructor(
|
||||||
protected datePipe: DatePipe) {
|
protected i18nService: I18nService,
|
||||||
}
|
protected platformUtilsService: PlatformUtilsService,
|
||||||
|
protected datePipe: DatePipe
|
||||||
|
) {}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.setInitialFormValues();
|
this.setInitialFormValues();
|
||||||
@@ -235,16 +235,23 @@ export class EffluxDatesComponent implements OnInit {
|
|||||||
this.fallbackDeletionDate.setValue(this.initialDeletionDate.toISOString().slice(0, 10));
|
this.fallbackDeletionDate.setValue(this.initialDeletionDate.toISOString().slice(0, 10));
|
||||||
this.fallbackDeletionTime.setValue(this.initialDeletionDate.toTimeString().slice(0, 5));
|
this.fallbackDeletionTime.setValue(this.initialDeletionDate.toTimeString().slice(0, 5));
|
||||||
if (this.initialExpirationDate != null) {
|
if (this.initialExpirationDate != null) {
|
||||||
this.fallbackExpirationDate.setValue(this.initialExpirationDate.toISOString().slice(0, 10));
|
this.fallbackExpirationDate.setValue(
|
||||||
this.fallbackExpirationTime.setValue(this.initialExpirationDate.toTimeString().slice(0, 5));
|
this.initialExpirationDate.toISOString().slice(0, 10)
|
||||||
|
);
|
||||||
|
this.fallbackExpirationTime.setValue(
|
||||||
|
this.initialExpirationDate.toTimeString().slice(0, 5)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case BrowserPath.Default:
|
case BrowserPath.Default:
|
||||||
if (this.initialExpirationDate) {
|
if (this.initialExpirationDate) {
|
||||||
this.defaultExpirationDateTime.setValue(
|
this.defaultExpirationDateTime.setValue(
|
||||||
this.datePipe.transform(new Date(this.initialExpirationDate), 'yyyy-MM-ddTHH:mm'));
|
this.datePipe.transform(new Date(this.initialExpirationDate), "yyyy-MM-ddTHH:mm")
|
||||||
|
);
|
||||||
}
|
}
|
||||||
this.defaultDeletionDateTime.setValue(this.datePipe.transform(new Date(this.initialDeletionDate), 'yyyy-MM-ddTHH:mm'));
|
this.defaultDeletionDateTime.setValue(
|
||||||
|
this.datePipe.transform(new Date(this.initialDeletionDate), "yyyy-MM-ddTHH:mm")
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -254,7 +261,9 @@ export class EffluxDatesComponent implements OnInit {
|
|||||||
switch (this.browserPath) {
|
switch (this.browserPath) {
|
||||||
case BrowserPath.Safari:
|
case BrowserPath.Safari:
|
||||||
this.fallbackDeletionDate.setValue(this.nextWeek.toISOString().slice(0, 10));
|
this.fallbackDeletionDate.setValue(this.nextWeek.toISOString().slice(0, 10));
|
||||||
this.fallbackDeletionTime.setValue(this.safariTimePresetOptions(DateField.DeletionDate)[1].twentyFourHour);
|
this.fallbackDeletionTime.setValue(
|
||||||
|
this.safariTimePresetOptions(DateField.DeletionDate)[1].twentyFourHour
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -282,10 +291,10 @@ export class EffluxDatesComponent implements OnInit {
|
|||||||
|
|
||||||
// add prepending 0s to single digit hours/minutes
|
// add prepending 0s to single digit hours/minutes
|
||||||
if (h < 10) {
|
if (h < 10) {
|
||||||
hour = '0' + hour;
|
hour = "0" + hour;
|
||||||
}
|
}
|
||||||
if (m < 10) {
|
if (m < 10) {
|
||||||
minutes = '0' + minutes;
|
minutes = "0" + minutes;
|
||||||
}
|
}
|
||||||
|
|
||||||
// build time strings and push to relevant sort groups
|
// build time strings and push to relevant sort groups
|
||||||
@@ -324,14 +333,18 @@ export class EffluxDatesComponent implements OnInit {
|
|||||||
// example: if the Send was created with a different client
|
// example: if the Send was created with a different client
|
||||||
if (field === DateField.ExpriationDate && this.initialExpirationDate != null && this.editMode) {
|
if (field === DateField.ExpriationDate && this.initialExpirationDate != null && this.editMode) {
|
||||||
const previousValue: TimeOption = {
|
const previousValue: TimeOption = {
|
||||||
twelveHour: this.datePipe.transform(this.initialExpirationDate, 'hh:mm a'),
|
twelveHour: this.datePipe.transform(this.initialExpirationDate, "hh:mm a"),
|
||||||
twentyFourHour: this.datePipe.transform(this.initialExpirationDate, 'HH:mm'),
|
twentyFourHour: this.datePipe.transform(this.initialExpirationDate, "HH:mm"),
|
||||||
};
|
};
|
||||||
return [previousValue, { twelveHour: null, twentyFourHour: null }, ...validTimes];
|
return [previousValue, { twelveHour: null, twentyFourHour: null }, ...validTimes];
|
||||||
} else if (field === DateField.DeletionDate && this.initialDeletionDate != null && this.editMode) {
|
} else if (
|
||||||
|
field === DateField.DeletionDate &&
|
||||||
|
this.initialDeletionDate != null &&
|
||||||
|
this.editMode
|
||||||
|
) {
|
||||||
const previousValue: TimeOption = {
|
const previousValue: TimeOption = {
|
||||||
twelveHour: this.datePipe.transform(this.initialDeletionDate, 'hh:mm a'),
|
twelveHour: this.datePipe.transform(this.initialDeletionDate, "hh:mm a"),
|
||||||
twentyFourHour: this.datePipe.transform(this.initialDeletionDate, 'HH:mm'),
|
twentyFourHour: this.datePipe.transform(this.initialDeletionDate, "HH:mm"),
|
||||||
};
|
};
|
||||||
return [previousValue, ...validTimes];
|
return [previousValue, ...validTimes];
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1,27 +1,22 @@
|
|||||||
import {
|
import { Directive, Input, OnInit } from "@angular/core";
|
||||||
Directive,
|
|
||||||
Input,
|
|
||||||
OnInit,
|
|
||||||
} from '@angular/core';
|
|
||||||
import {
|
import {
|
||||||
AbstractControl,
|
AbstractControl,
|
||||||
ControlValueAccessor,
|
ControlValueAccessor,
|
||||||
FormBuilder,
|
FormBuilder,
|
||||||
ValidationErrors,
|
ValidationErrors,
|
||||||
Validator
|
Validator,
|
||||||
} from '@angular/forms';
|
} from "@angular/forms";
|
||||||
|
|
||||||
import { I18nService } from 'jslib-common/abstractions/i18n.service';
|
import { I18nService } from "jslib-common/abstractions/i18n.service";
|
||||||
import { PolicyService } from 'jslib-common/abstractions/policy.service';
|
import { PolicyService } from "jslib-common/abstractions/policy.service";
|
||||||
|
|
||||||
import { PolicyType } from 'jslib-common/enums/policyType';
|
import { PolicyType } from "jslib-common/enums/policyType";
|
||||||
import { Policy } from 'jslib-common/models/domain/policy';
|
import { Policy } from "jslib-common/models/domain/policy";
|
||||||
|
|
||||||
@Directive()
|
@Directive()
|
||||||
export class VaultTimeoutInputComponent implements ControlValueAccessor, Validator, OnInit {
|
export class VaultTimeoutInputComponent implements ControlValueAccessor, Validator, OnInit {
|
||||||
|
|
||||||
get showCustom() {
|
get showCustom() {
|
||||||
return this.form.get('vaultTimeout').value === VaultTimeoutInputComponent.CUSTOM_VALUE;
|
return this.form.get("vaultTimeout").value === VaultTimeoutInputComponent.CUSTOM_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static CUSTOM_VALUE = -100;
|
static CUSTOM_VALUE = -100;
|
||||||
@@ -34,7 +29,7 @@ export class VaultTimeoutInputComponent implements ControlValueAccessor, Validat
|
|||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
@Input() vaultTimeouts: { name: string; value: number; }[];
|
@Input() vaultTimeouts: { name: string; value: number }[];
|
||||||
vaultTimeoutPolicy: Policy;
|
vaultTimeoutPolicy: Policy;
|
||||||
vaultTimeoutPolicyHours: number;
|
vaultTimeoutPolicyHours: number;
|
||||||
vaultTimeoutPolicyMinutes: number;
|
vaultTimeoutPolicyMinutes: number;
|
||||||
@@ -42,8 +37,11 @@ export class VaultTimeoutInputComponent implements ControlValueAccessor, Validat
|
|||||||
private onChange: (vaultTimeout: number) => void;
|
private onChange: (vaultTimeout: number) => void;
|
||||||
private validatorChange: () => void;
|
private validatorChange: () => void;
|
||||||
|
|
||||||
constructor(private fb: FormBuilder, private policyService: PolicyService, private i18nService: I18nService) {
|
constructor(
|
||||||
}
|
private fb: FormBuilder,
|
||||||
|
private policyService: PolicyService,
|
||||||
|
private i18nService: I18nService
|
||||||
|
) {}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
if (await this.policyService.policyAppliesToUser(PolicyType.MaximumVaultTimeout)) {
|
if (await this.policyService.policyAppliesToUser(PolicyType.MaximumVaultTimeout)) {
|
||||||
@@ -53,7 +51,8 @@ export class VaultTimeoutInputComponent implements ControlValueAccessor, Validat
|
|||||||
this.vaultTimeoutPolicyHours = Math.floor(this.vaultTimeoutPolicy.data.minutes / 60);
|
this.vaultTimeoutPolicyHours = Math.floor(this.vaultTimeoutPolicy.data.minutes / 60);
|
||||||
this.vaultTimeoutPolicyMinutes = this.vaultTimeoutPolicy.data.minutes % 60;
|
this.vaultTimeoutPolicyMinutes = this.vaultTimeoutPolicy.data.minutes % 60;
|
||||||
|
|
||||||
this.vaultTimeouts = this.vaultTimeouts.filter(t =>
|
this.vaultTimeouts = this.vaultTimeouts.filter(
|
||||||
|
(t) =>
|
||||||
t.value <= this.vaultTimeoutPolicy.data.minutes &&
|
t.value <= this.vaultTimeoutPolicy.data.minutes &&
|
||||||
(t.value > 0 || t.value === VaultTimeoutInputComponent.CUSTOM_VALUE) &&
|
(t.value > 0 || t.value === VaultTimeoutInputComponent.CUSTOM_VALUE) &&
|
||||||
t.value != null
|
t.value != null
|
||||||
@@ -61,12 +60,12 @@ export class VaultTimeoutInputComponent implements ControlValueAccessor, Validat
|
|||||||
this.validatorChange();
|
this.validatorChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.form.valueChanges.subscribe(async value => {
|
this.form.valueChanges.subscribe(async (value) => {
|
||||||
this.onChange(this.getVaultTimeout(value));
|
this.onChange(this.getVaultTimeout(value));
|
||||||
});
|
});
|
||||||
|
|
||||||
// Assign the previous value to the custom fields
|
// Assign the previous value to the custom fields
|
||||||
this.form.get('vaultTimeout').valueChanges.subscribe(value => {
|
this.form.get("vaultTimeout").valueChanges.subscribe((value) => {
|
||||||
if (value !== VaultTimeoutInputComponent.CUSTOM_VALUE) {
|
if (value !== VaultTimeoutInputComponent.CUSTOM_VALUE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -82,7 +81,10 @@ export class VaultTimeoutInputComponent implements ControlValueAccessor, Validat
|
|||||||
}
|
}
|
||||||
|
|
||||||
ngOnChanges() {
|
ngOnChanges() {
|
||||||
this.vaultTimeouts.push({ name: this.i18nService.t('custom'), value: VaultTimeoutInputComponent.CUSTOM_VALUE });
|
this.vaultTimeouts.push({
|
||||||
|
name: this.i18nService.t("custom"),
|
||||||
|
value: VaultTimeoutInputComponent.CUSTOM_VALUE,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getVaultTimeout(value: any) {
|
getVaultTimeout(value: any) {
|
||||||
@@ -98,7 +100,7 @@ export class VaultTimeoutInputComponent implements ControlValueAccessor, Validat
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.vaultTimeouts.every(p => p.value !== value)) {
|
if (this.vaultTimeouts.every((p) => p.value !== value)) {
|
||||||
this.form.setValue({
|
this.form.setValue({
|
||||||
vaultTimeout: VaultTimeoutInputComponent.CUSTOM_VALUE,
|
vaultTimeout: VaultTimeoutInputComponent.CUSTOM_VALUE,
|
||||||
custom: {
|
custom: {
|
||||||
|
|||||||
@@ -1,16 +1,11 @@
|
|||||||
import {
|
import { Directive, EventEmitter, OnInit, Output } from "@angular/core";
|
||||||
Directive,
|
import { Router } from "@angular/router";
|
||||||
EventEmitter,
|
|
||||||
OnInit,
|
|
||||||
Output,
|
|
||||||
} from '@angular/core';
|
|
||||||
import { Router } from '@angular/router';
|
|
||||||
|
|
||||||
import { TwoFactorProviderType } from 'jslib-common/enums/twoFactorProviderType';
|
import { TwoFactorProviderType } from "jslib-common/enums/twoFactorProviderType";
|
||||||
|
|
||||||
import { AuthService } from 'jslib-common/abstractions/auth.service';
|
import { AuthService } from "jslib-common/abstractions/auth.service";
|
||||||
import { I18nService } from 'jslib-common/abstractions/i18n.service';
|
import { I18nService } from "jslib-common/abstractions/i18n.service";
|
||||||
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.service";
|
||||||
|
|
||||||
@Directive()
|
@Directive()
|
||||||
export class TwoFactorOptionsComponent implements OnInit {
|
export class TwoFactorOptionsComponent implements OnInit {
|
||||||
@@ -19,9 +14,13 @@ export class TwoFactorOptionsComponent implements OnInit {
|
|||||||
|
|
||||||
providers: any[] = [];
|
providers: any[] = [];
|
||||||
|
|
||||||
constructor(protected authService: AuthService, protected router: Router,
|
constructor(
|
||||||
protected i18nService: I18nService, protected platformUtilsService: PlatformUtilsService,
|
protected authService: AuthService,
|
||||||
protected win: Window) { }
|
protected router: Router,
|
||||||
|
protected i18nService: I18nService,
|
||||||
|
protected platformUtilsService: PlatformUtilsService,
|
||||||
|
protected win: Window
|
||||||
|
) {}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.providers = this.authService.getSupportedTwoFactorProviders(this.win);
|
this.providers = this.authService.getSupportedTwoFactorProviders(this.win);
|
||||||
@@ -32,7 +31,7 @@ export class TwoFactorOptionsComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
recover() {
|
recover() {
|
||||||
this.platformUtilsService.launchUri('https://help.bitwarden.com/article/lost-two-step-device/');
|
this.platformUtilsService.launchUri("https://help.bitwarden.com/article/lost-two-step-device/");
|
||||||
this.onRecoverSelected.emit();
|
this.onRecoverSelected.emit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,25 +1,46 @@
|
|||||||
<ng-container *ngIf="!usesKeyConnector">
|
<ng-container *ngIf="!usesKeyConnector">
|
||||||
<label for="masterPassword">{{'masterPass' | i18n}}</label>
|
<label for="masterPassword">{{ "masterPass" | i18n }}</label>
|
||||||
<input id="masterPassword" type="password" name="MasterPasswordHash" class="form-control"
|
<input
|
||||||
[formControl]="secret" required appAutofocus appInputVerbatim>
|
id="masterPassword"
|
||||||
<small class="form-text text-muted">{{'confirmIdentity' | i18n}}</small>
|
type="password"
|
||||||
|
name="MasterPasswordHash"
|
||||||
|
class="form-control"
|
||||||
|
[formControl]="secret"
|
||||||
|
required
|
||||||
|
appAutofocus
|
||||||
|
appInputVerbatim
|
||||||
|
/>
|
||||||
|
<small class="form-text text-muted">{{ "confirmIdentity" | i18n }}</small>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
<ng-container *ngIf="usesKeyConnector">
|
<ng-container *ngIf="usesKeyConnector">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="d-block">{{'sendVerificationCode' | i18n}}</label>
|
<label class="d-block">{{ "sendVerificationCode" | i18n }}</label>
|
||||||
<button type="button" class="btn btn-outline-secondary" (click)="requestOTP()" [disabled]="disableRequestOTP">
|
<button
|
||||||
{{'sendCode' | i18n}}
|
type="button"
|
||||||
|
class="btn btn-outline-secondary"
|
||||||
|
(click)="requestOTP()"
|
||||||
|
[disabled]="disableRequestOTP"
|
||||||
|
>
|
||||||
|
{{ "sendCode" | i18n }}
|
||||||
</button>
|
</button>
|
||||||
<span class="ml-2 text-success" role="alert" @sent *ngIf="sentCode">
|
<span class="ml-2 text-success" role="alert" @sent *ngIf="sentCode">
|
||||||
<i class="fa fa-check-circle-o" aria-hidden="true"></i>
|
<i class="fa fa-check-circle-o" aria-hidden="true"></i>
|
||||||
{{'codeSent' | i18n}}
|
{{ "codeSent" | i18n }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="verificationCode">{{'verificationCode' | i18n}}</label>
|
<label for="verificationCode">{{ "verificationCode" | i18n }}</label>
|
||||||
<input id="verificationCode" type="input" name="verificationCode" class="form-control"
|
<input
|
||||||
[formControl]="secret" required appAutofocus appInputVerbatim>
|
id="verificationCode"
|
||||||
<small class="form-text text-muted">{{'confirmIdentity' | i18n}}</small>
|
type="input"
|
||||||
|
name="verificationCode"
|
||||||
|
class="form-control"
|
||||||
|
[formControl]="secret"
|
||||||
|
required
|
||||||
|
appAutofocus
|
||||||
|
appInputVerbatim
|
||||||
|
/>
|
||||||
|
<small class="form-text text-muted">{{ "confirmIdentity" | i18n }}</small>
|
||||||
</div>
|
</div>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|||||||
@@ -1,29 +1,17 @@
|
|||||||
import {
|
import { animate, style, transition, trigger } from "@angular/animations";
|
||||||
animate,
|
import { Component, OnInit } from "@angular/core";
|
||||||
style,
|
import { ControlValueAccessor, FormControl, NG_VALUE_ACCESSOR } from "@angular/forms";
|
||||||
transition,
|
|
||||||
trigger,
|
|
||||||
} from '@angular/animations';
|
|
||||||
import {
|
|
||||||
Component,
|
|
||||||
OnInit,
|
|
||||||
} from '@angular/core';
|
|
||||||
import {
|
|
||||||
ControlValueAccessor,
|
|
||||||
FormControl,
|
|
||||||
NG_VALUE_ACCESSOR,
|
|
||||||
} from '@angular/forms';
|
|
||||||
|
|
||||||
import { KeyConnectorService } from 'jslib-common/abstractions/keyConnector.service';
|
import { KeyConnectorService } from "jslib-common/abstractions/keyConnector.service";
|
||||||
import { UserVerificationService } from 'jslib-common/abstractions/userVerification.service';
|
import { UserVerificationService } from "jslib-common/abstractions/userVerification.service";
|
||||||
|
|
||||||
import { VerificationType } from 'jslib-common/enums/verificationType';
|
import { VerificationType } from "jslib-common/enums/verificationType";
|
||||||
|
|
||||||
import { Verification } from 'jslib-common/types/verification';
|
import { Verification } from "jslib-common/types/verification";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-verify-master-password',
|
selector: "app-verify-master-password",
|
||||||
templateUrl: 'verify-master-password.component.html',
|
templateUrl: "verify-master-password.component.html",
|
||||||
providers: [
|
providers: [
|
||||||
{
|
{
|
||||||
provide: NG_VALUE_ACCESSOR,
|
provide: NG_VALUE_ACCESSOR,
|
||||||
@@ -32,11 +20,8 @@ import { Verification } from 'jslib-common/types/verification';
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
animations: [
|
animations: [
|
||||||
trigger('sent', [
|
trigger("sent", [
|
||||||
transition(':enter', [
|
transition(":enter", [style({ opacity: 0 }), animate("100ms", style({ opacity: 1 }))]),
|
||||||
style({ opacity: 0 }),
|
|
||||||
animate('100ms', style({ opacity: 1 })),
|
|
||||||
]),
|
|
||||||
]),
|
]),
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
@@ -45,18 +30,20 @@ export class VerifyMasterPasswordComponent implements ControlValueAccessor, OnIn
|
|||||||
disableRequestOTP: boolean = false;
|
disableRequestOTP: boolean = false;
|
||||||
sentCode: boolean = false;
|
sentCode: boolean = false;
|
||||||
|
|
||||||
secret = new FormControl('');
|
secret = new FormControl("");
|
||||||
|
|
||||||
private onChange: (value: Verification) => void;
|
private onChange: (value: Verification) => void;
|
||||||
|
|
||||||
constructor(private keyConnectorService: KeyConnectorService,
|
constructor(
|
||||||
private userVerificationService: UserVerificationService) { }
|
private keyConnectorService: KeyConnectorService,
|
||||||
|
private userVerificationService: UserVerificationService
|
||||||
|
) {}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
this.usesKeyConnector = await this.keyConnectorService.getUsesKeyConnector();
|
this.usesKeyConnector = await this.keyConnectorService.getUsesKeyConnector();
|
||||||
this.processChanges(this.secret.value);
|
this.processChanges(this.secret.value);
|
||||||
|
|
||||||
this.secret.valueChanges.subscribe(secret => this.processChanges(secret));
|
this.secret.valueChanges.subscribe((secret) => this.processChanges(secret));
|
||||||
}
|
}
|
||||||
|
|
||||||
async requestOTP() {
|
async requestOTP() {
|
||||||
|
|||||||
@@ -1,15 +1,12 @@
|
|||||||
import {
|
import { Directive, Input } from "@angular/core";
|
||||||
Directive,
|
|
||||||
Input,
|
|
||||||
} from '@angular/core';
|
|
||||||
|
|
||||||
import { EventType } from 'jslib-common/enums/eventType';
|
import { EventType } from "jslib-common/enums/eventType";
|
||||||
import { FieldType } from 'jslib-common/enums/fieldType';
|
import { FieldType } from "jslib-common/enums/fieldType";
|
||||||
|
|
||||||
import { EventService } from 'jslib-common/abstractions/event.service';
|
import { EventService } from "jslib-common/abstractions/event.service";
|
||||||
|
|
||||||
import { CipherView } from 'jslib-common/models/view/cipherView';
|
import { CipherView } from "jslib-common/models/view/cipherView";
|
||||||
import { FieldView } from 'jslib-common/models/view/fieldView';
|
import { FieldView } from "jslib-common/models/view/fieldView";
|
||||||
|
|
||||||
@Directive()
|
@Directive()
|
||||||
export class ViewCustomFieldsComponent {
|
export class ViewCustomFieldsComponent {
|
||||||
@@ -22,11 +19,11 @@ export class ViewCustomFieldsComponent {
|
|||||||
constructor(private eventService: EventService) {}
|
constructor(private eventService: EventService) {}
|
||||||
|
|
||||||
async toggleFieldValue(field: FieldView) {
|
async toggleFieldValue(field: FieldView) {
|
||||||
if (!await this.promptPassword()) {
|
if (!(await this.promptPassword())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const f = (field as any);
|
const f = field as any;
|
||||||
f.showValue = !f.showValue;
|
f.showValue = !f.showValue;
|
||||||
if (f.showValue) {
|
if (f.showValue) {
|
||||||
this.eventService.collect(EventType.Cipher_ClientToggledHiddenFieldVisible, this.cipher.id);
|
this.eventService.collect(EventType.Cipher_ClientToggledHiddenFieldVisible, this.cipher.id);
|
||||||
|
|||||||
@@ -1,12 +1,7 @@
|
|||||||
import {
|
import { Directive, ElementRef, Input, Renderer2 } from "@angular/core";
|
||||||
Directive,
|
|
||||||
ElementRef,
|
|
||||||
Input,
|
|
||||||
Renderer2,
|
|
||||||
} from '@angular/core';
|
|
||||||
|
|
||||||
@Directive({
|
@Directive({
|
||||||
selector: '[appA11yTitle]',
|
selector: "[appA11yTitle]",
|
||||||
})
|
})
|
||||||
export class A11yTitleDirective {
|
export class A11yTitleDirective {
|
||||||
@Input() set appA11yTitle(title: string) {
|
@Input() set appA11yTitle(title: string) {
|
||||||
@@ -18,11 +13,11 @@ export class A11yTitleDirective {
|
|||||||
constructor(private el: ElementRef, private renderer: Renderer2) {}
|
constructor(private el: ElementRef, private renderer: Renderer2) {}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
if (!this.el.nativeElement.hasAttribute('title')) {
|
if (!this.el.nativeElement.hasAttribute("title")) {
|
||||||
this.renderer.setAttribute(this.el.nativeElement, 'title', this.title);
|
this.renderer.setAttribute(this.el.nativeElement, "title", this.title);
|
||||||
}
|
}
|
||||||
if (!this.el.nativeElement.hasAttribute('aria-label')) {
|
if (!this.el.nativeElement.hasAttribute("aria-label")) {
|
||||||
this.renderer.setAttribute(this.el.nativeElement, 'aria-label', this.title);
|
this.renderer.setAttribute(this.el.nativeElement, "aria-label", this.title);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,23 +1,21 @@
|
|||||||
import {
|
import { Directive, ElementRef, Input, OnChanges } from "@angular/core";
|
||||||
Directive,
|
import { LogService } from "jslib-common/abstractions/log.service";
|
||||||
ElementRef,
|
|
||||||
Input,
|
|
||||||
OnChanges,
|
|
||||||
} from '@angular/core';
|
|
||||||
import { LogService } from 'jslib-common/abstractions/log.service';
|
|
||||||
|
|
||||||
import { ErrorResponse } from 'jslib-common/models/response/errorResponse';
|
import { ErrorResponse } from "jslib-common/models/response/errorResponse";
|
||||||
|
|
||||||
import { ValidationService } from '../services/validation.service';
|
import { ValidationService } from "../services/validation.service";
|
||||||
|
|
||||||
@Directive({
|
@Directive({
|
||||||
selector: '[appApiAction]',
|
selector: "[appApiAction]",
|
||||||
})
|
})
|
||||||
export class ApiActionDirective implements OnChanges {
|
export class ApiActionDirective implements OnChanges {
|
||||||
@Input() appApiAction: Promise<any>;
|
@Input() appApiAction: Promise<any>;
|
||||||
|
|
||||||
constructor(private el: ElementRef, private validationService: ValidationService,
|
constructor(
|
||||||
private logService: LogService) { }
|
private el: ElementRef,
|
||||||
|
private validationService: ValidationService,
|
||||||
|
private logService: LogService
|
||||||
|
) {}
|
||||||
|
|
||||||
ngOnChanges(changes: any) {
|
ngOnChanges(changes: any) {
|
||||||
if (this.appApiAction == null || this.appApiAction.then == null) {
|
if (this.appApiAction == null || this.appApiAction.then == null) {
|
||||||
@@ -26,17 +24,23 @@ export class ApiActionDirective implements OnChanges {
|
|||||||
|
|
||||||
this.el.nativeElement.loading = true;
|
this.el.nativeElement.loading = true;
|
||||||
|
|
||||||
this.appApiAction.then((response: any) => {
|
this.appApiAction.then(
|
||||||
|
(response: any) => {
|
||||||
this.el.nativeElement.loading = false;
|
this.el.nativeElement.loading = false;
|
||||||
}, (e: any) => {
|
},
|
||||||
|
(e: any) => {
|
||||||
this.el.nativeElement.loading = false;
|
this.el.nativeElement.loading = false;
|
||||||
|
|
||||||
if ((e instanceof ErrorResponse || e.constructor.name === 'ErrorResponse') && (e as ErrorResponse).captchaRequired) {
|
if (
|
||||||
this.logService.error('Captcha required error response: ' + e.getSingleMessage());
|
(e instanceof ErrorResponse || e.constructor.name === "ErrorResponse") &&
|
||||||
|
(e as ErrorResponse).captchaRequired
|
||||||
|
) {
|
||||||
|
this.logService.error("Captcha required error response: " + e.getSingleMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.logService?.error(`Received API exception: ${e}`);
|
this.logService?.error(`Received API exception: ${e}`);
|
||||||
this.validationService.showError(e);
|
this.validationService.showError(e);
|
||||||
});
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,20 +1,15 @@
|
|||||||
import {
|
import { Directive, ElementRef, Input, NgZone } from "@angular/core";
|
||||||
Directive,
|
|
||||||
ElementRef,
|
|
||||||
Input,
|
|
||||||
NgZone,
|
|
||||||
} from '@angular/core';
|
|
||||||
|
|
||||||
import { take } from 'rxjs/operators';
|
import { take } from "rxjs/operators";
|
||||||
|
|
||||||
import { Utils } from 'jslib-common/misc/utils';
|
import { Utils } from "jslib-common/misc/utils";
|
||||||
|
|
||||||
@Directive({
|
@Directive({
|
||||||
selector: '[appAutofocus]',
|
selector: "[appAutofocus]",
|
||||||
})
|
})
|
||||||
export class AutofocusDirective {
|
export class AutofocusDirective {
|
||||||
@Input() set appAutofocus(condition: boolean | string) {
|
@Input() set appAutofocus(condition: boolean | string) {
|
||||||
this.autofocus = condition === '' || condition === true;
|
this.autofocus = condition === "" || condition === true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private autofocus: boolean;
|
private autofocus: boolean;
|
||||||
|
|||||||
@@ -1,17 +1,12 @@
|
|||||||
import {
|
import { Directive, ElementRef, HostListener } from "@angular/core";
|
||||||
Directive,
|
|
||||||
ElementRef,
|
|
||||||
HostListener,
|
|
||||||
} from '@angular/core';
|
|
||||||
|
|
||||||
@Directive({
|
@Directive({
|
||||||
selector: '[appBlurClick]',
|
selector: "[appBlurClick]",
|
||||||
})
|
})
|
||||||
export class BlurClickDirective {
|
export class BlurClickDirective {
|
||||||
constructor(private el: ElementRef) {
|
constructor(private el: ElementRef) {}
|
||||||
}
|
|
||||||
|
|
||||||
@HostListener('click') onClick() {
|
@HostListener("click") onClick() {
|
||||||
this.el.nativeElement.blur();
|
this.el.nativeElement.blur();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,7 @@
|
|||||||
import {
|
import { Directive, ElementRef, HostListener, OnInit } from "@angular/core";
|
||||||
Directive,
|
|
||||||
ElementRef,
|
|
||||||
HostListener,
|
|
||||||
OnInit,
|
|
||||||
} from '@angular/core';
|
|
||||||
|
|
||||||
@Directive({
|
@Directive({
|
||||||
selector: '[appBoxRow]',
|
selector: "[appBoxRow]",
|
||||||
})
|
})
|
||||||
export class BoxRowDirective implements OnInit {
|
export class BoxRowDirective implements OnInit {
|
||||||
el: HTMLElement = null;
|
el: HTMLElement = null;
|
||||||
@@ -17,30 +12,43 @@ export class BoxRowDirective implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.formEls = Array.from(this.el.querySelectorAll('input:not([type="hidden"]), select, textarea'));
|
this.formEls = Array.from(
|
||||||
this.formEls.forEach(formEl => {
|
this.el.querySelectorAll('input:not([type="hidden"]), select, textarea')
|
||||||
formEl.addEventListener('focus', (event: Event) => {
|
);
|
||||||
this.el.classList.add('active');
|
this.formEls.forEach((formEl) => {
|
||||||
}, false);
|
formEl.addEventListener(
|
||||||
|
"focus",
|
||||||
|
(event: Event) => {
|
||||||
|
this.el.classList.add("active");
|
||||||
|
},
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
formEl.addEventListener('blur', (event: Event) => {
|
formEl.addEventListener(
|
||||||
this.el.classList.remove('active');
|
"blur",
|
||||||
}, false);
|
(event: Event) => {
|
||||||
|
this.el.classList.remove("active");
|
||||||
|
},
|
||||||
|
false
|
||||||
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@HostListener('click', ['$event']) onClick(event: Event) {
|
@HostListener("click", ["$event"]) onClick(event: Event) {
|
||||||
const target = event.target as HTMLElement;
|
const target = event.target as HTMLElement;
|
||||||
if (target !== this.el && !target.classList.contains('progress') &&
|
if (
|
||||||
!target.classList.contains('progress-bar')) {
|
target !== this.el &&
|
||||||
|
!target.classList.contains("progress") &&
|
||||||
|
!target.classList.contains("progress-bar")
|
||||||
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.formEls.length > 0) {
|
if (this.formEls.length > 0) {
|
||||||
const formEl = (this.formEls[0] as HTMLElement);
|
const formEl = this.formEls[0] as HTMLElement;
|
||||||
if (formEl.tagName.toLowerCase() === 'input') {
|
if (formEl.tagName.toLowerCase() === "input") {
|
||||||
const inputEl = (formEl as HTMLInputElement);
|
const inputEl = formEl as HTMLInputElement;
|
||||||
if (inputEl.type != null && inputEl.type.toLowerCase() === 'checkbox') {
|
if (inputEl.type != null && inputEl.type.toLowerCase() === "checkbox") {
|
||||||
inputEl.click();
|
inputEl.click();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,8 @@ import {
|
|||||||
CdkFixedSizeVirtualScroll,
|
CdkFixedSizeVirtualScroll,
|
||||||
FixedSizeVirtualScrollStrategy,
|
FixedSizeVirtualScrollStrategy,
|
||||||
VIRTUAL_SCROLL_STRATEGY,
|
VIRTUAL_SCROLL_STRATEGY,
|
||||||
} from '@angular/cdk/scrolling';
|
} from "@angular/cdk/scrolling";
|
||||||
import {
|
import { Directive, forwardRef } from "@angular/core";
|
||||||
Directive,
|
|
||||||
forwardRef,
|
|
||||||
} from '@angular/core';
|
|
||||||
|
|
||||||
// Custom virtual scroll strategy for cdk-virtual-scroll
|
// Custom virtual scroll strategy for cdk-virtual-scroll
|
||||||
// Uses a sample list item to set the itemSize for FixedSizeVirtualScrollStrategy
|
// Uses a sample list item to set the itemSize for FixedSizeVirtualScrollStrategy
|
||||||
@@ -15,7 +12,12 @@ export class CipherListVirtualScrollStrategy extends FixedSizeVirtualScrollStrat
|
|||||||
private checkItemSizeCallback: any;
|
private checkItemSizeCallback: any;
|
||||||
private timeout: any;
|
private timeout: any;
|
||||||
|
|
||||||
constructor(itemSize: number, minBufferPx: number, maxBufferPx: number, checkItemSizeCallback: any) {
|
constructor(
|
||||||
|
itemSize: number,
|
||||||
|
minBufferPx: number,
|
||||||
|
maxBufferPx: number,
|
||||||
|
checkItemSizeCallback: any
|
||||||
|
) {
|
||||||
super(itemSize, minBufferPx, maxBufferPx);
|
super(itemSize, minBufferPx, maxBufferPx);
|
||||||
this.checkItemSizeCallback = checkItemSizeCallback;
|
this.checkItemSizeCallback = checkItemSizeCallback;
|
||||||
}
|
}
|
||||||
@@ -34,29 +36,41 @@ export function _cipherListVirtualScrollStrategyFactory(cipherListDir: CipherLis
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Directive({
|
@Directive({
|
||||||
selector: 'cdk-virtual-scroll-viewport[itemSize]',
|
selector: "cdk-virtual-scroll-viewport[itemSize]",
|
||||||
providers: [{
|
providers: [
|
||||||
|
{
|
||||||
provide: VIRTUAL_SCROLL_STRATEGY,
|
provide: VIRTUAL_SCROLL_STRATEGY,
|
||||||
useFactory: _cipherListVirtualScrollStrategyFactory,
|
useFactory: _cipherListVirtualScrollStrategyFactory,
|
||||||
deps: [forwardRef(() => CipherListVirtualScroll)],
|
deps: [forwardRef(() => CipherListVirtualScroll)],
|
||||||
}],
|
},
|
||||||
|
],
|
||||||
})
|
})
|
||||||
export class CipherListVirtualScroll extends CdkFixedSizeVirtualScroll {
|
export class CipherListVirtualScroll extends CdkFixedSizeVirtualScroll {
|
||||||
_scrollStrategy: CipherListVirtualScrollStrategy;
|
_scrollStrategy: CipherListVirtualScrollStrategy;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
this._scrollStrategy = new CipherListVirtualScrollStrategy(this.itemSize, this.minBufferPx, this.maxBufferPx,
|
this._scrollStrategy = new CipherListVirtualScrollStrategy(
|
||||||
this.checkAndUpdateItemSize);
|
this.itemSize,
|
||||||
|
this.minBufferPx,
|
||||||
|
this.maxBufferPx,
|
||||||
|
this.checkAndUpdateItemSize
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
checkAndUpdateItemSize = () => {
|
checkAndUpdateItemSize = () => {
|
||||||
const sampleItem = document.querySelector('cdk-virtual-scroll-viewport .virtual-scroll-item') as HTMLElement;
|
const sampleItem = document.querySelector(
|
||||||
|
"cdk-virtual-scroll-viewport .virtual-scroll-item"
|
||||||
|
) as HTMLElement;
|
||||||
const newItemSize = sampleItem?.offsetHeight;
|
const newItemSize = sampleItem?.offsetHeight;
|
||||||
|
|
||||||
if (newItemSize != null && newItemSize !== this.itemSize) {
|
if (newItemSize != null && newItemSize !== this.itemSize) {
|
||||||
this.itemSize = newItemSize;
|
this.itemSize = newItemSize;
|
||||||
this._scrollStrategy.updateItemAndBufferSize(this.itemSize, this.minBufferPx, this.maxBufferPx);
|
this._scrollStrategy.updateItemAndBufferSize(
|
||||||
}
|
this.itemSize,
|
||||||
|
this.minBufferPx,
|
||||||
|
this.maxBufferPx
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,20 +1,14 @@
|
|||||||
import {
|
import { Directive, ElementRef, HostListener, Input } from "@angular/core";
|
||||||
Directive,
|
|
||||||
ElementRef,
|
|
||||||
HostListener,
|
|
||||||
Input,
|
|
||||||
} from '@angular/core';
|
|
||||||
|
|
||||||
@Directive({
|
@Directive({
|
||||||
selector: '[appFallbackSrc]',
|
selector: "[appFallbackSrc]",
|
||||||
})
|
})
|
||||||
export class FallbackSrcDirective {
|
export class FallbackSrcDirective {
|
||||||
@Input('appFallbackSrc') appFallbackSrc: string;
|
@Input("appFallbackSrc") appFallbackSrc: string;
|
||||||
|
|
||||||
constructor(private el: ElementRef) {
|
constructor(private el: ElementRef) {}
|
||||||
}
|
|
||||||
|
|
||||||
@HostListener('error') onError() {
|
@HostListener("error") onError() {
|
||||||
this.el.nativeElement.src = this.appFallbackSrc;
|
this.el.nativeElement.src = this.appFallbackSrc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,11 @@
|
|||||||
import {
|
import { Directive, ElementRef, Input, Renderer2 } from "@angular/core";
|
||||||
Directive,
|
|
||||||
ElementRef,
|
|
||||||
Input,
|
|
||||||
Renderer2,
|
|
||||||
} from '@angular/core';
|
|
||||||
|
|
||||||
@Directive({
|
@Directive({
|
||||||
selector: '[appInputVerbatim]',
|
selector: "[appInputVerbatim]",
|
||||||
})
|
})
|
||||||
export class InputVerbatimDirective {
|
export class InputVerbatimDirective {
|
||||||
@Input() set appInputVerbatim(condition: boolean | string) {
|
@Input() set appInputVerbatim(condition: boolean | string) {
|
||||||
this.disableComplete = condition === '' || condition === true;
|
this.disableComplete = condition === "" || condition === true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private disableComplete: boolean;
|
private disableComplete: boolean;
|
||||||
@@ -18,20 +13,20 @@ export class InputVerbatimDirective {
|
|||||||
constructor(private el: ElementRef, private renderer: Renderer2) {}
|
constructor(private el: ElementRef, private renderer: Renderer2) {}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
if (this.disableComplete && !this.el.nativeElement.hasAttribute('autocomplete')) {
|
if (this.disableComplete && !this.el.nativeElement.hasAttribute("autocomplete")) {
|
||||||
this.renderer.setAttribute(this.el.nativeElement, 'autocomplete', 'off');
|
this.renderer.setAttribute(this.el.nativeElement, "autocomplete", "off");
|
||||||
}
|
}
|
||||||
if (!this.el.nativeElement.hasAttribute('autocapitalize')) {
|
if (!this.el.nativeElement.hasAttribute("autocapitalize")) {
|
||||||
this.renderer.setAttribute(this.el.nativeElement, 'autocapitalize', 'none');
|
this.renderer.setAttribute(this.el.nativeElement, "autocapitalize", "none");
|
||||||
}
|
}
|
||||||
if (!this.el.nativeElement.hasAttribute('autocorrect')) {
|
if (!this.el.nativeElement.hasAttribute("autocorrect")) {
|
||||||
this.renderer.setAttribute(this.el.nativeElement, 'autocorrect', 'none');
|
this.renderer.setAttribute(this.el.nativeElement, "autocorrect", "none");
|
||||||
}
|
}
|
||||||
if (!this.el.nativeElement.hasAttribute('spellcheck')) {
|
if (!this.el.nativeElement.hasAttribute("spellcheck")) {
|
||||||
this.renderer.setAttribute(this.el.nativeElement, 'spellcheck', 'false');
|
this.renderer.setAttribute(this.el.nativeElement, "spellcheck", "false");
|
||||||
}
|
}
|
||||||
if (!this.el.nativeElement.hasAttribute('inputmode')) {
|
if (!this.el.nativeElement.hasAttribute("inputmode")) {
|
||||||
this.renderer.setAttribute(this.el.nativeElement, 'inputmode', 'verbatim');
|
this.renderer.setAttribute(this.el.nativeElement, "inputmode", "verbatim");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,22 +1,18 @@
|
|||||||
import {
|
import { Directive, ElementRef, HostListener } from "@angular/core";
|
||||||
Directive,
|
|
||||||
ElementRef,
|
|
||||||
HostListener,
|
|
||||||
} from '@angular/core';
|
|
||||||
|
|
||||||
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.service";
|
||||||
|
|
||||||
@Directive({
|
@Directive({
|
||||||
selector: '[appSelectCopy]',
|
selector: "[appSelectCopy]",
|
||||||
})
|
})
|
||||||
export class SelectCopyDirective {
|
export class SelectCopyDirective {
|
||||||
constructor(private el: ElementRef, private platformUtilsService: PlatformUtilsService) {}
|
constructor(private el: ElementRef, private platformUtilsService: PlatformUtilsService) {}
|
||||||
|
|
||||||
@HostListener('copy') onCopy() {
|
@HostListener("copy") onCopy() {
|
||||||
if (window == null) {
|
if (window == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let copyText = '';
|
let copyText = "";
|
||||||
const selection = window.getSelection();
|
const selection = window.getSelection();
|
||||||
for (let i = 0; i < selection.rangeCount; i++) {
|
for (let i = 0; i < selection.rangeCount; i++) {
|
||||||
const range = selection.getRangeAt(i);
|
const range = selection.getRangeAt(i);
|
||||||
@@ -30,7 +26,7 @@ export class SelectCopyDirective {
|
|||||||
const newLinePos = text.search(/(?:\r\n|\r|\n)/);
|
const newLinePos = text.search(/(?:\r\n|\r|\n)/);
|
||||||
if (newLinePos > -1) {
|
if (newLinePos > -1) {
|
||||||
const otherPart = text.substr(newLinePos).trim();
|
const otherPart = text.substr(newLinePos).trim();
|
||||||
if (otherPart === '') {
|
if (otherPart === "") {
|
||||||
stringEndPos = newLinePos;
|
stringEndPos = newLinePos;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,10 @@
|
|||||||
import {
|
import { Directive, HostListener } from "@angular/core";
|
||||||
Directive,
|
|
||||||
HostListener,
|
|
||||||
} from '@angular/core';
|
|
||||||
|
|
||||||
@Directive({
|
@Directive({
|
||||||
selector: '[appStopClick]',
|
selector: "[appStopClick]",
|
||||||
})
|
})
|
||||||
export class StopClickDirective {
|
export class StopClickDirective {
|
||||||
@HostListener('click', ['$event']) onClick($event: MouseEvent) {
|
@HostListener("click", ["$event"]) onClick($event: MouseEvent) {
|
||||||
$event.preventDefault();
|
$event.preventDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,10 @@
|
|||||||
import {
|
import { Directive, HostListener } from "@angular/core";
|
||||||
Directive,
|
|
||||||
HostListener,
|
|
||||||
} from '@angular/core';
|
|
||||||
|
|
||||||
@Directive({
|
@Directive({
|
||||||
selector: '[appStopProp]',
|
selector: "[appStopProp]",
|
||||||
})
|
})
|
||||||
export class StopPropDirective {
|
export class StopPropDirective {
|
||||||
@HostListener('click', ['$event']) onClick($event: MouseEvent) {
|
@HostListener("click", ["$event"]) onClick($event: MouseEvent) {
|
||||||
$event.stopPropagation();
|
$event.stopPropagation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,20 +1,9 @@
|
|||||||
import {
|
import { Directive, ElementRef, forwardRef, HostListener, Input, Renderer2 } from "@angular/core";
|
||||||
Directive,
|
import { ControlValueAccessor, NgControl, NG_VALUE_ACCESSOR } from "@angular/forms";
|
||||||
ElementRef,
|
|
||||||
forwardRef,
|
|
||||||
HostListener,
|
|
||||||
Input,
|
|
||||||
Renderer2,
|
|
||||||
} from '@angular/core';
|
|
||||||
import {
|
|
||||||
ControlValueAccessor,
|
|
||||||
NgControl,
|
|
||||||
NG_VALUE_ACCESSOR,
|
|
||||||
} from '@angular/forms';
|
|
||||||
|
|
||||||
// ref: https://juristr.com/blog/2018/02/ng-true-value-directive/
|
// ref: https://juristr.com/blog/2018/02/ng-true-value-directive/
|
||||||
@Directive({
|
@Directive({
|
||||||
selector: 'input[type=checkbox][appTrueFalseValue]',
|
selector: "input[type=checkbox][appTrueFalseValue]",
|
||||||
providers: [
|
providers: [
|
||||||
{
|
{
|
||||||
provide: NG_VALUE_ACCESSOR,
|
provide: NG_VALUE_ACCESSOR,
|
||||||
@@ -29,16 +18,16 @@ export class TrueFalseValueDirective implements ControlValueAccessor {
|
|||||||
|
|
||||||
constructor(private elementRef: ElementRef, private renderer: Renderer2) {}
|
constructor(private elementRef: ElementRef, private renderer: Renderer2) {}
|
||||||
|
|
||||||
@HostListener('change', ['$event'])
|
@HostListener("change", ["$event"])
|
||||||
onHostChange(ev: any) {
|
onHostChange(ev: any) {
|
||||||
this.propagateChange(ev.target.checked ? this.trueValue : this.falseValue);
|
this.propagateChange(ev.target.checked ? this.trueValue : this.falseValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
writeValue(obj: any): void {
|
writeValue(obj: any): void {
|
||||||
if (obj === this.trueValue) {
|
if (obj === this.trueValue) {
|
||||||
this.renderer.setProperty(this.elementRef.nativeElement, 'checked', true);
|
this.renderer.setProperty(this.elementRef.nativeElement, "checked", true);
|
||||||
} else {
|
} else {
|
||||||
this.renderer.setProperty(this.elementRef.nativeElement, 'checked', false);
|
this.renderer.setProperty(this.elementRef.nativeElement, "checked", false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,9 +35,15 @@ export class TrueFalseValueDirective implements ControlValueAccessor {
|
|||||||
this.propagateChange = fn;
|
this.propagateChange = fn;
|
||||||
}
|
}
|
||||||
|
|
||||||
registerOnTouched(fn: any): void { /* nothing */ }
|
registerOnTouched(fn: any): void {
|
||||||
|
/* nothing */
|
||||||
setDisabledState?(isDisabled: boolean): void { /* nothing */ }
|
}
|
||||||
|
|
||||||
private propagateChange = (_: any) => { /* nothing */ };
|
setDisabledState?(isDisabled: boolean): void {
|
||||||
|
/* nothing */
|
||||||
|
}
|
||||||
|
|
||||||
|
private propagateChange = (_: any) => {
|
||||||
|
/* nothing */
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,52 +1,49 @@
|
|||||||
import {
|
import { Pipe, PipeTransform } from "@angular/core";
|
||||||
Pipe,
|
import { Utils } from "jslib-common/misc/utils";
|
||||||
PipeTransform,
|
|
||||||
} from '@angular/core';
|
|
||||||
import { Utils } from 'jslib-common/misc/utils';
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
An updated pipe that sanitizes HTML, highlights numbers and special characters (in different colors each)
|
An updated pipe that sanitizes HTML, highlights numbers and special characters (in different colors each)
|
||||||
and handles Unicode / Emoji characters correctly.
|
and handles Unicode / Emoji characters correctly.
|
||||||
*/
|
*/
|
||||||
@Pipe({ name: 'colorPassword' })
|
@Pipe({ name: "colorPassword" })
|
||||||
export class ColorPasswordPipe implements PipeTransform {
|
export class ColorPasswordPipe implements PipeTransform {
|
||||||
transform(password: string) {
|
transform(password: string) {
|
||||||
// Convert to an array to handle cases that stings have special characters, ie: emoji.
|
// Convert to an array to handle cases that stings have special characters, ie: emoji.
|
||||||
const passwordArray = Array.from(password);
|
const passwordArray = Array.from(password);
|
||||||
let colorizedPassword = '';
|
let colorizedPassword = "";
|
||||||
for (let i = 0; i < passwordArray.length; i++) {
|
for (let i = 0; i < passwordArray.length; i++) {
|
||||||
let character = passwordArray[i];
|
let character = passwordArray[i];
|
||||||
let isSpecial = false;
|
let isSpecial = false;
|
||||||
// Sanitize HTML first.
|
// Sanitize HTML first.
|
||||||
switch (character) {
|
switch (character) {
|
||||||
case '&':
|
case "&":
|
||||||
character = '&';
|
character = "&";
|
||||||
isSpecial = true;
|
isSpecial = true;
|
||||||
break;
|
break;
|
||||||
case '<':
|
case "<":
|
||||||
character = '<';
|
character = "<";
|
||||||
isSpecial = true;
|
isSpecial = true;
|
||||||
break;
|
break;
|
||||||
case '>':
|
case ">":
|
||||||
character = '>';
|
character = ">";
|
||||||
isSpecial = true;
|
isSpecial = true;
|
||||||
break;
|
break;
|
||||||
case ' ':
|
case " ":
|
||||||
character = ' ';
|
character = " ";
|
||||||
isSpecial = true;
|
isSpecial = true;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
let type = 'letter';
|
let type = "letter";
|
||||||
if (character.match(Utils.regexpEmojiPresentation)) {
|
if (character.match(Utils.regexpEmojiPresentation)) {
|
||||||
type = 'emoji';
|
type = "emoji";
|
||||||
} else if (isSpecial || character.match(/[^\w ]/)) {
|
} else if (isSpecial || character.match(/[^\w ]/)) {
|
||||||
type = 'special';
|
type = "special";
|
||||||
} else if (character.match(/\d/)) {
|
} else if (character.match(/\d/)) {
|
||||||
type = 'number';
|
type = "number";
|
||||||
}
|
}
|
||||||
colorizedPassword += '<span class="password-' + type + '">' + character + '</span>';
|
colorizedPassword += '<span class="password-' + type + '">' + character + "</span>";
|
||||||
}
|
}
|
||||||
return colorizedPassword;
|
return colorizedPassword;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,9 @@
|
|||||||
import {
|
import { Pipe, PipeTransform } from "@angular/core";
|
||||||
Pipe,
|
|
||||||
PipeTransform,
|
|
||||||
} from '@angular/core';
|
|
||||||
|
|
||||||
import { I18nService } from 'jslib-common/abstractions/i18n.service';
|
import { I18nService } from "jslib-common/abstractions/i18n.service";
|
||||||
|
|
||||||
@Pipe({
|
@Pipe({
|
||||||
name: 'i18n',
|
name: "i18n",
|
||||||
})
|
})
|
||||||
export class I18nPipe implements PipeTransform {
|
export class I18nPipe implements PipeTransform {
|
||||||
constructor(private i18nService: I18nService) {}
|
constructor(private i18nService: I18nService) {}
|
||||||
|
|||||||
@@ -1,12 +1,9 @@
|
|||||||
import {
|
import { Pipe, PipeTransform } from "@angular/core";
|
||||||
Pipe,
|
|
||||||
PipeTransform,
|
|
||||||
} from '@angular/core';
|
|
||||||
|
|
||||||
import { CipherView } from 'jslib-common/models/view/cipherView';
|
import { CipherView } from "jslib-common/models/view/cipherView";
|
||||||
|
|
||||||
@Pipe({
|
@Pipe({
|
||||||
name: 'searchCiphers',
|
name: "searchCiphers",
|
||||||
})
|
})
|
||||||
export class SearchCiphersPipe implements PipeTransform {
|
export class SearchCiphersPipe implements PipeTransform {
|
||||||
transform(ciphers: CipherView[], searchText: string, deleted: boolean = false): CipherView[] {
|
transform(ciphers: CipherView[], searchText: string, deleted: boolean = false): CipherView[] {
|
||||||
@@ -15,13 +12,13 @@ export class SearchCiphersPipe implements PipeTransform {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (searchText == null || searchText.length < 2) {
|
if (searchText == null || searchText.length < 2) {
|
||||||
return ciphers.filter(c => {
|
return ciphers.filter((c) => {
|
||||||
return deleted !== c.isDeleted;
|
return deleted !== c.isDeleted;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
searchText = searchText.trim().toLowerCase();
|
searchText = searchText.trim().toLowerCase();
|
||||||
return ciphers.filter(c => {
|
return ciphers.filter((c) => {
|
||||||
if (deleted !== c.isDeleted) {
|
if (deleted !== c.isDeleted) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,16 @@
|
|||||||
import {
|
import { Pipe, PipeTransform } from "@angular/core";
|
||||||
Pipe,
|
|
||||||
PipeTransform,
|
|
||||||
} from '@angular/core';
|
|
||||||
|
|
||||||
@Pipe({
|
@Pipe({
|
||||||
name: 'search',
|
name: "search",
|
||||||
})
|
})
|
||||||
export class SearchPipe implements PipeTransform {
|
export class SearchPipe implements PipeTransform {
|
||||||
transform(items: any[], searchText: string, prop1?: string, prop2?: string, prop3?: string): any[] {
|
transform(
|
||||||
|
items: any[],
|
||||||
|
searchText: string,
|
||||||
|
prop1?: string,
|
||||||
|
prop2?: string,
|
||||||
|
prop3?: string
|
||||||
|
): any[] {
|
||||||
if (items == null || items.length === 0) {
|
if (items == null || items.length === 0) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
@@ -17,14 +20,26 @@ export class SearchPipe implements PipeTransform {
|
|||||||
}
|
}
|
||||||
|
|
||||||
searchText = searchText.trim().toLowerCase();
|
searchText = searchText.trim().toLowerCase();
|
||||||
return items.filter(i => {
|
return items.filter((i) => {
|
||||||
if (prop1 != null && i[prop1] != null && i[prop1].toString().toLowerCase().indexOf(searchText) > -1) {
|
if (
|
||||||
|
prop1 != null &&
|
||||||
|
i[prop1] != null &&
|
||||||
|
i[prop1].toString().toLowerCase().indexOf(searchText) > -1
|
||||||
|
) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (prop2 != null && i[prop2] != null && i[prop2].toString().toLowerCase().indexOf(searchText) > -1) {
|
if (
|
||||||
|
prop2 != null &&
|
||||||
|
i[prop2] != null &&
|
||||||
|
i[prop2].toString().toLowerCase().indexOf(searchText) > -1
|
||||||
|
) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (prop3 != null && i[prop3] != null && i[prop3].toString().toLowerCase().indexOf(searchText) > -1) {
|
if (
|
||||||
|
prop3 != null &&
|
||||||
|
i[prop3] != null &&
|
||||||
|
i[prop3].toString().toLowerCase().indexOf(searchText) > -1
|
||||||
|
) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -1,7 +1,4 @@
|
|||||||
import {
|
import { Pipe, PipeTransform } from "@angular/core";
|
||||||
Pipe,
|
|
||||||
PipeTransform,
|
|
||||||
} from '@angular/core';
|
|
||||||
|
|
||||||
interface User {
|
interface User {
|
||||||
name?: string;
|
name?: string;
|
||||||
@@ -9,7 +6,7 @@ interface User {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Pipe({
|
@Pipe({
|
||||||
name: 'userName',
|
name: "userName",
|
||||||
})
|
})
|
||||||
export class UserNamePipe implements PipeTransform {
|
export class UserNamePipe implements PipeTransform {
|
||||||
transform(user?: User): string {
|
transform(user?: User): string {
|
||||||
@@ -17,6 +14,6 @@ export class UserNamePipe implements PipeTransform {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return user.name == null || user.name.trim() === '' ? user.email : user.name;
|
return user.name == null || user.name.trim() === "" ? user.email : user.name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,90 +1,89 @@
|
|||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Open Sans';
|
font-family: "Open Sans";
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
font-weight: 300;
|
font-weight: 300;
|
||||||
font-display: auto;
|
font-display: auto;
|
||||||
src: url(webfonts/Open_Sans-italic-300.woff) format('woff');
|
src: url(webfonts/Open_Sans-italic-300.woff) format("woff");
|
||||||
unicode-range: U+0-10FFFF;
|
unicode-range: U+0-10FFFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Open Sans';
|
font-family: "Open Sans";
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
font-display: auto;
|
font-display: auto;
|
||||||
src: url(webfonts/Open_Sans-italic-400.woff) format('woff');
|
src: url(webfonts/Open_Sans-italic-400.woff) format("woff");
|
||||||
unicode-range: U+0-10FFFF;
|
unicode-range: U+0-10FFFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Open Sans';
|
font-family: "Open Sans";
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
font-display: auto;
|
font-display: auto;
|
||||||
src: url(webfonts/Open_Sans-italic-600.woff) format('woff');
|
src: url(webfonts/Open_Sans-italic-600.woff) format("woff");
|
||||||
unicode-range: U+0-10FFFF;
|
unicode-range: U+0-10FFFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Open Sans';
|
font-family: "Open Sans";
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
font-display: auto;
|
font-display: auto;
|
||||||
src: url(webfonts/Open_Sans-italic-700.woff) format('woff');
|
src: url(webfonts/Open_Sans-italic-700.woff) format("woff");
|
||||||
unicode-range: U+0-10FFFF;
|
unicode-range: U+0-10FFFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Open Sans';
|
font-family: "Open Sans";
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
font-weight: 800;
|
font-weight: 800;
|
||||||
font-display: auto;
|
font-display: auto;
|
||||||
src: url(webfonts/Open_Sans-italic-800.woff) format('woff');
|
src: url(webfonts/Open_Sans-italic-800.woff) format("woff");
|
||||||
unicode-range: U+0-10FFFF;
|
unicode-range: U+0-10FFFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Open Sans';
|
font-family: "Open Sans";
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-weight: 300;
|
font-weight: 300;
|
||||||
font-display: auto;
|
font-display: auto;
|
||||||
src: url(webfonts/Open_Sans-normal-300.woff) format('woff');
|
src: url(webfonts/Open_Sans-normal-300.woff) format("woff");
|
||||||
unicode-range: U+0-10FFFF;
|
unicode-range: U+0-10FFFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Open Sans';
|
font-family: "Open Sans";
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
font-display: auto;
|
font-display: auto;
|
||||||
src: url(webfonts/Open_Sans-normal-400.woff) format('woff');
|
src: url(webfonts/Open_Sans-normal-400.woff) format("woff");
|
||||||
unicode-range: U+0-10FFFF;
|
unicode-range: U+0-10FFFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Open Sans';
|
font-family: "Open Sans";
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
font-display: auto;
|
font-display: auto;
|
||||||
src: url(webfonts/Open_Sans-normal-600.woff) format('woff');
|
src: url(webfonts/Open_Sans-normal-600.woff) format("woff");
|
||||||
unicode-range: U+0-10FFFF;
|
unicode-range: U+0-10FFFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Open Sans';
|
font-family: "Open Sans";
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
font-display: auto;
|
font-display: auto;
|
||||||
src: url(webfonts/Open_Sans-normal-700.woff) format('woff');
|
src: url(webfonts/Open_Sans-normal-700.woff) format("woff");
|
||||||
unicode-range: U+0-10FFFF;
|
unicode-range: U+0-10FFFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Open Sans';
|
font-family: "Open Sans";
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-weight: 800;
|
font-weight: 800;
|
||||||
font-display: auto;
|
font-display: auto;
|
||||||
src: url(webfonts/Open_Sans-normal-800.woff) format('woff');
|
src: url(webfonts/Open_Sans-normal-800.woff) format("woff");
|
||||||
unicode-range: U+0-10FFFF;
|
unicode-range: U+0-10FFFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from "@angular/core";
|
||||||
|
|
||||||
import { BroadcasterService as BaseBroadcasterService } from 'jslib-common/services/broadcaster.service';
|
import { BroadcasterService as BaseBroadcasterService } from "jslib-common/services/broadcaster.service";
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class BroadcasterService extends BaseBroadcasterService {
|
export class BroadcasterService extends BaseBroadcasterService {}
|
||||||
}
|
|
||||||
|
|||||||
@@ -7,13 +7,13 @@ import {
|
|||||||
Injectable,
|
Injectable,
|
||||||
Injector,
|
Injector,
|
||||||
Type,
|
Type,
|
||||||
ViewContainerRef
|
ViewContainerRef,
|
||||||
} from '@angular/core';
|
} from "@angular/core";
|
||||||
import { first } from 'rxjs/operators';
|
import { first } from "rxjs/operators";
|
||||||
|
|
||||||
import { DynamicModalComponent } from '../components/modal/dynamic-modal.component';
|
import { DynamicModalComponent } from "../components/modal/dynamic-modal.component";
|
||||||
import { ModalInjector } from '../components/modal/modal-injector';
|
import { ModalInjector } from "../components/modal/modal-injector";
|
||||||
import { ModalRef } from '../components/modal/modal.ref';
|
import { ModalRef } from "../components/modal/modal.ref";
|
||||||
|
|
||||||
export class ModalConfig<D = any> {
|
export class ModalConfig<D = any> {
|
||||||
data?: D;
|
data?: D;
|
||||||
@@ -28,10 +28,13 @@ export class ModalService {
|
|||||||
// therefore modules needs to manually initialize their resolvers.
|
// therefore modules needs to manually initialize their resolvers.
|
||||||
private factoryResolvers: Map<Type<any>, ComponentFactoryResolver> = new Map();
|
private factoryResolvers: Map<Type<any>, ComponentFactoryResolver> = new Map();
|
||||||
|
|
||||||
constructor(private componentFactoryResolver: ComponentFactoryResolver, private applicationRef: ApplicationRef,
|
constructor(
|
||||||
private injector: Injector) {
|
private componentFactoryResolver: ComponentFactoryResolver,
|
||||||
document.addEventListener('keyup', event => {
|
private applicationRef: ApplicationRef,
|
||||||
if (event.key === 'Escape' && this.modalCount > 0) {
|
private injector: Injector
|
||||||
|
) {
|
||||||
|
document.addEventListener("keyup", (event) => {
|
||||||
|
if (event.key === "Escape" && this.modalCount > 0) {
|
||||||
this.topModal.instance.close();
|
this.topModal.instance.close();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -45,9 +48,11 @@ export class ModalService {
|
|||||||
return this.modalList[this.modalCount - 1];
|
return this.modalList[this.modalCount - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
async openViewRef<T>(componentType: Type<T>, viewContainerRef: ViewContainerRef,
|
async openViewRef<T>(
|
||||||
setComponentParameters: (component: T) => void = null): Promise<[ModalRef, T]> {
|
componentType: Type<T>,
|
||||||
|
viewContainerRef: ViewContainerRef,
|
||||||
|
setComponentParameters: (component: T) => void = null
|
||||||
|
): Promise<[ModalRef, T]> {
|
||||||
const [modalRef, modalComponentRef] = this.openInternal(componentType, null, false);
|
const [modalRef, modalComponentRef] = this.openInternal(componentType, null, false);
|
||||||
modalComponentRef.instance.setComponentParameters = setComponentParameters;
|
modalComponentRef.instance.setComponentParameters = setComponentParameters;
|
||||||
|
|
||||||
@@ -68,7 +73,10 @@ export class ModalService {
|
|||||||
return modalRef;
|
return modalRef;
|
||||||
}
|
}
|
||||||
|
|
||||||
registerComponentFactoryResolver<T>(componentType: Type<T>, componentFactoryResolver: ComponentFactoryResolver): void {
|
registerComponentFactoryResolver<T>(
|
||||||
|
componentType: Type<T>,
|
||||||
|
componentFactoryResolver: ComponentFactoryResolver
|
||||||
|
): void {
|
||||||
this.factoryResolvers.set(componentType, componentFactoryResolver);
|
this.factoryResolvers.set(componentType, componentFactoryResolver);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,9 +88,11 @@ export class ModalService {
|
|||||||
return this.componentFactoryResolver.resolveComponentFactory(componentType);
|
return this.componentFactoryResolver.resolveComponentFactory(componentType);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected openInternal(componentType: Type<any>, config?: ModalConfig, attachToDom?: boolean):
|
protected openInternal(
|
||||||
[ModalRef, ComponentRef<DynamicModalComponent>] {
|
componentType: Type<any>,
|
||||||
|
config?: ModalConfig,
|
||||||
|
attachToDom?: boolean
|
||||||
|
): [ModalRef, ComponentRef<DynamicModalComponent>] {
|
||||||
const [modalRef, componentRef] = this.createModalComponent(config);
|
const [modalRef, componentRef] = this.createModalComponent(config);
|
||||||
componentRef.instance.childComponentType = componentType;
|
componentRef.instance.childComponentType = componentType;
|
||||||
|
|
||||||
@@ -115,25 +125,27 @@ export class ModalService {
|
|||||||
let backdrop: HTMLElement = null;
|
let backdrop: HTMLElement = null;
|
||||||
|
|
||||||
// Add backdrop, setup [data-dismiss] handler.
|
// Add backdrop, setup [data-dismiss] handler.
|
||||||
modalRef.onCreated.pipe(first()).subscribe(el => {
|
modalRef.onCreated.pipe(first()).subscribe((el) => {
|
||||||
document.body.classList.add('modal-open');
|
document.body.classList.add("modal-open");
|
||||||
|
|
||||||
const modalEl: HTMLElement = el.querySelector('.modal');
|
const modalEl: HTMLElement = el.querySelector(".modal");
|
||||||
const dialogEl = modalEl.querySelector('.modal-dialog') as HTMLElement;
|
const dialogEl = modalEl.querySelector(".modal-dialog") as HTMLElement;
|
||||||
|
|
||||||
backdrop = document.createElement('div');
|
backdrop = document.createElement("div");
|
||||||
backdrop.className = 'modal-backdrop fade';
|
backdrop.className = "modal-backdrop fade";
|
||||||
backdrop.style.zIndex = `${this.modalCount}040`;
|
backdrop.style.zIndex = `${this.modalCount}040`;
|
||||||
modalEl.prepend(backdrop);
|
modalEl.prepend(backdrop);
|
||||||
|
|
||||||
dialogEl.addEventListener('click', (e: Event) => {
|
dialogEl.addEventListener("click", (e: Event) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
});
|
});
|
||||||
dialogEl.style.zIndex = `${this.modalCount}050`;
|
dialogEl.style.zIndex = `${this.modalCount}050`;
|
||||||
|
|
||||||
const modals = Array.from(el.querySelectorAll('.modal-backdrop, .modal *[data-dismiss="modal"]'));
|
const modals = Array.from(
|
||||||
|
el.querySelectorAll('.modal-backdrop, .modal *[data-dismiss="modal"]')
|
||||||
|
);
|
||||||
for (const closeElement of modals) {
|
for (const closeElement of modals) {
|
||||||
closeElement.addEventListener('click', event => {
|
closeElement.addEventListener("click", (event) => {
|
||||||
modalRef.close();
|
modalRef.close();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -144,19 +156,22 @@ export class ModalService {
|
|||||||
modalRef.closed();
|
modalRef.closed();
|
||||||
|
|
||||||
if (this.modalCount === 0) {
|
if (this.modalCount === 0) {
|
||||||
document.body.classList.remove('modal-open');
|
document.body.classList.remove("modal-open");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected createModalComponent(config: ModalConfig): [ModalRef, ComponentRef<DynamicModalComponent>] {
|
protected createModalComponent(
|
||||||
|
config: ModalConfig
|
||||||
|
): [ModalRef, ComponentRef<DynamicModalComponent>] {
|
||||||
const modalRef = new ModalRef();
|
const modalRef = new ModalRef();
|
||||||
|
|
||||||
const map = new WeakMap();
|
const map = new WeakMap();
|
||||||
map.set(ModalConfig, config);
|
map.set(ModalConfig, config);
|
||||||
map.set(ModalRef, modalRef);
|
map.set(ModalRef, modalRef);
|
||||||
|
|
||||||
const componentFactory = this.componentFactoryResolver.resolveComponentFactory(DynamicModalComponent);
|
const componentFactory =
|
||||||
|
this.componentFactoryResolver.resolveComponentFactory(DynamicModalComponent);
|
||||||
const componentRef = componentFactory.create(new ModalInjector(this.injector, map));
|
const componentRef = componentFactory.create(new ModalInjector(this.injector, map));
|
||||||
|
|
||||||
return [modalRef, componentRef];
|
return [modalRef, componentRef];
|
||||||
|
|||||||
@@ -1,23 +1,26 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from "@angular/core";
|
||||||
|
|
||||||
import { KeyConnectorService } from 'jslib-common/abstractions/keyConnector.service';
|
import { KeyConnectorService } from "jslib-common/abstractions/keyConnector.service";
|
||||||
import { PasswordRepromptService as PasswordRepromptServiceAbstraction } from 'jslib-common/abstractions/passwordReprompt.service';
|
import { PasswordRepromptService as PasswordRepromptServiceAbstraction } from "jslib-common/abstractions/passwordReprompt.service";
|
||||||
|
|
||||||
import { PasswordRepromptComponent } from '../components/password-reprompt.component';
|
import { PasswordRepromptComponent } from "../components/password-reprompt.component";
|
||||||
import { ModalService } from './modal.service';
|
import { ModalService } from "./modal.service";
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class PasswordRepromptService implements PasswordRepromptServiceAbstraction {
|
export class PasswordRepromptService implements PasswordRepromptServiceAbstraction {
|
||||||
protected component = PasswordRepromptComponent;
|
protected component = PasswordRepromptComponent;
|
||||||
|
|
||||||
constructor(private modalService: ModalService, private keyConnectorService: KeyConnectorService) { }
|
constructor(
|
||||||
|
private modalService: ModalService,
|
||||||
|
private keyConnectorService: KeyConnectorService
|
||||||
|
) {}
|
||||||
|
|
||||||
protectedFields() {
|
protectedFields() {
|
||||||
return ['TOTP', 'Password', 'H_Field', 'Card Number', 'Security Code'];
|
return ["TOTP", "Password", "H_Field", "Card Number", "Security Code"];
|
||||||
}
|
}
|
||||||
|
|
||||||
async showPasswordPrompt() {
|
async showPasswordPrompt() {
|
||||||
if (!await this.enabled()) {
|
if (!(await this.enabled())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -32,6 +35,6 @@ export class PasswordRepromptService implements PasswordRepromptServiceAbstracti
|
|||||||
}
|
}
|
||||||
|
|
||||||
async enabled() {
|
async enabled() {
|
||||||
return !await this.keyConnectorService.getUsesKeyConnector();
|
return !(await this.keyConnectorService.getUsesKeyConnector());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,21 +1,24 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from "@angular/core";
|
||||||
|
|
||||||
import { I18nService } from 'jslib-common/abstractions/i18n.service';
|
import { I18nService } from "jslib-common/abstractions/i18n.service";
|
||||||
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.service";
|
||||||
|
|
||||||
import { ErrorResponse } from 'jslib-common/models/response/errorResponse';
|
import { ErrorResponse } from "jslib-common/models/response/errorResponse";
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ValidationService {
|
export class ValidationService {
|
||||||
constructor(private i18nService: I18nService, private platformUtilsService: PlatformUtilsService) { }
|
constructor(
|
||||||
|
private i18nService: I18nService,
|
||||||
|
private platformUtilsService: PlatformUtilsService
|
||||||
|
) {}
|
||||||
|
|
||||||
showError(data: any): string[] {
|
showError(data: any): string[] {
|
||||||
const defaultErrorMessage = this.i18nService.t('unexpectedError');
|
const defaultErrorMessage = this.i18nService.t("unexpectedError");
|
||||||
let errors: string[] = [];
|
let errors: string[] = [];
|
||||||
|
|
||||||
if (data != null && typeof data === 'string') {
|
if (data != null && typeof data === "string") {
|
||||||
errors.push(data);
|
errors.push(data);
|
||||||
} else if (data == null || typeof data !== 'object') {
|
} else if (data == null || typeof data !== "object") {
|
||||||
errors.push(defaultErrorMessage);
|
errors.push(defaultErrorMessage);
|
||||||
} else if (data.validationErrors != null) {
|
} else if (data.validationErrors != null) {
|
||||||
errors = errors.concat((data as ErrorResponse).getAllMessages());
|
errors = errors.concat((data as ErrorResponse).getAllMessages());
|
||||||
@@ -24,9 +27,9 @@ export class ValidationService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (errors.length === 1) {
|
if (errors.length === 1) {
|
||||||
this.platformUtilsService.showToast('error', this.i18nService.t('errorOccurred'), errors[0]);
|
this.platformUtilsService.showToast("error", this.i18nService.t("errorOccurred"), errors[0]);
|
||||||
} else if (errors.length > 1) {
|
} else if (errors.length > 1) {
|
||||||
this.platformUtilsService.showToast('error', this.i18nService.t('errorOccurred'), errors, {
|
this.platformUtilsService.showToast("error", this.i18nService.t("errorOccurred"), errors, {
|
||||||
timeout: 5000 * errors.length,
|
timeout: 5000 * errors.length,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,17 +14,9 @@
|
|||||||
"declarationDir": "dist/types",
|
"declarationDir": "dist/types",
|
||||||
"outDir": "dist",
|
"outDir": "dist",
|
||||||
"paths": {
|
"paths": {
|
||||||
"jslib-common/*": [
|
"jslib-common/*": ["../common/src/*"]
|
||||||
"../common/src/*"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"include": [
|
"include": ["src", "spec"],
|
||||||
"src",
|
"exclude": ["node_modules", "dist"]
|
||||||
"spec"
|
|
||||||
],
|
|
||||||
"exclude": [
|
|
||||||
"node_modules",
|
|
||||||
"dist"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,170 +1,178 @@
|
|||||||
import { PolicyType } from '../enums/policyType';
|
import { PolicyType } from "../enums/policyType";
|
||||||
import { SetKeyConnectorKeyRequest } from '../models/request/account/setKeyConnectorKeyRequest';
|
import { SetKeyConnectorKeyRequest } from "../models/request/account/setKeyConnectorKeyRequest";
|
||||||
import { VerifyOTPRequest } from '../models/request/account/verifyOTPRequest';
|
import { VerifyOTPRequest } from "../models/request/account/verifyOTPRequest";
|
||||||
|
|
||||||
import { AttachmentRequest } from '../models/request/attachmentRequest';
|
import { AttachmentRequest } from "../models/request/attachmentRequest";
|
||||||
|
|
||||||
import { BitPayInvoiceRequest } from '../models/request/bitPayInvoiceRequest';
|
import { BitPayInvoiceRequest } from "../models/request/bitPayInvoiceRequest";
|
||||||
import { CipherBulkDeleteRequest } from '../models/request/cipherBulkDeleteRequest';
|
import { CipherBulkDeleteRequest } from "../models/request/cipherBulkDeleteRequest";
|
||||||
import { CipherBulkMoveRequest } from '../models/request/cipherBulkMoveRequest';
|
import { CipherBulkMoveRequest } from "../models/request/cipherBulkMoveRequest";
|
||||||
import { CipherBulkRestoreRequest } from '../models/request/cipherBulkRestoreRequest';
|
import { CipherBulkRestoreRequest } from "../models/request/cipherBulkRestoreRequest";
|
||||||
import { CipherBulkShareRequest } from '../models/request/cipherBulkShareRequest';
|
import { CipherBulkShareRequest } from "../models/request/cipherBulkShareRequest";
|
||||||
import { CipherCollectionsRequest } from '../models/request/cipherCollectionsRequest';
|
import { CipherCollectionsRequest } from "../models/request/cipherCollectionsRequest";
|
||||||
import { CipherCreateRequest } from '../models/request/cipherCreateRequest';
|
import { CipherCreateRequest } from "../models/request/cipherCreateRequest";
|
||||||
import { CipherRequest } from '../models/request/cipherRequest';
|
import { CipherRequest } from "../models/request/cipherRequest";
|
||||||
import { CipherShareRequest } from '../models/request/cipherShareRequest';
|
import { CipherShareRequest } from "../models/request/cipherShareRequest";
|
||||||
import { CollectionRequest } from '../models/request/collectionRequest';
|
import { CollectionRequest } from "../models/request/collectionRequest";
|
||||||
import { DeleteRecoverRequest } from '../models/request/deleteRecoverRequest';
|
import { DeleteRecoverRequest } from "../models/request/deleteRecoverRequest";
|
||||||
import { EmailRequest } from '../models/request/emailRequest';
|
import { EmailRequest } from "../models/request/emailRequest";
|
||||||
import { EmailTokenRequest } from '../models/request/emailTokenRequest';
|
import { EmailTokenRequest } from "../models/request/emailTokenRequest";
|
||||||
import { EmergencyAccessAcceptRequest } from '../models/request/emergencyAccessAcceptRequest';
|
import { EmergencyAccessAcceptRequest } from "../models/request/emergencyAccessAcceptRequest";
|
||||||
import { EmergencyAccessConfirmRequest } from '../models/request/emergencyAccessConfirmRequest';
|
import { EmergencyAccessConfirmRequest } from "../models/request/emergencyAccessConfirmRequest";
|
||||||
import { EmergencyAccessInviteRequest } from '../models/request/emergencyAccessInviteRequest';
|
import { EmergencyAccessInviteRequest } from "../models/request/emergencyAccessInviteRequest";
|
||||||
import { EmergencyAccessPasswordRequest } from '../models/request/emergencyAccessPasswordRequest';
|
import { EmergencyAccessPasswordRequest } from "../models/request/emergencyAccessPasswordRequest";
|
||||||
import { EmergencyAccessUpdateRequest } from '../models/request/emergencyAccessUpdateRequest';
|
import { EmergencyAccessUpdateRequest } from "../models/request/emergencyAccessUpdateRequest";
|
||||||
import { EventRequest } from '../models/request/eventRequest';
|
import { EventRequest } from "../models/request/eventRequest";
|
||||||
import { FolderRequest } from '../models/request/folderRequest';
|
import { FolderRequest } from "../models/request/folderRequest";
|
||||||
import { GroupRequest } from '../models/request/groupRequest';
|
import { GroupRequest } from "../models/request/groupRequest";
|
||||||
import { IapCheckRequest } from '../models/request/iapCheckRequest';
|
import { IapCheckRequest } from "../models/request/iapCheckRequest";
|
||||||
import { ImportCiphersRequest } from '../models/request/importCiphersRequest';
|
import { ImportCiphersRequest } from "../models/request/importCiphersRequest";
|
||||||
import { ImportDirectoryRequest } from '../models/request/importDirectoryRequest';
|
import { ImportDirectoryRequest } from "../models/request/importDirectoryRequest";
|
||||||
import { ImportOrganizationCiphersRequest } from '../models/request/importOrganizationCiphersRequest';
|
import { ImportOrganizationCiphersRequest } from "../models/request/importOrganizationCiphersRequest";
|
||||||
import { KdfRequest } from '../models/request/kdfRequest';
|
import { KdfRequest } from "../models/request/kdfRequest";
|
||||||
import { KeyConnectorUserKeyRequest } from '../models/request/keyConnectorUserKeyRequest';
|
import { KeyConnectorUserKeyRequest } from "../models/request/keyConnectorUserKeyRequest";
|
||||||
import { KeysRequest } from '../models/request/keysRequest';
|
import { KeysRequest } from "../models/request/keysRequest";
|
||||||
import { OrganizationSponsorshipCreateRequest } from '../models/request/organization/organizationSponsorshipCreateRequest';
|
import { OrganizationSponsorshipCreateRequest } from "../models/request/organization/organizationSponsorshipCreateRequest";
|
||||||
import { OrganizationSponsorshipRedeemRequest } from '../models/request/organization/organizationSponsorshipRedeemRequest';
|
import { OrganizationSponsorshipRedeemRequest } from "../models/request/organization/organizationSponsorshipRedeemRequest";
|
||||||
import { OrganizationSsoRequest } from '../models/request/organization/organizationSsoRequest';
|
import { OrganizationSsoRequest } from "../models/request/organization/organizationSsoRequest";
|
||||||
import { OrganizationCreateRequest } from '../models/request/organizationCreateRequest';
|
import { OrganizationCreateRequest } from "../models/request/organizationCreateRequest";
|
||||||
import { OrganizationImportRequest } from '../models/request/organizationImportRequest';
|
import { OrganizationImportRequest } from "../models/request/organizationImportRequest";
|
||||||
import { OrganizationKeysRequest } from '../models/request/organizationKeysRequest';
|
import { OrganizationKeysRequest } from "../models/request/organizationKeysRequest";
|
||||||
import { OrganizationSubscriptionUpdateRequest } from '../models/request/organizationSubscriptionUpdateRequest';
|
import { OrganizationSubscriptionUpdateRequest } from "../models/request/organizationSubscriptionUpdateRequest";
|
||||||
import { OrganizationTaxInfoUpdateRequest } from '../models/request/organizationTaxInfoUpdateRequest';
|
import { OrganizationTaxInfoUpdateRequest } from "../models/request/organizationTaxInfoUpdateRequest";
|
||||||
import { OrganizationUpdateRequest } from '../models/request/organizationUpdateRequest';
|
import { OrganizationUpdateRequest } from "../models/request/organizationUpdateRequest";
|
||||||
import { OrganizationUpgradeRequest } from '../models/request/organizationUpgradeRequest';
|
import { OrganizationUpgradeRequest } from "../models/request/organizationUpgradeRequest";
|
||||||
import { OrganizationUserAcceptRequest } from '../models/request/organizationUserAcceptRequest';
|
import { OrganizationUserAcceptRequest } from "../models/request/organizationUserAcceptRequest";
|
||||||
import { OrganizationUserBulkConfirmRequest } from '../models/request/organizationUserBulkConfirmRequest';
|
import { OrganizationUserBulkConfirmRequest } from "../models/request/organizationUserBulkConfirmRequest";
|
||||||
import { OrganizationUserBulkRequest } from '../models/request/organizationUserBulkRequest';
|
import { OrganizationUserBulkRequest } from "../models/request/organizationUserBulkRequest";
|
||||||
import { OrganizationUserConfirmRequest } from '../models/request/organizationUserConfirmRequest';
|
import { OrganizationUserConfirmRequest } from "../models/request/organizationUserConfirmRequest";
|
||||||
import { OrganizationUserInviteRequest } from '../models/request/organizationUserInviteRequest';
|
import { OrganizationUserInviteRequest } from "../models/request/organizationUserInviteRequest";
|
||||||
import { OrganizationUserResetPasswordEnrollmentRequest } from '../models/request/organizationUserResetPasswordEnrollmentRequest';
|
import { OrganizationUserResetPasswordEnrollmentRequest } from "../models/request/organizationUserResetPasswordEnrollmentRequest";
|
||||||
import { OrganizationUserResetPasswordRequest } from '../models/request/organizationUserResetPasswordRequest';
|
import { OrganizationUserResetPasswordRequest } from "../models/request/organizationUserResetPasswordRequest";
|
||||||
import { OrganizationUserUpdateGroupsRequest } from '../models/request/organizationUserUpdateGroupsRequest';
|
import { OrganizationUserUpdateGroupsRequest } from "../models/request/organizationUserUpdateGroupsRequest";
|
||||||
import { OrganizationUserUpdateRequest } from '../models/request/organizationUserUpdateRequest';
|
import { OrganizationUserUpdateRequest } from "../models/request/organizationUserUpdateRequest";
|
||||||
import { PasswordHintRequest } from '../models/request/passwordHintRequest';
|
import { PasswordHintRequest } from "../models/request/passwordHintRequest";
|
||||||
import { PasswordRequest } from '../models/request/passwordRequest';
|
import { PasswordRequest } from "../models/request/passwordRequest";
|
||||||
import { PaymentRequest } from '../models/request/paymentRequest';
|
import { PaymentRequest } from "../models/request/paymentRequest";
|
||||||
import { PolicyRequest } from '../models/request/policyRequest';
|
import { PolicyRequest } from "../models/request/policyRequest";
|
||||||
import { PreloginRequest } from '../models/request/preloginRequest';
|
import { PreloginRequest } from "../models/request/preloginRequest";
|
||||||
import { ProviderAddOrganizationRequest } from '../models/request/provider/providerAddOrganizationRequest';
|
import { ProviderAddOrganizationRequest } from "../models/request/provider/providerAddOrganizationRequest";
|
||||||
import { ProviderOrganizationCreateRequest } from '../models/request/provider/providerOrganizationCreateRequest';
|
import { ProviderOrganizationCreateRequest } from "../models/request/provider/providerOrganizationCreateRequest";
|
||||||
import { ProviderSetupRequest } from '../models/request/provider/providerSetupRequest';
|
import { ProviderSetupRequest } from "../models/request/provider/providerSetupRequest";
|
||||||
import { ProviderUpdateRequest } from '../models/request/provider/providerUpdateRequest';
|
import { ProviderUpdateRequest } from "../models/request/provider/providerUpdateRequest";
|
||||||
import { ProviderUserAcceptRequest } from '../models/request/provider/providerUserAcceptRequest';
|
import { ProviderUserAcceptRequest } from "../models/request/provider/providerUserAcceptRequest";
|
||||||
import { ProviderUserBulkConfirmRequest } from '../models/request/provider/providerUserBulkConfirmRequest';
|
import { ProviderUserBulkConfirmRequest } from "../models/request/provider/providerUserBulkConfirmRequest";
|
||||||
import { ProviderUserBulkRequest } from '../models/request/provider/providerUserBulkRequest';
|
import { ProviderUserBulkRequest } from "../models/request/provider/providerUserBulkRequest";
|
||||||
import { ProviderUserConfirmRequest } from '../models/request/provider/providerUserConfirmRequest';
|
import { ProviderUserConfirmRequest } from "../models/request/provider/providerUserConfirmRequest";
|
||||||
import { ProviderUserInviteRequest } from '../models/request/provider/providerUserInviteRequest';
|
import { ProviderUserInviteRequest } from "../models/request/provider/providerUserInviteRequest";
|
||||||
import { ProviderUserUpdateRequest } from '../models/request/provider/providerUserUpdateRequest';
|
import { ProviderUserUpdateRequest } from "../models/request/provider/providerUserUpdateRequest";
|
||||||
import { RegisterRequest } from '../models/request/registerRequest';
|
import { RegisterRequest } from "../models/request/registerRequest";
|
||||||
import { SeatRequest } from '../models/request/seatRequest';
|
import { SeatRequest } from "../models/request/seatRequest";
|
||||||
import { SecretVerificationRequest } from '../models/request/secretVerificationRequest';
|
import { SecretVerificationRequest } from "../models/request/secretVerificationRequest";
|
||||||
import { SelectionReadOnlyRequest } from '../models/request/selectionReadOnlyRequest';
|
import { SelectionReadOnlyRequest } from "../models/request/selectionReadOnlyRequest";
|
||||||
import { SendAccessRequest } from '../models/request/sendAccessRequest';
|
import { SendAccessRequest } from "../models/request/sendAccessRequest";
|
||||||
import { SendRequest } from '../models/request/sendRequest';
|
import { SendRequest } from "../models/request/sendRequest";
|
||||||
import { SetPasswordRequest } from '../models/request/setPasswordRequest';
|
import { SetPasswordRequest } from "../models/request/setPasswordRequest";
|
||||||
import { StorageRequest } from '../models/request/storageRequest';
|
import { StorageRequest } from "../models/request/storageRequest";
|
||||||
import { TaxInfoUpdateRequest } from '../models/request/taxInfoUpdateRequest';
|
import { TaxInfoUpdateRequest } from "../models/request/taxInfoUpdateRequest";
|
||||||
import { TokenRequest } from '../models/request/tokenRequest';
|
import { TokenRequest } from "../models/request/tokenRequest";
|
||||||
import { TwoFactorEmailRequest } from '../models/request/twoFactorEmailRequest';
|
import { TwoFactorEmailRequest } from "../models/request/twoFactorEmailRequest";
|
||||||
import { TwoFactorProviderRequest } from '../models/request/twoFactorProviderRequest';
|
import { TwoFactorProviderRequest } from "../models/request/twoFactorProviderRequest";
|
||||||
import { TwoFactorRecoveryRequest } from '../models/request/twoFactorRecoveryRequest';
|
import { TwoFactorRecoveryRequest } from "../models/request/twoFactorRecoveryRequest";
|
||||||
import { UpdateDomainsRequest } from '../models/request/updateDomainsRequest';
|
import { UpdateDomainsRequest } from "../models/request/updateDomainsRequest";
|
||||||
import { UpdateKeyRequest } from '../models/request/updateKeyRequest';
|
import { UpdateKeyRequest } from "../models/request/updateKeyRequest";
|
||||||
import { UpdateProfileRequest } from '../models/request/updateProfileRequest';
|
import { UpdateProfileRequest } from "../models/request/updateProfileRequest";
|
||||||
import { UpdateTempPasswordRequest } from '../models/request/updateTempPasswordRequest';
|
import { UpdateTempPasswordRequest } from "../models/request/updateTempPasswordRequest";
|
||||||
import { UpdateTwoFactorAuthenticatorRequest } from '../models/request/updateTwoFactorAuthenticatorRequest';
|
import { UpdateTwoFactorAuthenticatorRequest } from "../models/request/updateTwoFactorAuthenticatorRequest";
|
||||||
import { UpdateTwoFactorDuoRequest } from '../models/request/updateTwoFactorDuoRequest';
|
import { UpdateTwoFactorDuoRequest } from "../models/request/updateTwoFactorDuoRequest";
|
||||||
import { UpdateTwoFactorEmailRequest } from '../models/request/updateTwoFactorEmailRequest';
|
import { UpdateTwoFactorEmailRequest } from "../models/request/updateTwoFactorEmailRequest";
|
||||||
import { UpdateTwoFactorWebAuthnDeleteRequest } from '../models/request/updateTwoFactorWebAuthnDeleteRequest';
|
import { UpdateTwoFactorWebAuthnDeleteRequest } from "../models/request/updateTwoFactorWebAuthnDeleteRequest";
|
||||||
import { UpdateTwoFactorWebAuthnRequest } from '../models/request/updateTwoFactorWebAuthnRequest';
|
import { UpdateTwoFactorWebAuthnRequest } from "../models/request/updateTwoFactorWebAuthnRequest";
|
||||||
import { UpdateTwoFactorYubioOtpRequest } from '../models/request/updateTwoFactorYubioOtpRequest';
|
import { UpdateTwoFactorYubioOtpRequest } from "../models/request/updateTwoFactorYubioOtpRequest";
|
||||||
import { VerifyBankRequest } from '../models/request/verifyBankRequest';
|
import { VerifyBankRequest } from "../models/request/verifyBankRequest";
|
||||||
import { VerifyDeleteRecoverRequest } from '../models/request/verifyDeleteRecoverRequest';
|
import { VerifyDeleteRecoverRequest } from "../models/request/verifyDeleteRecoverRequest";
|
||||||
import { VerifyEmailRequest } from '../models/request/verifyEmailRequest';
|
import { VerifyEmailRequest } from "../models/request/verifyEmailRequest";
|
||||||
|
|
||||||
import { ApiKeyResponse } from '../models/response/apiKeyResponse';
|
import { ApiKeyResponse } from "../models/response/apiKeyResponse";
|
||||||
import { AttachmentResponse } from '../models/response/attachmentResponse';
|
import { AttachmentResponse } from "../models/response/attachmentResponse";
|
||||||
import { AttachmentUploadDataResponse } from '../models/response/attachmentUploadDataResponse';
|
import { AttachmentUploadDataResponse } from "../models/response/attachmentUploadDataResponse";
|
||||||
import { BillingResponse } from '../models/response/billingResponse';
|
import { BillingResponse } from "../models/response/billingResponse";
|
||||||
import { BreachAccountResponse } from '../models/response/breachAccountResponse';
|
import { BreachAccountResponse } from "../models/response/breachAccountResponse";
|
||||||
import { CipherResponse } from '../models/response/cipherResponse';
|
import { CipherResponse } from "../models/response/cipherResponse";
|
||||||
import {
|
import {
|
||||||
CollectionGroupDetailsResponse,
|
CollectionGroupDetailsResponse,
|
||||||
CollectionResponse,
|
CollectionResponse,
|
||||||
} from '../models/response/collectionResponse';
|
} from "../models/response/collectionResponse";
|
||||||
import { DomainsResponse } from '../models/response/domainsResponse';
|
import { DomainsResponse } from "../models/response/domainsResponse";
|
||||||
import {
|
import {
|
||||||
EmergencyAccessGranteeDetailsResponse,
|
EmergencyAccessGranteeDetailsResponse,
|
||||||
EmergencyAccessGrantorDetailsResponse,
|
EmergencyAccessGrantorDetailsResponse,
|
||||||
EmergencyAccessTakeoverResponse,
|
EmergencyAccessTakeoverResponse,
|
||||||
EmergencyAccessViewResponse
|
EmergencyAccessViewResponse,
|
||||||
} from '../models/response/emergencyAccessResponse';
|
} from "../models/response/emergencyAccessResponse";
|
||||||
import { EventResponse } from '../models/response/eventResponse';
|
import { EventResponse } from "../models/response/eventResponse";
|
||||||
import { FolderResponse } from '../models/response/folderResponse';
|
import { FolderResponse } from "../models/response/folderResponse";
|
||||||
import {
|
import { GroupDetailsResponse, GroupResponse } from "../models/response/groupResponse";
|
||||||
GroupDetailsResponse,
|
import { IdentityCaptchaResponse } from "../models/response/identityCaptchaResponse";
|
||||||
GroupResponse,
|
import { IdentityTokenResponse } from "../models/response/identityTokenResponse";
|
||||||
} from '../models/response/groupResponse';
|
import { IdentityTwoFactorResponse } from "../models/response/identityTwoFactorResponse";
|
||||||
import { IdentityCaptchaResponse } from '../models/response/identityCaptchaResponse';
|
import { KeyConnectorUserKeyResponse } from "../models/response/keyConnectorUserKeyResponse";
|
||||||
import { IdentityTokenResponse } from '../models/response/identityTokenResponse';
|
import { ListResponse } from "../models/response/listResponse";
|
||||||
import { IdentityTwoFactorResponse } from '../models/response/identityTwoFactorResponse';
|
import { OrganizationSsoResponse } from "../models/response/organization/organizationSsoResponse";
|
||||||
import { KeyConnectorUserKeyResponse } from '../models/response/keyConnectorUserKeyResponse';
|
import { OrganizationAutoEnrollStatusResponse } from "../models/response/organizationAutoEnrollStatusResponse";
|
||||||
import { ListResponse } from '../models/response/listResponse';
|
import { OrganizationKeysResponse } from "../models/response/organizationKeysResponse";
|
||||||
import { OrganizationSsoResponse } from '../models/response/organization/organizationSsoResponse';
|
import { OrganizationResponse } from "../models/response/organizationResponse";
|
||||||
import { OrganizationAutoEnrollStatusResponse } from '../models/response/organizationAutoEnrollStatusResponse';
|
import { OrganizationSubscriptionResponse } from "../models/response/organizationSubscriptionResponse";
|
||||||
import { OrganizationKeysResponse } from '../models/response/organizationKeysResponse';
|
import { OrganizationUserBulkPublicKeyResponse } from "../models/response/organizationUserBulkPublicKeyResponse";
|
||||||
import { OrganizationResponse } from '../models/response/organizationResponse';
|
import { OrganizationUserBulkResponse } from "../models/response/organizationUserBulkResponse";
|
||||||
import { OrganizationSubscriptionResponse } from '../models/response/organizationSubscriptionResponse';
|
|
||||||
import { OrganizationUserBulkPublicKeyResponse } from '../models/response/organizationUserBulkPublicKeyResponse';
|
|
||||||
import { OrganizationUserBulkResponse } from '../models/response/organizationUserBulkResponse';
|
|
||||||
import {
|
import {
|
||||||
OrganizationUserDetailsResponse,
|
OrganizationUserDetailsResponse,
|
||||||
OrganizationUserResetPasswordDetailsReponse,
|
OrganizationUserResetPasswordDetailsReponse,
|
||||||
OrganizationUserUserDetailsResponse,
|
OrganizationUserUserDetailsResponse,
|
||||||
} from '../models/response/organizationUserResponse';
|
} from "../models/response/organizationUserResponse";
|
||||||
import { PaymentResponse } from '../models/response/paymentResponse';
|
import { PaymentResponse } from "../models/response/paymentResponse";
|
||||||
import { PlanResponse } from '../models/response/planResponse';
|
import { PlanResponse } from "../models/response/planResponse";
|
||||||
import { PolicyResponse } from '../models/response/policyResponse';
|
import { PolicyResponse } from "../models/response/policyResponse";
|
||||||
import { PreloginResponse } from '../models/response/preloginResponse';
|
import { PreloginResponse } from "../models/response/preloginResponse";
|
||||||
import { ProfileResponse } from '../models/response/profileResponse';
|
import { ProfileResponse } from "../models/response/profileResponse";
|
||||||
import { ProviderOrganizationOrganizationDetailsResponse, ProviderOrganizationResponse } from '../models/response/provider/providerOrganizationResponse';
|
import {
|
||||||
import { ProviderResponse } from '../models/response/provider/providerResponse';
|
ProviderOrganizationOrganizationDetailsResponse,
|
||||||
import { ProviderUserBulkPublicKeyResponse } from '../models/response/provider/providerUserBulkPublicKeyResponse';
|
ProviderOrganizationResponse,
|
||||||
import { ProviderUserBulkResponse } from '../models/response/provider/providerUserBulkResponse';
|
} from "../models/response/provider/providerOrganizationResponse";
|
||||||
import { ProviderUserResponse, ProviderUserUserDetailsResponse } from '../models/response/provider/providerUserResponse';
|
import { ProviderResponse } from "../models/response/provider/providerResponse";
|
||||||
import { SelectionReadOnlyResponse } from '../models/response/selectionReadOnlyResponse';
|
import { ProviderUserBulkPublicKeyResponse } from "../models/response/provider/providerUserBulkPublicKeyResponse";
|
||||||
import { SendAccessResponse } from '../models/response/sendAccessResponse';
|
import { ProviderUserBulkResponse } from "../models/response/provider/providerUserBulkResponse";
|
||||||
import { SendFileDownloadDataResponse } from '../models/response/sendFileDownloadDataResponse';
|
import {
|
||||||
import { SendFileUploadDataResponse } from '../models/response/sendFileUploadDataResponse';
|
ProviderUserResponse,
|
||||||
import { SendResponse } from '../models/response/sendResponse';
|
ProviderUserUserDetailsResponse,
|
||||||
import { SubscriptionResponse } from '../models/response/subscriptionResponse';
|
} from "../models/response/provider/providerUserResponse";
|
||||||
import { SyncResponse } from '../models/response/syncResponse';
|
import { SelectionReadOnlyResponse } from "../models/response/selectionReadOnlyResponse";
|
||||||
import { TaxInfoResponse } from '../models/response/taxInfoResponse';
|
import { SendAccessResponse } from "../models/response/sendAccessResponse";
|
||||||
import { TaxRateResponse } from '../models/response/taxRateResponse';
|
import { SendFileDownloadDataResponse } from "../models/response/sendFileDownloadDataResponse";
|
||||||
import { TwoFactorAuthenticatorResponse } from '../models/response/twoFactorAuthenticatorResponse';
|
import { SendFileUploadDataResponse } from "../models/response/sendFileUploadDataResponse";
|
||||||
import { TwoFactorDuoResponse } from '../models/response/twoFactorDuoResponse';
|
import { SendResponse } from "../models/response/sendResponse";
|
||||||
import { TwoFactorEmailResponse } from '../models/response/twoFactorEmailResponse';
|
import { SubscriptionResponse } from "../models/response/subscriptionResponse";
|
||||||
import { TwoFactorProviderResponse } from '../models/response/twoFactorProviderResponse';
|
import { SyncResponse } from "../models/response/syncResponse";
|
||||||
import { TwoFactorRecoverResponse } from '../models/response/twoFactorRescoverResponse';
|
import { TaxInfoResponse } from "../models/response/taxInfoResponse";
|
||||||
import { ChallengeResponse, TwoFactorWebAuthnResponse } from '../models/response/twoFactorWebAuthnResponse';
|
import { TaxRateResponse } from "../models/response/taxRateResponse";
|
||||||
import { TwoFactorYubiKeyResponse } from '../models/response/twoFactorYubiKeyResponse';
|
import { TwoFactorAuthenticatorResponse } from "../models/response/twoFactorAuthenticatorResponse";
|
||||||
import { UserKeyResponse } from '../models/response/userKeyResponse';
|
import { TwoFactorDuoResponse } from "../models/response/twoFactorDuoResponse";
|
||||||
|
import { TwoFactorEmailResponse } from "../models/response/twoFactorEmailResponse";
|
||||||
|
import { TwoFactorProviderResponse } from "../models/response/twoFactorProviderResponse";
|
||||||
|
import { TwoFactorRecoverResponse } from "../models/response/twoFactorRescoverResponse";
|
||||||
|
import {
|
||||||
|
ChallengeResponse,
|
||||||
|
TwoFactorWebAuthnResponse,
|
||||||
|
} from "../models/response/twoFactorWebAuthnResponse";
|
||||||
|
import { TwoFactorYubiKeyResponse } from "../models/response/twoFactorYubiKeyResponse";
|
||||||
|
import { UserKeyResponse } from "../models/response/userKeyResponse";
|
||||||
|
|
||||||
import { SendAccessView } from '../models/view/sendAccessView';
|
import { SendAccessView } from "../models/view/sendAccessView";
|
||||||
|
|
||||||
export abstract class ApiService {
|
export abstract class ApiService {
|
||||||
postIdentityToken: (request: TokenRequest) => Promise<IdentityTokenResponse | IdentityTwoFactorResponse | IdentityCaptchaResponse>;
|
postIdentityToken: (
|
||||||
|
request: TokenRequest
|
||||||
|
) => Promise<IdentityTokenResponse | IdentityTwoFactorResponse | IdentityCaptchaResponse>;
|
||||||
refreshIdentityToken: () => Promise<any>;
|
refreshIdentityToken: () => Promise<any>;
|
||||||
|
|
||||||
getProfile: () => Promise<ProfileResponse>;
|
getProfile: () => Promise<ProfileResponse>;
|
||||||
@@ -212,7 +220,11 @@ export abstract class ApiService {
|
|||||||
deleteFolder: (id: string) => Promise<any>;
|
deleteFolder: (id: string) => Promise<any>;
|
||||||
|
|
||||||
getSend: (id: string) => Promise<SendResponse>;
|
getSend: (id: string) => Promise<SendResponse>;
|
||||||
postSendAccess: (id: string, request: SendAccessRequest, apiUrl?: string) => Promise<SendAccessResponse>;
|
postSendAccess: (
|
||||||
|
id: string,
|
||||||
|
request: SendAccessRequest,
|
||||||
|
apiUrl?: string
|
||||||
|
) => Promise<SendAccessResponse>;
|
||||||
getSends: () => Promise<ListResponse<SendResponse>>;
|
getSends: () => Promise<ListResponse<SendResponse>>;
|
||||||
postSend: (request: SendRequest) => Promise<SendResponse>;
|
postSend: (request: SendRequest) => Promise<SendResponse>;
|
||||||
postFileTypeSend: (request: SendRequest) => Promise<SendFileUploadDataResponse>;
|
postFileTypeSend: (request: SendRequest) => Promise<SendFileUploadDataResponse>;
|
||||||
@@ -225,12 +237,20 @@ export abstract class ApiService {
|
|||||||
putSend: (id: string, request: SendRequest) => Promise<SendResponse>;
|
putSend: (id: string, request: SendRequest) => Promise<SendResponse>;
|
||||||
putSendRemovePassword: (id: string) => Promise<SendResponse>;
|
putSendRemovePassword: (id: string) => Promise<SendResponse>;
|
||||||
deleteSend: (id: string) => Promise<any>;
|
deleteSend: (id: string) => Promise<any>;
|
||||||
getSendFileDownloadData: (send: SendAccessView, request: SendAccessRequest, apiUrl?: string) => Promise<SendFileDownloadDataResponse>;
|
getSendFileDownloadData: (
|
||||||
|
send: SendAccessView,
|
||||||
|
request: SendAccessRequest,
|
||||||
|
apiUrl?: string
|
||||||
|
) => Promise<SendFileDownloadDataResponse>;
|
||||||
renewSendFileUploadUrl: (sendId: string, fileId: string) => Promise<SendFileUploadDataResponse>;
|
renewSendFileUploadUrl: (sendId: string, fileId: string) => Promise<SendFileUploadDataResponse>;
|
||||||
|
|
||||||
getCipher: (id: string) => Promise<CipherResponse>;
|
getCipher: (id: string) => Promise<CipherResponse>;
|
||||||
getCipherAdmin: (id: string) => Promise<CipherResponse>;
|
getCipherAdmin: (id: string) => Promise<CipherResponse>;
|
||||||
getAttachmentData: (cipherId: string, attachmentId: string, emergencyAccessId?: string) => Promise<AttachmentResponse>;
|
getAttachmentData: (
|
||||||
|
cipherId: string,
|
||||||
|
attachmentId: string,
|
||||||
|
emergencyAccessId?: string
|
||||||
|
) => Promise<AttachmentResponse>;
|
||||||
getCiphersOrganization: (organizationId: string) => Promise<ListResponse<CipherResponse>>;
|
getCiphersOrganization: (organizationId: string) => Promise<ListResponse<CipherResponse>>;
|
||||||
postCipher: (request: CipherRequest) => Promise<CipherResponse>;
|
postCipher: (request: CipherRequest) => Promise<CipherResponse>;
|
||||||
postCipherCreate: (request: CipherCreateRequest) => Promise<CipherResponse>;
|
postCipherCreate: (request: CipherCreateRequest) => Promise<CipherResponse>;
|
||||||
@@ -248,14 +268,19 @@ export abstract class ApiService {
|
|||||||
putCipherCollectionsAdmin: (id: string, request: CipherCollectionsRequest) => Promise<any>;
|
putCipherCollectionsAdmin: (id: string, request: CipherCollectionsRequest) => Promise<any>;
|
||||||
postPurgeCiphers: (request: SecretVerificationRequest, organizationId?: string) => Promise<any>;
|
postPurgeCiphers: (request: SecretVerificationRequest, organizationId?: string) => Promise<any>;
|
||||||
postImportCiphers: (request: ImportCiphersRequest) => Promise<any>;
|
postImportCiphers: (request: ImportCiphersRequest) => Promise<any>;
|
||||||
postImportOrganizationCiphers: (organizationId: string, request: ImportOrganizationCiphersRequest) => Promise<any>;
|
postImportOrganizationCiphers: (
|
||||||
|
organizationId: string,
|
||||||
|
request: ImportOrganizationCiphersRequest
|
||||||
|
) => Promise<any>;
|
||||||
putDeleteCipher: (id: string) => Promise<any>;
|
putDeleteCipher: (id: string) => Promise<any>;
|
||||||
putDeleteCipherAdmin: (id: string) => Promise<any>;
|
putDeleteCipherAdmin: (id: string) => Promise<any>;
|
||||||
putDeleteManyCiphers: (request: CipherBulkDeleteRequest) => Promise<any>;
|
putDeleteManyCiphers: (request: CipherBulkDeleteRequest) => Promise<any>;
|
||||||
putDeleteManyCiphersAdmin: (request: CipherBulkDeleteRequest) => Promise<any>;
|
putDeleteManyCiphersAdmin: (request: CipherBulkDeleteRequest) => Promise<any>;
|
||||||
putRestoreCipher: (id: string) => Promise<CipherResponse>;
|
putRestoreCipher: (id: string) => Promise<CipherResponse>;
|
||||||
putRestoreCipherAdmin: (id: string) => Promise<CipherResponse>;
|
putRestoreCipherAdmin: (id: string) => Promise<CipherResponse>;
|
||||||
putRestoreManyCiphers: (request: CipherBulkRestoreRequest) => Promise<ListResponse<CipherResponse>>;
|
putRestoreManyCiphers: (
|
||||||
|
request: CipherBulkRestoreRequest
|
||||||
|
) => Promise<ListResponse<CipherResponse>>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated Mar 25 2021: This method has been deprecated in favor of direct uploads.
|
* @deprecated Mar 25 2021: This method has been deprecated in favor of direct uploads.
|
||||||
@@ -267,23 +292,51 @@ export abstract class ApiService {
|
|||||||
* This method still exists for backward compatibility with old server versions.
|
* This method still exists for backward compatibility with old server versions.
|
||||||
*/
|
*/
|
||||||
postCipherAttachmentAdminLegacy: (id: string, data: FormData) => Promise<CipherResponse>;
|
postCipherAttachmentAdminLegacy: (id: string, data: FormData) => Promise<CipherResponse>;
|
||||||
postCipherAttachment: (id: string, request: AttachmentRequest) => Promise<AttachmentUploadDataResponse>;
|
postCipherAttachment: (
|
||||||
|
id: string,
|
||||||
|
request: AttachmentRequest
|
||||||
|
) => Promise<AttachmentUploadDataResponse>;
|
||||||
deleteCipherAttachment: (id: string, attachmentId: string) => Promise<any>;
|
deleteCipherAttachment: (id: string, attachmentId: string) => Promise<any>;
|
||||||
deleteCipherAttachmentAdmin: (id: string, attachmentId: string) => Promise<any>;
|
deleteCipherAttachmentAdmin: (id: string, attachmentId: string) => Promise<any>;
|
||||||
postShareCipherAttachment: (id: string, attachmentId: string, data: FormData,
|
postShareCipherAttachment: (
|
||||||
organizationId: string) => Promise<any>;
|
id: string,
|
||||||
renewAttachmentUploadUrl: (id: string, attachmentId: string) => Promise<AttachmentUploadDataResponse>;
|
attachmentId: string,
|
||||||
|
data: FormData,
|
||||||
|
organizationId: string
|
||||||
|
) => Promise<any>;
|
||||||
|
renewAttachmentUploadUrl: (
|
||||||
|
id: string,
|
||||||
|
attachmentId: string
|
||||||
|
) => Promise<AttachmentUploadDataResponse>;
|
||||||
postAttachmentFile: (id: string, attachmentId: string, data: FormData) => Promise<any>;
|
postAttachmentFile: (id: string, attachmentId: string, data: FormData) => Promise<any>;
|
||||||
|
|
||||||
getCollectionDetails: (organizationId: string, id: string) => Promise<CollectionGroupDetailsResponse>;
|
getCollectionDetails: (
|
||||||
|
organizationId: string,
|
||||||
|
id: string
|
||||||
|
) => Promise<CollectionGroupDetailsResponse>;
|
||||||
getUserCollections: () => Promise<ListResponse<CollectionResponse>>;
|
getUserCollections: () => Promise<ListResponse<CollectionResponse>>;
|
||||||
getCollections: (organizationId: string) => Promise<ListResponse<CollectionResponse>>;
|
getCollections: (organizationId: string) => Promise<ListResponse<CollectionResponse>>;
|
||||||
getCollectionUsers: (organizationId: string, id: string) => Promise<SelectionReadOnlyResponse[]>;
|
getCollectionUsers: (organizationId: string, id: string) => Promise<SelectionReadOnlyResponse[]>;
|
||||||
postCollection: (organizationId: string, request: CollectionRequest) => Promise<CollectionResponse>;
|
postCollection: (
|
||||||
putCollectionUsers: (organizationId: string, id: string, request: SelectionReadOnlyRequest[]) => Promise<any>;
|
organizationId: string,
|
||||||
putCollection: (organizationId: string, id: string, request: CollectionRequest) => Promise<CollectionResponse>;
|
request: CollectionRequest
|
||||||
|
) => Promise<CollectionResponse>;
|
||||||
|
putCollectionUsers: (
|
||||||
|
organizationId: string,
|
||||||
|
id: string,
|
||||||
|
request: SelectionReadOnlyRequest[]
|
||||||
|
) => Promise<any>;
|
||||||
|
putCollection: (
|
||||||
|
organizationId: string,
|
||||||
|
id: string,
|
||||||
|
request: CollectionRequest
|
||||||
|
) => Promise<CollectionResponse>;
|
||||||
deleteCollection: (organizationId: string, id: string) => Promise<any>;
|
deleteCollection: (organizationId: string, id: string) => Promise<any>;
|
||||||
deleteCollectionUser: (organizationId: string, id: string, organizationUserId: string) => Promise<any>;
|
deleteCollectionUser: (
|
||||||
|
organizationId: string,
|
||||||
|
id: string,
|
||||||
|
organizationUserId: string
|
||||||
|
) => Promise<any>;
|
||||||
|
|
||||||
getGroupDetails: (organizationId: string, id: string) => Promise<GroupDetailsResponse>;
|
getGroupDetails: (organizationId: string, id: string) => Promise<GroupDetailsResponse>;
|
||||||
getGroups: (organizationId: string) => Promise<ListResponse<GroupResponse>>;
|
getGroups: (organizationId: string) => Promise<ListResponse<GroupResponse>>;
|
||||||
@@ -296,35 +349,83 @@ export abstract class ApiService {
|
|||||||
|
|
||||||
getPolicy: (organizationId: string, type: PolicyType) => Promise<PolicyResponse>;
|
getPolicy: (organizationId: string, type: PolicyType) => Promise<PolicyResponse>;
|
||||||
getPolicies: (organizationId: string) => Promise<ListResponse<PolicyResponse>>;
|
getPolicies: (organizationId: string) => Promise<ListResponse<PolicyResponse>>;
|
||||||
getPoliciesByToken: (organizationId: string, token: string, email: string, organizationUserId: string) =>
|
getPoliciesByToken: (
|
||||||
Promise<ListResponse<PolicyResponse>>;
|
organizationId: string,
|
||||||
putPolicy: (organizationId: string, type: PolicyType, request: PolicyRequest) => Promise<PolicyResponse>;
|
token: string,
|
||||||
|
email: string,
|
||||||
|
organizationUserId: string
|
||||||
|
) => Promise<ListResponse<PolicyResponse>>;
|
||||||
|
putPolicy: (
|
||||||
|
organizationId: string,
|
||||||
|
type: PolicyType,
|
||||||
|
request: PolicyRequest
|
||||||
|
) => Promise<PolicyResponse>;
|
||||||
|
|
||||||
getOrganizationUser: (organizationId: string, id: string) => Promise<OrganizationUserDetailsResponse>;
|
getOrganizationUser: (
|
||||||
|
organizationId: string,
|
||||||
|
id: string
|
||||||
|
) => Promise<OrganizationUserDetailsResponse>;
|
||||||
getOrganizationUserGroups: (organizationId: string, id: string) => Promise<string[]>;
|
getOrganizationUserGroups: (organizationId: string, id: string) => Promise<string[]>;
|
||||||
getOrganizationUsers: (organizationId: string) => Promise<ListResponse<OrganizationUserUserDetailsResponse>>;
|
getOrganizationUsers: (
|
||||||
getOrganizationUserResetPasswordDetails: (organizationId: string, id: string)
|
organizationId: string
|
||||||
=> Promise<OrganizationUserResetPasswordDetailsReponse>;
|
) => Promise<ListResponse<OrganizationUserUserDetailsResponse>>;
|
||||||
postOrganizationUserInvite: (organizationId: string, request: OrganizationUserInviteRequest) => Promise<any>;
|
getOrganizationUserResetPasswordDetails: (
|
||||||
|
organizationId: string,
|
||||||
|
id: string
|
||||||
|
) => Promise<OrganizationUserResetPasswordDetailsReponse>;
|
||||||
|
postOrganizationUserInvite: (
|
||||||
|
organizationId: string,
|
||||||
|
request: OrganizationUserInviteRequest
|
||||||
|
) => Promise<any>;
|
||||||
postOrganizationUserReinvite: (organizationId: string, id: string) => Promise<any>;
|
postOrganizationUserReinvite: (organizationId: string, id: string) => Promise<any>;
|
||||||
postManyOrganizationUserReinvite: (organizationId: string, request: OrganizationUserBulkRequest) => Promise<ListResponse<OrganizationUserBulkResponse>>;
|
postManyOrganizationUserReinvite: (
|
||||||
postOrganizationUserAccept: (organizationId: string, id: string,
|
organizationId: string,
|
||||||
request: OrganizationUserAcceptRequest) => Promise<any>;
|
request: OrganizationUserBulkRequest
|
||||||
postOrganizationUserConfirm: (organizationId: string, id: string,
|
) => Promise<ListResponse<OrganizationUserBulkResponse>>;
|
||||||
request: OrganizationUserConfirmRequest) => Promise<any>;
|
postOrganizationUserAccept: (
|
||||||
postOrganizationUsersPublicKey: (organizationId: string, request: OrganizationUserBulkRequest) =>
|
organizationId: string,
|
||||||
Promise<ListResponse<OrganizationUserBulkPublicKeyResponse>>;
|
id: string,
|
||||||
postOrganizationUserBulkConfirm: (organizationId: string, request: OrganizationUserBulkConfirmRequest) => Promise<ListResponse<OrganizationUserBulkResponse>>;
|
request: OrganizationUserAcceptRequest
|
||||||
|
) => Promise<any>;
|
||||||
|
postOrganizationUserConfirm: (
|
||||||
|
organizationId: string,
|
||||||
|
id: string,
|
||||||
|
request: OrganizationUserConfirmRequest
|
||||||
|
) => Promise<any>;
|
||||||
|
postOrganizationUsersPublicKey: (
|
||||||
|
organizationId: string,
|
||||||
|
request: OrganizationUserBulkRequest
|
||||||
|
) => Promise<ListResponse<OrganizationUserBulkPublicKeyResponse>>;
|
||||||
|
postOrganizationUserBulkConfirm: (
|
||||||
|
organizationId: string,
|
||||||
|
request: OrganizationUserBulkConfirmRequest
|
||||||
|
) => Promise<ListResponse<OrganizationUserBulkResponse>>;
|
||||||
|
|
||||||
putOrganizationUser: (organizationId: string, id: string, request: OrganizationUserUpdateRequest) => Promise<any>;
|
putOrganizationUser: (
|
||||||
putOrganizationUserGroups: (organizationId: string, id: string,
|
organizationId: string,
|
||||||
request: OrganizationUserUpdateGroupsRequest) => Promise<any>;
|
id: string,
|
||||||
putOrganizationUserResetPasswordEnrollment: (organizationId: string, userId: string,
|
request: OrganizationUserUpdateRequest
|
||||||
request: OrganizationUserResetPasswordEnrollmentRequest) => Promise<any>;
|
) => Promise<any>;
|
||||||
putOrganizationUserResetPassword: (organizationId: string, id: string,
|
putOrganizationUserGroups: (
|
||||||
request: OrganizationUserResetPasswordRequest) => Promise<any>;
|
organizationId: string,
|
||||||
|
id: string,
|
||||||
|
request: OrganizationUserUpdateGroupsRequest
|
||||||
|
) => Promise<any>;
|
||||||
|
putOrganizationUserResetPasswordEnrollment: (
|
||||||
|
organizationId: string,
|
||||||
|
userId: string,
|
||||||
|
request: OrganizationUserResetPasswordEnrollmentRequest
|
||||||
|
) => Promise<any>;
|
||||||
|
putOrganizationUserResetPassword: (
|
||||||
|
organizationId: string,
|
||||||
|
id: string,
|
||||||
|
request: OrganizationUserResetPasswordRequest
|
||||||
|
) => Promise<any>;
|
||||||
deleteOrganizationUser: (organizationId: string, id: string) => Promise<any>;
|
deleteOrganizationUser: (organizationId: string, id: string) => Promise<any>;
|
||||||
deleteManyOrganizationUsers: (organizationId: string, request: OrganizationUserBulkRequest) => Promise<ListResponse<OrganizationUserBulkResponse>>;
|
deleteManyOrganizationUsers: (
|
||||||
|
organizationId: string,
|
||||||
|
request: OrganizationUserBulkRequest
|
||||||
|
) => Promise<ListResponse<OrganizationUserBulkResponse>>;
|
||||||
|
|
||||||
getSync: () => Promise<SyncResponse>;
|
getSync: () => Promise<SyncResponse>;
|
||||||
postImportDirectory: (organizationId: string, request: ImportDirectoryRequest) => Promise<any>;
|
postImportDirectory: (organizationId: string, request: ImportDirectoryRequest) => Promise<any>;
|
||||||
@@ -334,28 +435,45 @@ export abstract class ApiService {
|
|||||||
putSettingsDomains: (request: UpdateDomainsRequest) => Promise<DomainsResponse>;
|
putSettingsDomains: (request: UpdateDomainsRequest) => Promise<DomainsResponse>;
|
||||||
|
|
||||||
getTwoFactorProviders: () => Promise<ListResponse<TwoFactorProviderResponse>>;
|
getTwoFactorProviders: () => Promise<ListResponse<TwoFactorProviderResponse>>;
|
||||||
getTwoFactorOrganizationProviders: (organizationId: string) => Promise<ListResponse<TwoFactorProviderResponse>>;
|
getTwoFactorOrganizationProviders: (
|
||||||
getTwoFactorAuthenticator: (request: SecretVerificationRequest) => Promise<TwoFactorAuthenticatorResponse>;
|
organizationId: string
|
||||||
|
) => Promise<ListResponse<TwoFactorProviderResponse>>;
|
||||||
|
getTwoFactorAuthenticator: (
|
||||||
|
request: SecretVerificationRequest
|
||||||
|
) => Promise<TwoFactorAuthenticatorResponse>;
|
||||||
getTwoFactorEmail: (request: SecretVerificationRequest) => Promise<TwoFactorEmailResponse>;
|
getTwoFactorEmail: (request: SecretVerificationRequest) => Promise<TwoFactorEmailResponse>;
|
||||||
getTwoFactorDuo: (request: SecretVerificationRequest) => Promise<TwoFactorDuoResponse>;
|
getTwoFactorDuo: (request: SecretVerificationRequest) => Promise<TwoFactorDuoResponse>;
|
||||||
getTwoFactorOrganizationDuo: (organizationId: string,
|
getTwoFactorOrganizationDuo: (
|
||||||
request: SecretVerificationRequest) => Promise<TwoFactorDuoResponse>;
|
organizationId: string,
|
||||||
|
request: SecretVerificationRequest
|
||||||
|
) => Promise<TwoFactorDuoResponse>;
|
||||||
getTwoFactorYubiKey: (request: SecretVerificationRequest) => Promise<TwoFactorYubiKeyResponse>;
|
getTwoFactorYubiKey: (request: SecretVerificationRequest) => Promise<TwoFactorYubiKeyResponse>;
|
||||||
getTwoFactorWebAuthn: (request: SecretVerificationRequest) => Promise<TwoFactorWebAuthnResponse>;
|
getTwoFactorWebAuthn: (request: SecretVerificationRequest) => Promise<TwoFactorWebAuthnResponse>;
|
||||||
getTwoFactorWebAuthnChallenge: (request: SecretVerificationRequest) => Promise<ChallengeResponse>;
|
getTwoFactorWebAuthnChallenge: (request: SecretVerificationRequest) => Promise<ChallengeResponse>;
|
||||||
getTwoFactorRecover: (request: SecretVerificationRequest) => Promise<TwoFactorRecoverResponse>;
|
getTwoFactorRecover: (request: SecretVerificationRequest) => Promise<TwoFactorRecoverResponse>;
|
||||||
putTwoFactorAuthenticator: (
|
putTwoFactorAuthenticator: (
|
||||||
request: UpdateTwoFactorAuthenticatorRequest) => Promise<TwoFactorAuthenticatorResponse>;
|
request: UpdateTwoFactorAuthenticatorRequest
|
||||||
|
) => Promise<TwoFactorAuthenticatorResponse>;
|
||||||
putTwoFactorEmail: (request: UpdateTwoFactorEmailRequest) => Promise<TwoFactorEmailResponse>;
|
putTwoFactorEmail: (request: UpdateTwoFactorEmailRequest) => Promise<TwoFactorEmailResponse>;
|
||||||
putTwoFactorDuo: (request: UpdateTwoFactorDuoRequest) => Promise<TwoFactorDuoResponse>;
|
putTwoFactorDuo: (request: UpdateTwoFactorDuoRequest) => Promise<TwoFactorDuoResponse>;
|
||||||
putTwoFactorOrganizationDuo: (organizationId: string,
|
putTwoFactorOrganizationDuo: (
|
||||||
request: UpdateTwoFactorDuoRequest) => Promise<TwoFactorDuoResponse>;
|
organizationId: string,
|
||||||
putTwoFactorYubiKey: (request: UpdateTwoFactorYubioOtpRequest) => Promise<TwoFactorYubiKeyResponse>;
|
request: UpdateTwoFactorDuoRequest
|
||||||
putTwoFactorWebAuthn: (request: UpdateTwoFactorWebAuthnRequest) => Promise<TwoFactorWebAuthnResponse>;
|
) => Promise<TwoFactorDuoResponse>;
|
||||||
deleteTwoFactorWebAuthn: (request: UpdateTwoFactorWebAuthnDeleteRequest) => Promise<TwoFactorWebAuthnResponse>;
|
putTwoFactorYubiKey: (
|
||||||
|
request: UpdateTwoFactorYubioOtpRequest
|
||||||
|
) => Promise<TwoFactorYubiKeyResponse>;
|
||||||
|
putTwoFactorWebAuthn: (
|
||||||
|
request: UpdateTwoFactorWebAuthnRequest
|
||||||
|
) => Promise<TwoFactorWebAuthnResponse>;
|
||||||
|
deleteTwoFactorWebAuthn: (
|
||||||
|
request: UpdateTwoFactorWebAuthnDeleteRequest
|
||||||
|
) => Promise<TwoFactorWebAuthnResponse>;
|
||||||
putTwoFactorDisable: (request: TwoFactorProviderRequest) => Promise<TwoFactorProviderResponse>;
|
putTwoFactorDisable: (request: TwoFactorProviderRequest) => Promise<TwoFactorProviderResponse>;
|
||||||
putTwoFactorOrganizationDisable: (organizationId: string,
|
putTwoFactorOrganizationDisable: (
|
||||||
request: TwoFactorProviderRequest) => Promise<TwoFactorProviderResponse>;
|
organizationId: string,
|
||||||
|
request: TwoFactorProviderRequest
|
||||||
|
) => Promise<TwoFactorProviderResponse>;
|
||||||
postTwoFactorRecover: (request: TwoFactorRecoveryRequest) => Promise<any>;
|
postTwoFactorRecover: (request: TwoFactorRecoveryRequest) => Promise<any>;
|
||||||
postTwoFactorEmailSetup: (request: TwoFactorEmailRequest) => Promise<any>;
|
postTwoFactorEmailSetup: (request: TwoFactorEmailRequest) => Promise<any>;
|
||||||
postTwoFactorEmail: (request: TwoFactorEmailRequest) => Promise<any>;
|
postTwoFactorEmail: (request: TwoFactorEmailRequest) => Promise<any>;
|
||||||
@@ -374,7 +492,10 @@ export abstract class ApiService {
|
|||||||
postEmergencyAccessApprove: (id: string) => Promise<any>;
|
postEmergencyAccessApprove: (id: string) => Promise<any>;
|
||||||
postEmergencyAccessReject: (id: string) => Promise<any>;
|
postEmergencyAccessReject: (id: string) => Promise<any>;
|
||||||
postEmergencyAccessTakeover: (id: string) => Promise<EmergencyAccessTakeoverResponse>;
|
postEmergencyAccessTakeover: (id: string) => Promise<EmergencyAccessTakeoverResponse>;
|
||||||
postEmergencyAccessPassword: (id: string, request: EmergencyAccessPasswordRequest) => Promise<any>;
|
postEmergencyAccessPassword: (
|
||||||
|
id: string,
|
||||||
|
request: EmergencyAccessPasswordRequest
|
||||||
|
) => Promise<any>;
|
||||||
postEmergencyAccessView: (id: string) => Promise<EmergencyAccessViewResponse>;
|
postEmergencyAccessView: (id: string) => Promise<EmergencyAccessViewResponse>;
|
||||||
|
|
||||||
getOrganization: (id: string) => Promise<OrganizationResponse>;
|
getOrganization: (id: string) => Promise<OrganizationResponse>;
|
||||||
@@ -382,19 +503,39 @@ export abstract class ApiService {
|
|||||||
getOrganizationSubscription: (id: string) => Promise<OrganizationSubscriptionResponse>;
|
getOrganizationSubscription: (id: string) => Promise<OrganizationSubscriptionResponse>;
|
||||||
getOrganizationLicense: (id: string, installationId: string) => Promise<any>;
|
getOrganizationLicense: (id: string, installationId: string) => Promise<any>;
|
||||||
getOrganizationTaxInfo: (id: string) => Promise<TaxInfoResponse>;
|
getOrganizationTaxInfo: (id: string) => Promise<TaxInfoResponse>;
|
||||||
getOrganizationAutoEnrollStatus: (identifier: string) => Promise<OrganizationAutoEnrollStatusResponse>;
|
getOrganizationAutoEnrollStatus: (
|
||||||
|
identifier: string
|
||||||
|
) => Promise<OrganizationAutoEnrollStatusResponse>;
|
||||||
getOrganizationSso: (id: string) => Promise<OrganizationSsoResponse>;
|
getOrganizationSso: (id: string) => Promise<OrganizationSsoResponse>;
|
||||||
postOrganization: (request: OrganizationCreateRequest) => Promise<OrganizationResponse>;
|
postOrganization: (request: OrganizationCreateRequest) => Promise<OrganizationResponse>;
|
||||||
putOrganization: (id: string, request: OrganizationUpdateRequest) => Promise<OrganizationResponse>;
|
putOrganization: (
|
||||||
|
id: string,
|
||||||
|
request: OrganizationUpdateRequest
|
||||||
|
) => Promise<OrganizationResponse>;
|
||||||
putOrganizationTaxInfo: (id: string, request: OrganizationTaxInfoUpdateRequest) => Promise<any>;
|
putOrganizationTaxInfo: (id: string, request: OrganizationTaxInfoUpdateRequest) => Promise<any>;
|
||||||
postLeaveOrganization: (id: string) => Promise<any>;
|
postLeaveOrganization: (id: string) => Promise<any>;
|
||||||
postOrganizationLicense: (data: FormData) => Promise<OrganizationResponse>;
|
postOrganizationLicense: (data: FormData) => Promise<OrganizationResponse>;
|
||||||
postOrganizationLicenseUpdate: (id: string, data: FormData) => Promise<any>;
|
postOrganizationLicenseUpdate: (id: string, data: FormData) => Promise<any>;
|
||||||
postOrganizationApiKey: (id: string, request: SecretVerificationRequest) => Promise<ApiKeyResponse>;
|
postOrganizationApiKey: (
|
||||||
postOrganizationRotateApiKey: (id: string, request: SecretVerificationRequest) => Promise<ApiKeyResponse>;
|
id: string,
|
||||||
postOrganizationSso: (id: string, request: OrganizationSsoRequest) => Promise<OrganizationSsoResponse>;
|
request: SecretVerificationRequest
|
||||||
postOrganizationUpgrade: (id: string, request: OrganizationUpgradeRequest) => Promise<PaymentResponse>;
|
) => Promise<ApiKeyResponse>;
|
||||||
postOrganizationUpdateSubscription: (id: string, request: OrganizationSubscriptionUpdateRequest) => Promise<void>;
|
postOrganizationRotateApiKey: (
|
||||||
|
id: string,
|
||||||
|
request: SecretVerificationRequest
|
||||||
|
) => Promise<ApiKeyResponse>;
|
||||||
|
postOrganizationSso: (
|
||||||
|
id: string,
|
||||||
|
request: OrganizationSsoRequest
|
||||||
|
) => Promise<OrganizationSsoResponse>;
|
||||||
|
postOrganizationUpgrade: (
|
||||||
|
id: string,
|
||||||
|
request: OrganizationUpgradeRequest
|
||||||
|
) => Promise<PaymentResponse>;
|
||||||
|
postOrganizationUpdateSubscription: (
|
||||||
|
id: string,
|
||||||
|
request: OrganizationSubscriptionUpdateRequest
|
||||||
|
) => Promise<void>;
|
||||||
postOrganizationSeat: (id: string, request: SeatRequest) => Promise<PaymentResponse>;
|
postOrganizationSeat: (id: string, request: SeatRequest) => Promise<PaymentResponse>;
|
||||||
postOrganizationStorage: (id: string, request: StorageRequest) => Promise<any>;
|
postOrganizationStorage: (id: string, request: StorageRequest) => Promise<any>;
|
||||||
postOrganizationPayment: (id: string, request: PaymentRequest) => Promise<any>;
|
postOrganizationPayment: (id: string, request: PaymentRequest) => Promise<any>;
|
||||||
@@ -405,7 +546,10 @@ export abstract class ApiService {
|
|||||||
getPlans: () => Promise<ListResponse<PlanResponse>>;
|
getPlans: () => Promise<ListResponse<PlanResponse>>;
|
||||||
getTaxRates: () => Promise<ListResponse<TaxRateResponse>>;
|
getTaxRates: () => Promise<ListResponse<TaxRateResponse>>;
|
||||||
getOrganizationKeys: (id: string) => Promise<OrganizationKeysResponse>;
|
getOrganizationKeys: (id: string) => Promise<OrganizationKeysResponse>;
|
||||||
postOrganizationKeys: (id: string, request: OrganizationKeysRequest) => Promise<OrganizationKeysResponse>;
|
postOrganizationKeys: (
|
||||||
|
id: string,
|
||||||
|
request: OrganizationKeysRequest
|
||||||
|
) => Promise<OrganizationKeysResponse>;
|
||||||
|
|
||||||
postProviderSetup: (id: string, request: ProviderSetupRequest) => Promise<ProviderResponse>;
|
postProviderSetup: (id: string, request: ProviderSetupRequest) => Promise<ProviderResponse>;
|
||||||
getProvider: (id: string) => Promise<ProviderResponse>;
|
getProvider: (id: string) => Promise<ProviderResponse>;
|
||||||
@@ -415,28 +559,84 @@ export abstract class ApiService {
|
|||||||
getProviderUser: (providerId: string, id: string) => Promise<ProviderUserResponse>;
|
getProviderUser: (providerId: string, id: string) => Promise<ProviderUserResponse>;
|
||||||
postProviderUserInvite: (providerId: string, request: ProviderUserInviteRequest) => Promise<any>;
|
postProviderUserInvite: (providerId: string, request: ProviderUserInviteRequest) => Promise<any>;
|
||||||
postProviderUserReinvite: (providerId: string, id: string) => Promise<any>;
|
postProviderUserReinvite: (providerId: string, id: string) => Promise<any>;
|
||||||
postManyProviderUserReinvite: (providerId: string, request: ProviderUserBulkRequest) => Promise<ListResponse<ProviderUserBulkResponse>>;
|
postManyProviderUserReinvite: (
|
||||||
postProviderUserAccept: (providerId: string, id: string, request: ProviderUserAcceptRequest) => Promise<any>;
|
providerId: string,
|
||||||
postProviderUserConfirm: (providerId: string, id: string, request: ProviderUserConfirmRequest) => Promise<any>;
|
request: ProviderUserBulkRequest
|
||||||
postProviderUsersPublicKey: (providerId: string, request: ProviderUserBulkRequest) =>
|
) => Promise<ListResponse<ProviderUserBulkResponse>>;
|
||||||
Promise<ListResponse<ProviderUserBulkPublicKeyResponse>>;
|
postProviderUserAccept: (
|
||||||
postProviderUserBulkConfirm: (providerId: string, request: ProviderUserBulkConfirmRequest) => Promise<ListResponse<ProviderUserBulkResponse>>;
|
providerId: string,
|
||||||
putProviderUser: (providerId: string, id: string, request: ProviderUserUpdateRequest) => Promise<any>;
|
id: string,
|
||||||
|
request: ProviderUserAcceptRequest
|
||||||
|
) => Promise<any>;
|
||||||
|
postProviderUserConfirm: (
|
||||||
|
providerId: string,
|
||||||
|
id: string,
|
||||||
|
request: ProviderUserConfirmRequest
|
||||||
|
) => Promise<any>;
|
||||||
|
postProviderUsersPublicKey: (
|
||||||
|
providerId: string,
|
||||||
|
request: ProviderUserBulkRequest
|
||||||
|
) => Promise<ListResponse<ProviderUserBulkPublicKeyResponse>>;
|
||||||
|
postProviderUserBulkConfirm: (
|
||||||
|
providerId: string,
|
||||||
|
request: ProviderUserBulkConfirmRequest
|
||||||
|
) => Promise<ListResponse<ProviderUserBulkResponse>>;
|
||||||
|
putProviderUser: (
|
||||||
|
providerId: string,
|
||||||
|
id: string,
|
||||||
|
request: ProviderUserUpdateRequest
|
||||||
|
) => Promise<any>;
|
||||||
deleteProviderUser: (organizationId: string, id: string) => Promise<any>;
|
deleteProviderUser: (organizationId: string, id: string) => Promise<any>;
|
||||||
deleteManyProviderUsers: (providerId: string, request: ProviderUserBulkRequest) => Promise<ListResponse<ProviderUserBulkResponse>>;
|
deleteManyProviderUsers: (
|
||||||
getProviderClients: (providerId: string) => Promise<ListResponse<ProviderOrganizationOrganizationDetailsResponse>>;
|
providerId: string,
|
||||||
postProviderAddOrganization: (providerId: string, request: ProviderAddOrganizationRequest) => Promise<any>;
|
request: ProviderUserBulkRequest
|
||||||
postProviderCreateOrganization: (providerId: string, request: ProviderOrganizationCreateRequest) => Promise<ProviderOrganizationResponse>;
|
) => Promise<ListResponse<ProviderUserBulkResponse>>;
|
||||||
|
getProviderClients: (
|
||||||
|
providerId: string
|
||||||
|
) => Promise<ListResponse<ProviderOrganizationOrganizationDetailsResponse>>;
|
||||||
|
postProviderAddOrganization: (
|
||||||
|
providerId: string,
|
||||||
|
request: ProviderAddOrganizationRequest
|
||||||
|
) => Promise<any>;
|
||||||
|
postProviderCreateOrganization: (
|
||||||
|
providerId: string,
|
||||||
|
request: ProviderOrganizationCreateRequest
|
||||||
|
) => Promise<ProviderOrganizationResponse>;
|
||||||
deleteProviderOrganization: (providerId: string, organizationId: string) => Promise<any>;
|
deleteProviderOrganization: (providerId: string, organizationId: string) => Promise<any>;
|
||||||
|
|
||||||
getEvents: (start: string, end: string, token: string) => Promise<ListResponse<EventResponse>>;
|
getEvents: (start: string, end: string, token: string) => Promise<ListResponse<EventResponse>>;
|
||||||
getEventsCipher: (id: string, start: string, end: string, token: string) => Promise<ListResponse<EventResponse>>;
|
getEventsCipher: (
|
||||||
getEventsOrganization: (id: string, start: string, end: string,
|
id: string,
|
||||||
token: string) => Promise<ListResponse<EventResponse>>;
|
start: string,
|
||||||
getEventsOrganizationUser: (organizationId: string, id: string,
|
end: string,
|
||||||
start: string, end: string, token: string) => Promise<ListResponse<EventResponse>>;
|
token: string
|
||||||
getEventsProvider: (id: string, start: string, end: string, token: string) => Promise<ListResponse<EventResponse>>;
|
) => Promise<ListResponse<EventResponse>>;
|
||||||
getEventsProviderUser: (providerId: string, id: string, start: string, end: string, token: string) => Promise<ListResponse<EventResponse>>;
|
getEventsOrganization: (
|
||||||
|
id: string,
|
||||||
|
start: string,
|
||||||
|
end: string,
|
||||||
|
token: string
|
||||||
|
) => Promise<ListResponse<EventResponse>>;
|
||||||
|
getEventsOrganizationUser: (
|
||||||
|
organizationId: string,
|
||||||
|
id: string,
|
||||||
|
start: string,
|
||||||
|
end: string,
|
||||||
|
token: string
|
||||||
|
) => Promise<ListResponse<EventResponse>>;
|
||||||
|
getEventsProvider: (
|
||||||
|
id: string,
|
||||||
|
start: string,
|
||||||
|
end: string,
|
||||||
|
token: string
|
||||||
|
) => Promise<ListResponse<EventResponse>>;
|
||||||
|
getEventsProviderUser: (
|
||||||
|
providerId: string,
|
||||||
|
id: string,
|
||||||
|
start: string,
|
||||||
|
end: string,
|
||||||
|
token: string
|
||||||
|
) => Promise<ListResponse<EventResponse>>;
|
||||||
postEventsCollect: (request: EventRequest[]) => Promise<any>;
|
postEventsCollect: (request: EventRequest[]) => Promise<any>;
|
||||||
|
|
||||||
deleteSsoUser: (organizationId: string) => Promise<any>;
|
deleteSsoUser: (organizationId: string) => Promise<any>;
|
||||||
@@ -455,14 +655,23 @@ export abstract class ApiService {
|
|||||||
|
|
||||||
preValidateSso: (identifier: string) => Promise<boolean>;
|
preValidateSso: (identifier: string) => Promise<boolean>;
|
||||||
|
|
||||||
postCreateSponsorship: (sponsorshipOrgId: string, request: OrganizationSponsorshipCreateRequest) => Promise<void>;
|
postCreateSponsorship: (
|
||||||
|
sponsorshipOrgId: string,
|
||||||
|
request: OrganizationSponsorshipCreateRequest
|
||||||
|
) => Promise<void>;
|
||||||
deleteRevokeSponsorship: (sponsoringOrganizationId: string) => Promise<void>;
|
deleteRevokeSponsorship: (sponsoringOrganizationId: string) => Promise<void>;
|
||||||
deleteRemoveSponsorship: (sponsoringOrgId: string) => Promise<void>;
|
deleteRemoveSponsorship: (sponsoringOrgId: string) => Promise<void>;
|
||||||
postPreValidateSponsorshipToken: (sponsorshipToken: string) => Promise<boolean>;
|
postPreValidateSponsorshipToken: (sponsorshipToken: string) => Promise<boolean>;
|
||||||
postRedeemSponsorship: (sponsorshipToken: string, request: OrganizationSponsorshipRedeemRequest) => Promise<void>;
|
postRedeemSponsorship: (
|
||||||
|
sponsorshipToken: string,
|
||||||
|
request: OrganizationSponsorshipRedeemRequest
|
||||||
|
) => Promise<void>;
|
||||||
postResendSponsorshipOffer: (sponsoringOrgId: string) => Promise<void>;
|
postResendSponsorshipOffer: (sponsoringOrgId: string) => Promise<void>;
|
||||||
|
|
||||||
getUserKeyFromKeyConnector: (keyConnectorUrl: string) => Promise<KeyConnectorUserKeyResponse>;
|
getUserKeyFromKeyConnector: (keyConnectorUrl: string) => Promise<KeyConnectorUserKeyResponse>;
|
||||||
postUserKeyToKeyConnector: (keyConnectorUrl: string, request: KeyConnectorUserKeyRequest) => Promise<void>;
|
postUserKeyToKeyConnector: (
|
||||||
|
keyConnectorUrl: string,
|
||||||
|
request: KeyConnectorUserKeyRequest
|
||||||
|
) => Promise<void>;
|
||||||
getKeyConnectorAlive: (keyConnectorUrl: string) => Promise<void>;
|
getKeyConnectorAlive: (keyConnectorUrl: string) => Promise<void>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { BreachAccountResponse } from '../models/response/breachAccountResponse';
|
import { BreachAccountResponse } from "../models/response/breachAccountResponse";
|
||||||
|
|
||||||
export abstract class AuditService {
|
export abstract class AuditService {
|
||||||
passwordLeaked: (password: string) => Promise<number>;
|
passwordLeaked: (password: string) => Promise<number>;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { TwoFactorProviderType } from '../enums/twoFactorProviderType';
|
import { TwoFactorProviderType } from "../enums/twoFactorProviderType";
|
||||||
|
|
||||||
import { AuthResult } from '../models/domain/authResult';
|
import { AuthResult } from "../models/domain/authResult";
|
||||||
import { SymmetricCryptoKey } from '../models/domain/symmetricCryptoKey';
|
import { SymmetricCryptoKey } from "../models/domain/symmetricCryptoKey";
|
||||||
|
|
||||||
export abstract class AuthService {
|
export abstract class AuthService {
|
||||||
email: string;
|
email: string;
|
||||||
@@ -11,20 +11,45 @@ export abstract class AuthService {
|
|||||||
ssoRedirectUrl: string;
|
ssoRedirectUrl: string;
|
||||||
clientId: string;
|
clientId: string;
|
||||||
clientSecret: string;
|
clientSecret: string;
|
||||||
twoFactorProvidersData: Map<TwoFactorProviderType, { [key: string]: string; }>;
|
twoFactorProvidersData: Map<TwoFactorProviderType, { [key: string]: string }>;
|
||||||
selectedTwoFactorProviderType: TwoFactorProviderType;
|
selectedTwoFactorProviderType: TwoFactorProviderType;
|
||||||
|
|
||||||
logIn: (email: string, masterPassword: string, captchaToken?: string) => Promise<AuthResult>;
|
logIn: (email: string, masterPassword: string, captchaToken?: string) => Promise<AuthResult>;
|
||||||
logInSso: (code: string, codeVerifier: string, redirectUrl: string, orgId: string) => Promise<AuthResult>;
|
logInSso: (
|
||||||
|
code: string,
|
||||||
|
codeVerifier: string,
|
||||||
|
redirectUrl: string,
|
||||||
|
orgId: string
|
||||||
|
) => Promise<AuthResult>;
|
||||||
logInApiKey: (clientId: string, clientSecret: string) => Promise<AuthResult>;
|
logInApiKey: (clientId: string, clientSecret: string) => Promise<AuthResult>;
|
||||||
logInTwoFactor: (twoFactorProvider: TwoFactorProviderType, twoFactorToken: string,
|
logInTwoFactor: (
|
||||||
remember?: boolean) => Promise<AuthResult>;
|
twoFactorProvider: TwoFactorProviderType,
|
||||||
logInComplete: (email: string, masterPassword: string, twoFactorProvider: TwoFactorProviderType,
|
twoFactorToken: string,
|
||||||
twoFactorToken: string, remember?: boolean, captchaToken?: string) => Promise<AuthResult>;
|
remember?: boolean
|
||||||
logInSsoComplete: (code: string, codeVerifier: string, redirectUrl: string,
|
) => Promise<AuthResult>;
|
||||||
twoFactorProvider: TwoFactorProviderType, twoFactorToken: string, remember?: boolean) => Promise<AuthResult>;
|
logInComplete: (
|
||||||
logInApiKeyComplete: (clientId: string, clientSecret: string, twoFactorProvider: TwoFactorProviderType,
|
email: string,
|
||||||
twoFactorToken: string, remember?: boolean) => Promise<AuthResult>;
|
masterPassword: string,
|
||||||
|
twoFactorProvider: TwoFactorProviderType,
|
||||||
|
twoFactorToken: string,
|
||||||
|
remember?: boolean,
|
||||||
|
captchaToken?: string
|
||||||
|
) => Promise<AuthResult>;
|
||||||
|
logInSsoComplete: (
|
||||||
|
code: string,
|
||||||
|
codeVerifier: string,
|
||||||
|
redirectUrl: string,
|
||||||
|
twoFactorProvider: TwoFactorProviderType,
|
||||||
|
twoFactorToken: string,
|
||||||
|
remember?: boolean
|
||||||
|
) => Promise<AuthResult>;
|
||||||
|
logInApiKeyComplete: (
|
||||||
|
clientId: string,
|
||||||
|
clientSecret: string,
|
||||||
|
twoFactorProvider: TwoFactorProviderType,
|
||||||
|
twoFactorToken: string,
|
||||||
|
remember?: boolean
|
||||||
|
) => Promise<AuthResult>;
|
||||||
logOut: (callback: Function) => void;
|
logOut: (callback: Function) => void;
|
||||||
getSupportedTwoFactorProviders: (win: Window) => any[];
|
getSupportedTwoFactorProviders: (win: Window) => any[];
|
||||||
getDefaultTwoFactorProvider: (webAuthnSupported: boolean) => TwoFactorProviderType;
|
getDefaultTwoFactorProvider: (webAuthnSupported: boolean) => TwoFactorProviderType;
|
||||||
|
|||||||
@@ -1,26 +1,61 @@
|
|||||||
import { DecryptParameters } from '../models/domain/decryptParameters';
|
import { DecryptParameters } from "../models/domain/decryptParameters";
|
||||||
import { SymmetricCryptoKey } from '../models/domain/symmetricCryptoKey';
|
import { SymmetricCryptoKey } from "../models/domain/symmetricCryptoKey";
|
||||||
|
|
||||||
export abstract class CryptoFunctionService {
|
export abstract class CryptoFunctionService {
|
||||||
pbkdf2: (password: string | ArrayBuffer, salt: string | ArrayBuffer, algorithm: 'sha256' | 'sha512',
|
pbkdf2: (
|
||||||
iterations: number) => Promise<ArrayBuffer>;
|
password: string | ArrayBuffer,
|
||||||
hkdf: (ikm: ArrayBuffer, salt: string | ArrayBuffer, info: string | ArrayBuffer,
|
salt: string | ArrayBuffer,
|
||||||
outputByteSize: number, algorithm: 'sha256' | 'sha512') => Promise<ArrayBuffer>;
|
algorithm: "sha256" | "sha512",
|
||||||
hkdfExpand: (prk: ArrayBuffer, info: string | ArrayBuffer, outputByteSize: number,
|
iterations: number
|
||||||
algorithm: 'sha256' | 'sha512') => Promise<ArrayBuffer>;
|
) => Promise<ArrayBuffer>;
|
||||||
hash: (value: string | ArrayBuffer, algorithm: 'sha1' | 'sha256' | 'sha512' | 'md5') => Promise<ArrayBuffer>;
|
hkdf: (
|
||||||
hmac: (value: ArrayBuffer, key: ArrayBuffer, algorithm: 'sha1' | 'sha256' | 'sha512') => Promise<ArrayBuffer>;
|
ikm: ArrayBuffer,
|
||||||
|
salt: string | ArrayBuffer,
|
||||||
|
info: string | ArrayBuffer,
|
||||||
|
outputByteSize: number,
|
||||||
|
algorithm: "sha256" | "sha512"
|
||||||
|
) => Promise<ArrayBuffer>;
|
||||||
|
hkdfExpand: (
|
||||||
|
prk: ArrayBuffer,
|
||||||
|
info: string | ArrayBuffer,
|
||||||
|
outputByteSize: number,
|
||||||
|
algorithm: "sha256" | "sha512"
|
||||||
|
) => Promise<ArrayBuffer>;
|
||||||
|
hash: (
|
||||||
|
value: string | ArrayBuffer,
|
||||||
|
algorithm: "sha1" | "sha256" | "sha512" | "md5"
|
||||||
|
) => Promise<ArrayBuffer>;
|
||||||
|
hmac: (
|
||||||
|
value: ArrayBuffer,
|
||||||
|
key: ArrayBuffer,
|
||||||
|
algorithm: "sha1" | "sha256" | "sha512"
|
||||||
|
) => Promise<ArrayBuffer>;
|
||||||
compare: (a: ArrayBuffer, b: ArrayBuffer) => Promise<boolean>;
|
compare: (a: ArrayBuffer, b: ArrayBuffer) => Promise<boolean>;
|
||||||
hmacFast: (value: ArrayBuffer | string, key: ArrayBuffer | string, algorithm: 'sha1' | 'sha256' | 'sha512') =>
|
hmacFast: (
|
||||||
Promise<ArrayBuffer | string>;
|
value: ArrayBuffer | string,
|
||||||
|
key: ArrayBuffer | string,
|
||||||
|
algorithm: "sha1" | "sha256" | "sha512"
|
||||||
|
) => Promise<ArrayBuffer | string>;
|
||||||
compareFast: (a: ArrayBuffer | string, b: ArrayBuffer | string) => Promise<boolean>;
|
compareFast: (a: ArrayBuffer | string, b: ArrayBuffer | string) => Promise<boolean>;
|
||||||
aesEncrypt: (data: ArrayBuffer, iv: ArrayBuffer, key: ArrayBuffer) => Promise<ArrayBuffer>;
|
aesEncrypt: (data: ArrayBuffer, iv: ArrayBuffer, key: ArrayBuffer) => Promise<ArrayBuffer>;
|
||||||
aesDecryptFastParameters: (data: string, iv: string, mac: string, key: SymmetricCryptoKey) =>
|
aesDecryptFastParameters: (
|
||||||
DecryptParameters<ArrayBuffer | string>;
|
data: string,
|
||||||
|
iv: string,
|
||||||
|
mac: string,
|
||||||
|
key: SymmetricCryptoKey
|
||||||
|
) => DecryptParameters<ArrayBuffer | string>;
|
||||||
aesDecryptFast: (parameters: DecryptParameters<ArrayBuffer | string>) => Promise<string>;
|
aesDecryptFast: (parameters: DecryptParameters<ArrayBuffer | string>) => Promise<string>;
|
||||||
aesDecrypt: (data: ArrayBuffer, iv: ArrayBuffer, key: ArrayBuffer) => Promise<ArrayBuffer>;
|
aesDecrypt: (data: ArrayBuffer, iv: ArrayBuffer, key: ArrayBuffer) => Promise<ArrayBuffer>;
|
||||||
rsaEncrypt: (data: ArrayBuffer, publicKey: ArrayBuffer, algorithm: 'sha1' | 'sha256') => Promise<ArrayBuffer>;
|
rsaEncrypt: (
|
||||||
rsaDecrypt: (data: ArrayBuffer, privateKey: ArrayBuffer, algorithm: 'sha1' | 'sha256') => Promise<ArrayBuffer>;
|
data: ArrayBuffer,
|
||||||
|
publicKey: ArrayBuffer,
|
||||||
|
algorithm: "sha1" | "sha256"
|
||||||
|
) => Promise<ArrayBuffer>;
|
||||||
|
rsaDecrypt: (
|
||||||
|
data: ArrayBuffer,
|
||||||
|
privateKey: ArrayBuffer,
|
||||||
|
algorithm: "sha1" | "sha256"
|
||||||
|
) => Promise<ArrayBuffer>;
|
||||||
rsaExtractPublicKey: (privateKey: ArrayBuffer) => Promise<ArrayBuffer>;
|
rsaExtractPublicKey: (privateKey: ArrayBuffer) => Promise<ArrayBuffer>;
|
||||||
rsaGenerateKeyPair: (length: 1024 | 2048 | 4096) => Promise<[ArrayBuffer, ArrayBuffer]>;
|
rsaGenerateKeyPair: (length: 1024 | 2048 | 4096) => Promise<[ArrayBuffer, ArrayBuffer]>;
|
||||||
randomBytes: (length: number) => Promise<ArrayBuffer>;
|
randomBytes: (length: number) => Promise<ArrayBuffer>;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Observable } from 'rxjs';
|
import { Observable } from "rxjs";
|
||||||
|
|
||||||
export type Urls = {
|
export type Urls = {
|
||||||
base?: string;
|
base?: string;
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
import { EventView } from '../models/view/eventView';
|
import { EventView } from "../models/view/eventView";
|
||||||
|
|
||||||
export abstract class ExportService {
|
export abstract class ExportService {
|
||||||
getExport: (format?: 'csv' | 'json' | 'encrypted_json') => Promise<string>;
|
getExport: (format?: "csv" | "json" | "encrypted_json") => Promise<string>;
|
||||||
getOrganizationExport: (organizationId: string, format?: 'csv' | 'json' | 'encrypted_json') => Promise<string>;
|
getOrganizationExport: (
|
||||||
|
organizationId: string,
|
||||||
|
format?: "csv" | "json" | "encrypted_json"
|
||||||
|
) => Promise<string>;
|
||||||
getEventExport: (events: EventView[]) => Promise<string>;
|
getEventExport: (events: EventView[]) => Promise<string>;
|
||||||
getFileName: (prefix?: string, extension?: string) => string;
|
getFileName: (prefix?: string, extension?: string) => string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,18 @@
|
|||||||
import { EncArrayBuffer } from '../models/domain/encArrayBuffer';
|
import { EncArrayBuffer } from "../models/domain/encArrayBuffer";
|
||||||
import { EncString } from '../models/domain/encString';
|
import { EncString } from "../models/domain/encString";
|
||||||
import { AttachmentUploadDataResponse } from '../models/response/attachmentUploadDataResponse';
|
import { AttachmentUploadDataResponse } from "../models/response/attachmentUploadDataResponse";
|
||||||
import { SendFileUploadDataResponse } from '../models/response/sendFileUploadDataResponse';
|
import { SendFileUploadDataResponse } from "../models/response/sendFileUploadDataResponse";
|
||||||
|
|
||||||
export abstract class FileUploadService {
|
export abstract class FileUploadService {
|
||||||
uploadSendFile: (uploadData: SendFileUploadDataResponse, fileName: EncString,
|
uploadSendFile: (
|
||||||
encryptedFileData: EncArrayBuffer) => Promise<any>;
|
uploadData: SendFileUploadDataResponse,
|
||||||
uploadCipherAttachment: (admin: boolean, uploadData: AttachmentUploadDataResponse, fileName: EncString,
|
fileName: EncString,
|
||||||
encryptedFileData: EncArrayBuffer) => Promise<any>;
|
encryptedFileData: EncArrayBuffer
|
||||||
|
) => Promise<any>;
|
||||||
|
uploadCipherAttachment: (
|
||||||
|
admin: boolean,
|
||||||
|
uploadData: AttachmentUploadDataResponse,
|
||||||
|
fileName: EncString,
|
||||||
|
encryptedFileData: EncArrayBuffer
|
||||||
|
) => Promise<any>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Importer } from '../importers/importer';
|
import { Importer } from "../importers/importer";
|
||||||
|
|
||||||
export interface ImportOption {
|
export interface ImportOption {
|
||||||
id: string;
|
id: string;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Organization } from '../models/domain/organization';
|
import { Organization } from "../models/domain/organization";
|
||||||
|
|
||||||
export abstract class KeyConnectorService {
|
export abstract class KeyConnectorService {
|
||||||
getAndSetKey: (url?: string) => Promise<void>;
|
getAndSetKey: (url?: string) => Promise<void>;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { LogLevelType } from '../enums/logLevelType';
|
import { LogLevelType } from "../enums/logLevelType";
|
||||||
|
|
||||||
export abstract class LogService {
|
export abstract class LogService {
|
||||||
debug: (message: string) => void;
|
debug: (message: string) => void;
|
||||||
|
|||||||
@@ -1,14 +1,16 @@
|
|||||||
import { CipherView } from '../models/view/cipherView';
|
import { CipherView } from "../models/view/cipherView";
|
||||||
import { SendView } from '../models/view/sendView';
|
import { SendView } from "../models/view/sendView";
|
||||||
|
|
||||||
export abstract class SearchService {
|
export abstract class SearchService {
|
||||||
indexedEntityId?: string = null;
|
indexedEntityId?: string = null;
|
||||||
clearIndex: () => void;
|
clearIndex: () => void;
|
||||||
isSearchable: (query: string) => boolean;
|
isSearchable: (query: string) => boolean;
|
||||||
indexCiphers: (indexedEntityGuid?: string, ciphersToIndex?: CipherView[]) => Promise<void>;
|
indexCiphers: (indexedEntityGuid?: string, ciphersToIndex?: CipherView[]) => Promise<void>;
|
||||||
searchCiphers: (query: string,
|
searchCiphers: (
|
||||||
filter?: ((cipher: CipherView) => boolean) | (((cipher: CipherView) => boolean)[]),
|
query: string,
|
||||||
ciphers?: CipherView[]) => Promise<CipherView[]>;
|
filter?: ((cipher: CipherView) => boolean) | ((cipher: CipherView) => boolean)[],
|
||||||
|
ciphers?: CipherView[]
|
||||||
|
) => Promise<CipherView[]>;
|
||||||
searchCiphersBasic: (ciphers: CipherView[], query: string, deleted?: boolean) => CipherView[];
|
searchCiphersBasic: (ciphers: CipherView[], query: string, deleted?: boolean) => CipherView[];
|
||||||
searchSends: (sends: SendView[], query: string) => SendView[];
|
searchSends: (sends: SendView[], query: string) => SendView[];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
import { SecretVerificationRequest } from '../models/request/secretVerificationRequest';
|
import { SecretVerificationRequest } from "../models/request/secretVerificationRequest";
|
||||||
|
|
||||||
import { Verification } from '../types/verification';
|
import { Verification } from "../types/verification";
|
||||||
|
|
||||||
export abstract class UserVerificationService {
|
export abstract class UserVerificationService {
|
||||||
buildRequest: <T extends SecretVerificationRequest> (verification: Verification,
|
buildRequest: <T extends SecretVerificationRequest>(
|
||||||
requestClass?: new () => T, alreadyHashed?: boolean) => Promise<T>;
|
verification: Verification,
|
||||||
|
requestClass?: new () => T,
|
||||||
|
alreadyHashed?: boolean
|
||||||
|
) => Promise<T>;
|
||||||
verifyUser: (verification: Verification) => Promise<boolean>;
|
verifyUser: (verification: Verification) => Promise<boolean>;
|
||||||
requestOTP: () => Promise<void>;
|
requestOTP: () => Promise<void>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
export enum EmergencyAccessType
|
export enum EmergencyAccessType {
|
||||||
{
|
|
||||||
View = 0,
|
View = 0,
|
||||||
Takeover = 1,
|
Takeover = 1,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
export enum ThemeType {
|
export enum ThemeType {
|
||||||
System = 'system',
|
System = "system",
|
||||||
Light = 'light',
|
Light = "light",
|
||||||
Dark = 'dark',
|
Dark = "dark",
|
||||||
Nord = 'nord',
|
Nord = "nord",
|
||||||
SolarizedDark = 'solarizedDark',
|
SolarizedDark = "solarizedDark",
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { BaseImporter } from './baseImporter';
|
import { BaseImporter } from "./baseImporter";
|
||||||
import { Importer } from './importer';
|
import { Importer } from "./importer";
|
||||||
|
|
||||||
import { ImportResult } from '../models/domain/importResult';
|
import { ImportResult } from "../models/domain/importResult";
|
||||||
|
|
||||||
export class AscendoCsvImporter extends BaseImporter implements Importer {
|
export class AscendoCsvImporter extends BaseImporter implements Importer {
|
||||||
parse(data: string): Promise<ImportResult> {
|
parse(data: string): Promise<ImportResult> {
|
||||||
@@ -12,16 +12,16 @@ export class AscendoCsvImporter extends BaseImporter implements Importer {
|
|||||||
return Promise.resolve(result);
|
return Promise.resolve(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
results.forEach(value => {
|
results.forEach((value) => {
|
||||||
if (value.length < 2) {
|
if (value.length < 2) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const cipher = this.initLoginCipher();
|
const cipher = this.initLoginCipher();
|
||||||
cipher.notes = this.getValueOrDefault(value[value.length - 1]);
|
cipher.notes = this.getValueOrDefault(value[value.length - 1]);
|
||||||
cipher.name = this.getValueOrDefault(value[0], '--');
|
cipher.name = this.getValueOrDefault(value[0], "--");
|
||||||
|
|
||||||
if (value.length > 2 && (value.length % 2) === 0) {
|
if (value.length > 2 && value.length % 2 === 0) {
|
||||||
for (let i = 0; i < value.length - 2; i += 2) {
|
for (let i = 0; i < value.length - 2; i += 2) {
|
||||||
const val: string = value[i + 2];
|
const val: string = value[i + 2];
|
||||||
const field: string = value[i + 1];
|
const field: string = value[i + 1];
|
||||||
@@ -32,11 +32,15 @@ export class AscendoCsvImporter extends BaseImporter implements Importer {
|
|||||||
const fieldLower = field.toLowerCase();
|
const fieldLower = field.toLowerCase();
|
||||||
if (cipher.login.password == null && this.passwordFieldNames.indexOf(fieldLower) > -1) {
|
if (cipher.login.password == null && this.passwordFieldNames.indexOf(fieldLower) > -1) {
|
||||||
cipher.login.password = this.getValueOrDefault(val);
|
cipher.login.password = this.getValueOrDefault(val);
|
||||||
} else if (cipher.login.username == null &&
|
} else if (
|
||||||
this.usernameFieldNames.indexOf(fieldLower) > -1) {
|
cipher.login.username == null &&
|
||||||
|
this.usernameFieldNames.indexOf(fieldLower) > -1
|
||||||
|
) {
|
||||||
cipher.login.username = this.getValueOrDefault(val);
|
cipher.login.username = this.getValueOrDefault(val);
|
||||||
} else if ((cipher.login.uris == null || cipher.login.uris.length === 0) &&
|
} else if (
|
||||||
this.uriFieldNames.indexOf(fieldLower) > -1) {
|
(cipher.login.uris == null || cipher.login.uris.length === 0) &&
|
||||||
|
this.uriFieldNames.indexOf(fieldLower) > -1
|
||||||
|
) {
|
||||||
cipher.login.uris = this.makeUriArray(val);
|
cipher.login.uris = this.makeUriArray(val);
|
||||||
} else {
|
} else {
|
||||||
this.processKvp(cipher, field, val);
|
this.processKvp(cipher, field, val);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { BaseImporter } from './baseImporter';
|
import { BaseImporter } from "./baseImporter";
|
||||||
import { Importer } from './importer';
|
import { Importer } from "./importer";
|
||||||
|
|
||||||
import { ImportResult } from '../models/domain/importResult';
|
import { ImportResult } from "../models/domain/importResult";
|
||||||
|
|
||||||
export class AvastCsvImporter extends BaseImporter implements Importer {
|
export class AvastCsvImporter extends BaseImporter implements Importer {
|
||||||
parse(data: string): Promise<ImportResult> {
|
parse(data: string): Promise<ImportResult> {
|
||||||
@@ -12,7 +12,7 @@ export class AvastCsvImporter extends BaseImporter implements Importer {
|
|||||||
return Promise.resolve(result);
|
return Promise.resolve(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
results.forEach(value => {
|
results.forEach((value) => {
|
||||||
const cipher = this.initLoginCipher();
|
const cipher = this.initLoginCipher();
|
||||||
cipher.name = this.getValueOrDefault(value.name);
|
cipher.name = this.getValueOrDefault(value.name);
|
||||||
cipher.login.uris = this.makeUriArray(value.web);
|
cipher.login.uris = this.makeUriArray(value.web);
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import { BaseImporter } from './baseImporter';
|
import { BaseImporter } from "./baseImporter";
|
||||||
import { Importer } from './importer';
|
import { Importer } from "./importer";
|
||||||
|
|
||||||
import { ImportResult } from '../models/domain/importResult';
|
import { ImportResult } from "../models/domain/importResult";
|
||||||
|
|
||||||
import { CipherType } from '../enums/cipherType';
|
import { CipherType } from "../enums/cipherType";
|
||||||
import { SecureNoteType } from '../enums/secureNoteType';
|
import { SecureNoteType } from "../enums/secureNoteType";
|
||||||
|
|
||||||
export class AvastJsonImporter extends BaseImporter implements Importer {
|
export class AvastJsonImporter extends BaseImporter implements Importer {
|
||||||
parse(data: string): Promise<ImportResult> {
|
parse(data: string): Promise<ImportResult> {
|
||||||
@@ -52,10 +52,10 @@ export class AvastJsonImporter extends BaseImporter implements Importer {
|
|||||||
cipher.card.brand = this.getCardBrand(cipher.card.number);
|
cipher.card.brand = this.getCardBrand(cipher.card.number);
|
||||||
if (value.expirationDate != null) {
|
if (value.expirationDate != null) {
|
||||||
if (value.expirationDate.month != null) {
|
if (value.expirationDate.month != null) {
|
||||||
cipher.card.expMonth = value.expirationDate.month + '';
|
cipher.card.expMonth = value.expirationDate.month + "";
|
||||||
}
|
}
|
||||||
if (value.expirationDate.year != null) {
|
if (value.expirationDate.year != null) {
|
||||||
cipher.card.expYear = value.expirationDate.year + '';
|
cipher.card.expYear = value.expirationDate.year + "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.cleanupCipher(cipher);
|
this.cleanupCipher(cipher);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { BaseImporter } from './baseImporter';
|
import { BaseImporter } from "./baseImporter";
|
||||||
import { Importer } from './importer';
|
import { Importer } from "./importer";
|
||||||
|
|
||||||
import { ImportResult } from '../models/domain/importResult';
|
import { ImportResult } from "../models/domain/importResult";
|
||||||
|
|
||||||
export class AviraCsvImporter extends BaseImporter implements Importer {
|
export class AviraCsvImporter extends BaseImporter implements Importer {
|
||||||
parse(data: string): Promise<ImportResult> {
|
parse(data: string): Promise<ImportResult> {
|
||||||
@@ -12,14 +12,19 @@ export class AviraCsvImporter extends BaseImporter implements Importer {
|
|||||||
return Promise.resolve(result);
|
return Promise.resolve(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
results.forEach(value => {
|
results.forEach((value) => {
|
||||||
const cipher = this.initLoginCipher();
|
const cipher = this.initLoginCipher();
|
||||||
cipher.name = this.getValueOrDefault(value.name,
|
cipher.name = this.getValueOrDefault(
|
||||||
this.getValueOrDefault(this.nameFromUrl(value.website), '--'));
|
value.name,
|
||||||
|
this.getValueOrDefault(this.nameFromUrl(value.website), "--")
|
||||||
|
);
|
||||||
cipher.login.uris = this.makeUriArray(value.website);
|
cipher.login.uris = this.makeUriArray(value.website);
|
||||||
cipher.login.password = this.getValueOrDefault(value.password);
|
cipher.login.password = this.getValueOrDefault(value.password);
|
||||||
|
|
||||||
if (this.isNullOrWhitespace(value.username) && !this.isNullOrWhitespace(value.secondary_username)) {
|
if (
|
||||||
|
this.isNullOrWhitespace(value.username) &&
|
||||||
|
!this.isNullOrWhitespace(value.secondary_username)
|
||||||
|
) {
|
||||||
cipher.login.username = value.secondary_username;
|
cipher.login.username = value.secondary_username;
|
||||||
} else {
|
} else {
|
||||||
cipher.login.username = this.getValueOrDefault(value.username);
|
cipher.login.username = this.getValueOrDefault(value.username);
|
||||||
|
|||||||
@@ -1,19 +1,19 @@
|
|||||||
import { BaseImporter } from './baseImporter';
|
import { BaseImporter } from "./baseImporter";
|
||||||
import { Importer } from './importer';
|
import { Importer } from "./importer";
|
||||||
|
|
||||||
import { ImportResult } from '../models/domain/importResult';
|
import { ImportResult } from "../models/domain/importResult";
|
||||||
|
|
||||||
import { CipherView } from '../models/view/cipherView';
|
import { CipherView } from "../models/view/cipherView";
|
||||||
import { CollectionView } from '../models/view/collectionView';
|
import { CollectionView } from "../models/view/collectionView";
|
||||||
import { FieldView } from '../models/view/fieldView';
|
import { FieldView } from "../models/view/fieldView";
|
||||||
import { FolderView } from '../models/view/folderView';
|
import { FolderView } from "../models/view/folderView";
|
||||||
import { LoginView } from '../models/view/loginView';
|
import { LoginView } from "../models/view/loginView";
|
||||||
import { SecureNoteView } from '../models/view/secureNoteView';
|
import { SecureNoteView } from "../models/view/secureNoteView";
|
||||||
|
|
||||||
import { CipherRepromptType } from '../enums/cipherRepromptType';
|
import { CipherRepromptType } from "../enums/cipherRepromptType";
|
||||||
import { CipherType } from '../enums/cipherType';
|
import { CipherType } from "../enums/cipherType";
|
||||||
import { FieldType } from '../enums/fieldType';
|
import { FieldType } from "../enums/fieldType";
|
||||||
import { SecureNoteType } from '../enums/secureNoteType';
|
import { SecureNoteType } from "../enums/secureNoteType";
|
||||||
|
|
||||||
export class BitwardenCsvImporter extends BaseImporter implements Importer {
|
export class BitwardenCsvImporter extends BaseImporter implements Importer {
|
||||||
parse(data: string): Promise<ImportResult> {
|
parse(data: string): Promise<ImportResult> {
|
||||||
@@ -24,10 +24,10 @@ export class BitwardenCsvImporter extends BaseImporter implements Importer {
|
|||||||
return Promise.resolve(result);
|
return Promise.resolve(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
results.forEach(value => {
|
results.forEach((value) => {
|
||||||
if (this.organization && !this.isNullOrWhitespace(value.collections)) {
|
if (this.organization && !this.isNullOrWhitespace(value.collections)) {
|
||||||
const collections = (value.collections as string).split(',');
|
const collections = (value.collections as string).split(",");
|
||||||
collections.forEach(col => {
|
collections.forEach((col) => {
|
||||||
let addCollection = true;
|
let addCollection = true;
|
||||||
let collectionIndex = result.collections.length;
|
let collectionIndex = result.collections.length;
|
||||||
|
|
||||||
@@ -52,15 +52,19 @@ export class BitwardenCsvImporter extends BaseImporter implements Importer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const cipher = new CipherView();
|
const cipher = new CipherView();
|
||||||
cipher.favorite = !this.organization && this.getValueOrDefault(value.favorite, '0') !== '0' ? true : false;
|
cipher.favorite =
|
||||||
|
!this.organization && this.getValueOrDefault(value.favorite, "0") !== "0" ? true : false;
|
||||||
cipher.type = CipherType.Login;
|
cipher.type = CipherType.Login;
|
||||||
cipher.notes = this.getValueOrDefault(value.notes);
|
cipher.notes = this.getValueOrDefault(value.notes);
|
||||||
cipher.name = this.getValueOrDefault(value.name, '--');
|
cipher.name = this.getValueOrDefault(value.name, "--");
|
||||||
try {
|
try {
|
||||||
cipher.reprompt = parseInt(this.getValueOrDefault(value.reprompt, CipherRepromptType.None.toString()), 10);
|
cipher.reprompt = parseInt(
|
||||||
|
this.getValueOrDefault(value.reprompt, CipherRepromptType.None.toString()),
|
||||||
|
10
|
||||||
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// tslint:disable-next-line
|
// tslint:disable-next-line
|
||||||
console.error('Unable to parse reprompt value', e);
|
console.error("Unable to parse reprompt value", e);
|
||||||
cipher.reprompt = CipherRepromptType.None;
|
cipher.reprompt = CipherRepromptType.None;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,7 +75,7 @@ export class BitwardenCsvImporter extends BaseImporter implements Importer {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const delimPosition = fields[i].lastIndexOf(': ');
|
const delimPosition = fields[i].lastIndexOf(": ");
|
||||||
if (delimPosition === -1) {
|
if (delimPosition === -1) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -84,7 +88,7 @@ export class BitwardenCsvImporter extends BaseImporter implements Importer {
|
|||||||
field.name = fields[i].substr(0, delimPosition);
|
field.name = fields[i].substr(0, delimPosition);
|
||||||
field.value = null;
|
field.value = null;
|
||||||
field.type = FieldType.Text;
|
field.type = FieldType.Text;
|
||||||
if (fields[i].length > (delimPosition + 2)) {
|
if (fields[i].length > delimPosition + 2) {
|
||||||
field.value = fields[i].substr(delimPosition + 2);
|
field.value = fields[i].substr(delimPosition + 2);
|
||||||
}
|
}
|
||||||
cipher.fields.push(field);
|
cipher.fields.push(field);
|
||||||
@@ -93,7 +97,7 @@ export class BitwardenCsvImporter extends BaseImporter implements Importer {
|
|||||||
|
|
||||||
const valueType = value.type != null ? value.type.toLowerCase() : null;
|
const valueType = value.type != null ? value.type.toLowerCase() : null;
|
||||||
switch (valueType) {
|
switch (valueType) {
|
||||||
case 'note':
|
case "note":
|
||||||
cipher.type = CipherType.SecureNote;
|
cipher.type = CipherType.SecureNote;
|
||||||
cipher.secureNote = new SecureNoteView();
|
cipher.secureNote = new SecureNoteView();
|
||||||
cipher.secureNote.type = SecureNoteType.Generic;
|
cipher.secureNote.type = SecureNoteType.Generic;
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
import { BaseImporter } from './baseImporter';
|
import { BaseImporter } from "./baseImporter";
|
||||||
import { Importer } from './importer';
|
import { Importer } from "./importer";
|
||||||
|
|
||||||
import { EncString } from '../models/domain/encString';
|
import { EncString } from "../models/domain/encString";
|
||||||
import { ImportResult } from '../models/domain/importResult';
|
import { ImportResult } from "../models/domain/importResult";
|
||||||
|
|
||||||
import { CipherWithIds } from '../models/export/cipherWithIds';
|
import { CipherWithIds } from "../models/export/cipherWithIds";
|
||||||
import { CollectionWithId } from '../models/export/collectionWithId';
|
import { CollectionWithId } from "../models/export/collectionWithId";
|
||||||
import { FolderWithId } from '../models/export/folderWithId';
|
import { FolderWithId } from "../models/export/folderWithId";
|
||||||
|
|
||||||
import { CryptoService } from '../abstractions/crypto.service';
|
import { CryptoService } from "../abstractions/crypto.service";
|
||||||
import { I18nService } from '../abstractions/i18n.service';
|
import { I18nService } from "../abstractions/i18n.service";
|
||||||
|
|
||||||
export class BitwardenJsonImporter extends BaseImporter implements Importer {
|
export class BitwardenJsonImporter extends BaseImporter implements Importer {
|
||||||
private results: any;
|
private results: any;
|
||||||
@@ -40,10 +40,13 @@ export class BitwardenJsonImporter extends BaseImporter implements Importer {
|
|||||||
if (this.results.encKeyValidation_DO_NOT_EDIT != null) {
|
if (this.results.encKeyValidation_DO_NOT_EDIT != null) {
|
||||||
const orgKey = await this.cryptoService.getOrgKey(this.organizationId);
|
const orgKey = await this.cryptoService.getOrgKey(this.organizationId);
|
||||||
const encKeyValidation = new EncString(this.results.encKeyValidation_DO_NOT_EDIT);
|
const encKeyValidation = new EncString(this.results.encKeyValidation_DO_NOT_EDIT);
|
||||||
const encKeyValidationDecrypt = await this.cryptoService.decryptToUtf8(encKeyValidation, orgKey);
|
const encKeyValidationDecrypt = await this.cryptoService.decryptToUtf8(
|
||||||
|
encKeyValidation,
|
||||||
|
orgKey
|
||||||
|
);
|
||||||
if (encKeyValidationDecrypt === null) {
|
if (encKeyValidationDecrypt === null) {
|
||||||
this.result.success = false;
|
this.result.success = false;
|
||||||
this.result.errorMessage = this.i18nService.t('importEncKeyError');
|
this.result.errorMessage = this.i18nService.t("importEncKeyError");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -87,11 +90,17 @@ export class BitwardenJsonImporter extends BaseImporter implements Importer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!this.organization && c.folderId != null && groupingsMap.has(c.folderId)) {
|
if (!this.organization && c.folderId != null && groupingsMap.has(c.folderId)) {
|
||||||
this.result.folderRelationships.push([this.result.ciphers.length, groupingsMap.get(c.folderId)]);
|
this.result.folderRelationships.push([
|
||||||
|
this.result.ciphers.length,
|
||||||
|
groupingsMap.get(c.folderId),
|
||||||
|
]);
|
||||||
} else if (this.organization && c.collectionIds != null) {
|
} else if (this.organization && c.collectionIds != null) {
|
||||||
c.collectionIds.forEach(cId => {
|
c.collectionIds.forEach((cId) => {
|
||||||
if (groupingsMap.has(cId)) {
|
if (groupingsMap.has(cId)) {
|
||||||
this.result.collectionRelationships.push([this.result.ciphers.length, groupingsMap.get(cId)]);
|
this.result.collectionRelationships.push([
|
||||||
|
this.result.ciphers.length,
|
||||||
|
groupingsMap.get(cId),
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -141,11 +150,17 @@ export class BitwardenJsonImporter extends BaseImporter implements Importer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!this.organization && c.folderId != null && groupingsMap.has(c.folderId)) {
|
if (!this.organization && c.folderId != null && groupingsMap.has(c.folderId)) {
|
||||||
this.result.folderRelationships.push([this.result.ciphers.length, groupingsMap.get(c.folderId)]);
|
this.result.folderRelationships.push([
|
||||||
|
this.result.ciphers.length,
|
||||||
|
groupingsMap.get(c.folderId),
|
||||||
|
]);
|
||||||
} else if (this.organization && c.collectionIds != null) {
|
} else if (this.organization && c.collectionIds != null) {
|
||||||
c.collectionIds.forEach(cId => {
|
c.collectionIds.forEach((cId) => {
|
||||||
if (groupingsMap.has(cId)) {
|
if (groupingsMap.has(cId)) {
|
||||||
this.result.collectionRelationships.push([this.result.ciphers.length, groupingsMap.get(cId)]);
|
this.result.collectionRelationships.push([
|
||||||
|
this.result.ciphers.length,
|
||||||
|
groupingsMap.get(cId),
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { BaseImporter } from './baseImporter';
|
import { BaseImporter } from "./baseImporter";
|
||||||
import { Importer } from './importer';
|
import { Importer } from "./importer";
|
||||||
|
|
||||||
import { ImportResult } from '../models/domain/importResult';
|
import { ImportResult } from "../models/domain/importResult";
|
||||||
|
|
||||||
export class BlackBerryCsvImporter extends BaseImporter implements Importer {
|
export class BlackBerryCsvImporter extends BaseImporter implements Importer {
|
||||||
parse(data: string): Promise<ImportResult> {
|
parse(data: string): Promise<ImportResult> {
|
||||||
@@ -12,15 +12,15 @@ export class BlackBerryCsvImporter extends BaseImporter implements Importer {
|
|||||||
return Promise.resolve(result);
|
return Promise.resolve(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
results.forEach(value => {
|
results.forEach((value) => {
|
||||||
if (value.grouping === 'list') {
|
if (value.grouping === "list") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const cipher = this.initLoginCipher();
|
const cipher = this.initLoginCipher();
|
||||||
cipher.favorite = value.fav === '1';
|
cipher.favorite = value.fav === "1";
|
||||||
cipher.name = this.getValueOrDefault(value.name);
|
cipher.name = this.getValueOrDefault(value.name);
|
||||||
cipher.notes = this.getValueOrDefault(value.extra);
|
cipher.notes = this.getValueOrDefault(value.extra);
|
||||||
if (value.grouping !== 'note') {
|
if (value.grouping !== "note") {
|
||||||
cipher.login.uris = this.makeUriArray(value.url);
|
cipher.login.uris = this.makeUriArray(value.url);
|
||||||
cipher.login.password = this.getValueOrDefault(value.password);
|
cipher.login.password = this.getValueOrDefault(value.password);
|
||||||
cipher.login.username = this.getValueOrDefault(value.username);
|
cipher.login.username = this.getValueOrDefault(value.username);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { BaseImporter } from './baseImporter';
|
import { BaseImporter } from "./baseImporter";
|
||||||
import { Importer } from './importer';
|
import { Importer } from "./importer";
|
||||||
|
|
||||||
import { ImportResult } from '../models/domain/importResult';
|
import { ImportResult } from "../models/domain/importResult";
|
||||||
|
|
||||||
export class BlurCsvImporter extends BaseImporter implements Importer {
|
export class BlurCsvImporter extends BaseImporter implements Importer {
|
||||||
parse(data: string): Promise<ImportResult> {
|
parse(data: string): Promise<ImportResult> {
|
||||||
@@ -12,13 +12,15 @@ export class BlurCsvImporter extends BaseImporter implements Importer {
|
|||||||
return Promise.resolve(result);
|
return Promise.resolve(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
results.forEach(value => {
|
results.forEach((value) => {
|
||||||
if (value.label === 'null') {
|
if (value.label === "null") {
|
||||||
value.label = null;
|
value.label = null;
|
||||||
}
|
}
|
||||||
const cipher = this.initLoginCipher();
|
const cipher = this.initLoginCipher();
|
||||||
cipher.name = this.getValueOrDefault(value.label,
|
cipher.name = this.getValueOrDefault(
|
||||||
this.getValueOrDefault(this.nameFromUrl(value.domain), '--'));
|
value.label,
|
||||||
|
this.getValueOrDefault(this.nameFromUrl(value.domain), "--")
|
||||||
|
);
|
||||||
cipher.login.uris = this.makeUriArray(value.domain);
|
cipher.login.uris = this.makeUriArray(value.domain);
|
||||||
cipher.login.password = this.getValueOrDefault(value.password);
|
cipher.login.password = this.getValueOrDefault(value.password);
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
import { BaseImporter } from './baseImporter';
|
import { BaseImporter } from "./baseImporter";
|
||||||
import { Importer } from './importer';
|
import { Importer } from "./importer";
|
||||||
|
|
||||||
import { ImportResult } from '../models/domain/importResult';
|
import { ImportResult } from "../models/domain/importResult";
|
||||||
|
|
||||||
const OfficialProps = [
|
const OfficialProps = ["!group_id", "!group_name", "title", "username", "password", "URL", "id"];
|
||||||
'!group_id', '!group_name', 'title', 'username', 'password', 'URL', 'id',
|
|
||||||
];
|
|
||||||
|
|
||||||
export class ButtercupCsvImporter extends BaseImporter implements Importer {
|
export class ButtercupCsvImporter extends BaseImporter implements Importer {
|
||||||
parse(data: string): Promise<ImportResult> {
|
parse(data: string): Promise<ImportResult> {
|
||||||
@@ -16,11 +14,11 @@ export class ButtercupCsvImporter extends BaseImporter implements Importer {
|
|||||||
return Promise.resolve(result);
|
return Promise.resolve(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
results.forEach(value => {
|
results.forEach((value) => {
|
||||||
this.processFolder(result, this.getValueOrDefault(value['!group_name']));
|
this.processFolder(result, this.getValueOrDefault(value["!group_name"]));
|
||||||
|
|
||||||
const cipher = this.initLoginCipher();
|
const cipher = this.initLoginCipher();
|
||||||
cipher.name = this.getValueOrDefault(value.title, '--');
|
cipher.name = this.getValueOrDefault(value.title, "--");
|
||||||
cipher.login.username = this.getValueOrDefault(value.username);
|
cipher.login.username = this.getValueOrDefault(value.username);
|
||||||
cipher.login.password = this.getValueOrDefault(value.password);
|
cipher.login.password = this.getValueOrDefault(value.password);
|
||||||
cipher.login.uris = this.makeUriArray(value.URL);
|
cipher.login.uris = this.makeUriArray(value.URL);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { BaseImporter } from './baseImporter';
|
import { BaseImporter } from "./baseImporter";
|
||||||
import { Importer } from './importer';
|
import { Importer } from "./importer";
|
||||||
|
|
||||||
import { ImportResult } from '../models/domain/importResult';
|
import { ImportResult } from "../models/domain/importResult";
|
||||||
|
|
||||||
export class ChromeCsvImporter extends BaseImporter implements Importer {
|
export class ChromeCsvImporter extends BaseImporter implements Importer {
|
||||||
parse(data: string): Promise<ImportResult> {
|
parse(data: string): Promise<ImportResult> {
|
||||||
@@ -12,9 +12,9 @@ export class ChromeCsvImporter extends BaseImporter implements Importer {
|
|||||||
return Promise.resolve(result);
|
return Promise.resolve(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
results.forEach(value => {
|
results.forEach((value) => {
|
||||||
const cipher = this.initLoginCipher();
|
const cipher = this.initLoginCipher();
|
||||||
cipher.name = this.getValueOrDefault(value.name, '--');
|
cipher.name = this.getValueOrDefault(value.name, "--");
|
||||||
cipher.login.username = this.getValueOrDefault(value.username);
|
cipher.login.username = this.getValueOrDefault(value.username);
|
||||||
cipher.login.password = this.getValueOrDefault(value.password);
|
cipher.login.password = this.getValueOrDefault(value.password);
|
||||||
cipher.login.uris = this.makeUriArray(value.url);
|
cipher.login.uris = this.makeUriArray(value.url);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { BaseImporter } from './baseImporter';
|
import { BaseImporter } from "./baseImporter";
|
||||||
import { Importer } from './importer';
|
import { Importer } from "./importer";
|
||||||
|
|
||||||
import { ImportResult } from '../models/domain/importResult';
|
import { ImportResult } from "../models/domain/importResult";
|
||||||
|
|
||||||
export class ClipperzHtmlImporter extends BaseImporter implements Importer {
|
export class ClipperzHtmlImporter extends BaseImporter implements Importer {
|
||||||
parse(data: string): Promise<ImportResult> {
|
parse(data: string): Promise<ImportResult> {
|
||||||
@@ -12,9 +12,9 @@ export class ClipperzHtmlImporter extends BaseImporter implements Importer {
|
|||||||
return Promise.resolve(result);
|
return Promise.resolve(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
const textarea = doc.querySelector('textarea');
|
const textarea = doc.querySelector("textarea");
|
||||||
if (textarea == null || this.isNullOrWhitespace(textarea.textContent)) {
|
if (textarea == null || this.isNullOrWhitespace(textarea.textContent)) {
|
||||||
result.errorMessage = 'Missing textarea.';
|
result.errorMessage = "Missing textarea.";
|
||||||
result.success = false;
|
result.success = false;
|
||||||
return Promise.resolve(result);
|
return Promise.resolve(result);
|
||||||
}
|
}
|
||||||
@@ -23,10 +23,10 @@ export class ClipperzHtmlImporter extends BaseImporter implements Importer {
|
|||||||
entries.forEach((entry: any) => {
|
entries.forEach((entry: any) => {
|
||||||
const cipher = this.initLoginCipher();
|
const cipher = this.initLoginCipher();
|
||||||
if (!this.isNullOrWhitespace(entry.label)) {
|
if (!this.isNullOrWhitespace(entry.label)) {
|
||||||
cipher.name = entry.label.split(' ')[0];
|
cipher.name = entry.label.split(" ")[0];
|
||||||
}
|
}
|
||||||
if (entry.data != null && !this.isNullOrWhitespace(entry.data.notes)) {
|
if (entry.data != null && !this.isNullOrWhitespace(entry.data.notes)) {
|
||||||
cipher.notes = entry.data.notes.split('\\n').join('\n');
|
cipher.notes = entry.data.notes.split("\\n").join("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entry.currentVersion != null && entry.currentVersion.fields != null) {
|
if (entry.currentVersion != null && entry.currentVersion.fields != null) {
|
||||||
@@ -38,27 +38,34 @@ export class ClipperzHtmlImporter extends BaseImporter implements Importer {
|
|||||||
const field = entry.currentVersion.fields[property];
|
const field = entry.currentVersion.fields[property];
|
||||||
const actionType = field.actionType != null ? field.actionType.toLowerCase() : null;
|
const actionType = field.actionType != null ? field.actionType.toLowerCase() : null;
|
||||||
switch (actionType) {
|
switch (actionType) {
|
||||||
case 'password':
|
case "password":
|
||||||
cipher.login.password = this.getValueOrDefault(field.value);
|
cipher.login.password = this.getValueOrDefault(field.value);
|
||||||
break;
|
break;
|
||||||
case 'email':
|
case "email":
|
||||||
case 'username':
|
case "username":
|
||||||
case 'user':
|
case "user":
|
||||||
case 'name':
|
case "name":
|
||||||
cipher.login.username = this.getValueOrDefault(field.value);
|
cipher.login.username = this.getValueOrDefault(field.value);
|
||||||
break;
|
break;
|
||||||
case 'url':
|
case "url":
|
||||||
cipher.login.uris = this.makeUriArray(field.value);
|
cipher.login.uris = this.makeUriArray(field.value);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
const labelLower = field.label != null ? field.label.toLowerCase() : null;
|
const labelLower = field.label != null ? field.label.toLowerCase() : null;
|
||||||
if (cipher.login.password == null && this.passwordFieldNames.indexOf(labelLower) > -1) {
|
if (
|
||||||
|
cipher.login.password == null &&
|
||||||
|
this.passwordFieldNames.indexOf(labelLower) > -1
|
||||||
|
) {
|
||||||
cipher.login.password = this.getValueOrDefault(field.value);
|
cipher.login.password = this.getValueOrDefault(field.value);
|
||||||
} else if (cipher.login.username == null &&
|
} else if (
|
||||||
this.usernameFieldNames.indexOf(labelLower) > -1) {
|
cipher.login.username == null &&
|
||||||
|
this.usernameFieldNames.indexOf(labelLower) > -1
|
||||||
|
) {
|
||||||
cipher.login.username = this.getValueOrDefault(field.value);
|
cipher.login.username = this.getValueOrDefault(field.value);
|
||||||
} else if ((cipher.login.uris == null || cipher.login.uris.length === 0) &&
|
} else if (
|
||||||
this.uriFieldNames.indexOf(labelLower) > -1) {
|
(cipher.login.uris == null || cipher.login.uris.length === 0) &&
|
||||||
|
this.uriFieldNames.indexOf(labelLower) > -1
|
||||||
|
) {
|
||||||
cipher.login.uris = this.makeUriArray(field.value);
|
cipher.login.uris = this.makeUriArray(field.value);
|
||||||
} else {
|
} else {
|
||||||
this.processKvp(cipher, field.label, field.value);
|
this.processKvp(cipher, field.label, field.value);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { BaseImporter } from './baseImporter';
|
import { BaseImporter } from "./baseImporter";
|
||||||
import { Importer } from './importer';
|
import { Importer } from "./importer";
|
||||||
|
|
||||||
import { ImportResult } from '../models/domain/importResult';
|
import { ImportResult } from "../models/domain/importResult";
|
||||||
|
|
||||||
export class CodebookCsvImporter extends BaseImporter implements Importer {
|
export class CodebookCsvImporter extends BaseImporter implements Importer {
|
||||||
parse(data: string): Promise<ImportResult> {
|
parse(data: string): Promise<ImportResult> {
|
||||||
@@ -12,12 +12,12 @@ export class CodebookCsvImporter extends BaseImporter implements Importer {
|
|||||||
return Promise.resolve(result);
|
return Promise.resolve(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
results.forEach(value => {
|
results.forEach((value) => {
|
||||||
this.processFolder(result, this.getValueOrDefault(value.Category));
|
this.processFolder(result, this.getValueOrDefault(value.Category));
|
||||||
|
|
||||||
const cipher = this.initLoginCipher();
|
const cipher = this.initLoginCipher();
|
||||||
cipher.favorite = this.getValueOrDefault(value.Favorite) === 'True';
|
cipher.favorite = this.getValueOrDefault(value.Favorite) === "True";
|
||||||
cipher.name = this.getValueOrDefault(value.Entry, '--');
|
cipher.name = this.getValueOrDefault(value.Entry, "--");
|
||||||
cipher.notes = this.getValueOrDefault(value.Note);
|
cipher.notes = this.getValueOrDefault(value.Note);
|
||||||
cipher.login.username = this.getValueOrDefault(value.Username, value.Email);
|
cipher.login.username = this.getValueOrDefault(value.Username, value.Email);
|
||||||
cipher.login.password = this.getValueOrDefault(value.Password);
|
cipher.login.password = this.getValueOrDefault(value.Password);
|
||||||
@@ -25,12 +25,12 @@ export class CodebookCsvImporter extends BaseImporter implements Importer {
|
|||||||
cipher.login.uris = this.makeUriArray(value.Website);
|
cipher.login.uris = this.makeUriArray(value.Website);
|
||||||
|
|
||||||
if (!this.isNullOrWhitespace(value.Username)) {
|
if (!this.isNullOrWhitespace(value.Username)) {
|
||||||
this.processKvp(cipher, 'Email', value.Email);
|
this.processKvp(cipher, "Email", value.Email);
|
||||||
}
|
}
|
||||||
this.processKvp(cipher, 'Phone', value.Phone);
|
this.processKvp(cipher, "Phone", value.Phone);
|
||||||
this.processKvp(cipher, 'PIN', value.PIN);
|
this.processKvp(cipher, "PIN", value.PIN);
|
||||||
this.processKvp(cipher, 'Account', value.Account);
|
this.processKvp(cipher, "Account", value.Account);
|
||||||
this.processKvp(cipher, 'Date', value.Date);
|
this.processKvp(cipher, "Date", value.Date);
|
||||||
|
|
||||||
this.convertToNoteIfNeeded(cipher);
|
this.convertToNoteIfNeeded(cipher);
|
||||||
this.cleanupCipher(cipher);
|
this.cleanupCipher(cipher);
|
||||||
|
|||||||
@@ -1,18 +1,26 @@
|
|||||||
import { BaseImporter } from './baseImporter';
|
import { BaseImporter } from "./baseImporter";
|
||||||
import { Importer } from './importer';
|
import { Importer } from "./importer";
|
||||||
|
|
||||||
import { ImportResult } from '../models/domain/importResult';
|
import { ImportResult } from "../models/domain/importResult";
|
||||||
|
|
||||||
import { CardView } from '../models/view/cardView';
|
import { CardView } from "../models/view/cardView";
|
||||||
import { CipherView } from '../models/view/cipherView';
|
import { CipherView } from "../models/view/cipherView";
|
||||||
import { IdentityView } from '../models/view/identityView';
|
import { IdentityView } from "../models/view/identityView";
|
||||||
import { SecureNoteView } from '../models/view/secureNoteView';
|
import { SecureNoteView } from "../models/view/secureNoteView";
|
||||||
|
|
||||||
import { CipherType } from '../enums/cipherType';
|
import { CipherType } from "../enums/cipherType";
|
||||||
import { SecureNoteType } from '../enums/secureNoteType';
|
import { SecureNoteType } from "../enums/secureNoteType";
|
||||||
|
|
||||||
const HandledResults = new Set(['ADDRESS', 'AUTHENTIFIANT', 'BANKSTATEMENT', 'IDCARD', 'IDENTITY',
|
const HandledResults = new Set([
|
||||||
'PAYMENTMEANS_CREDITCARD', 'PAYMENTMEAN_PAYPAL', 'EMAIL']);
|
"ADDRESS",
|
||||||
|
"AUTHENTIFIANT",
|
||||||
|
"BANKSTATEMENT",
|
||||||
|
"IDCARD",
|
||||||
|
"IDENTITY",
|
||||||
|
"PAYMENTMEANS_CREDITCARD",
|
||||||
|
"PAYMENTMEAN_PAYPAL",
|
||||||
|
"EMAIL",
|
||||||
|
]);
|
||||||
|
|
||||||
export class DashlaneJsonImporter extends BaseImporter implements Importer {
|
export class DashlaneJsonImporter extends BaseImporter implements Importer {
|
||||||
private result: ImportResult;
|
private result: ImportResult;
|
||||||
@@ -32,10 +40,10 @@ export class DashlaneJsonImporter extends BaseImporter implements Importer {
|
|||||||
this.processAuth(results.AUTHENTIFIANT);
|
this.processAuth(results.AUTHENTIFIANT);
|
||||||
}
|
}
|
||||||
if (results.BANKSTATEMENT != null) {
|
if (results.BANKSTATEMENT != null) {
|
||||||
this.processNote(results.BANKSTATEMENT, 'BankAccountName');
|
this.processNote(results.BANKSTATEMENT, "BankAccountName");
|
||||||
}
|
}
|
||||||
if (results.IDCARD != null) {
|
if (results.IDCARD != null) {
|
||||||
this.processNote(results.IDCARD, 'Fullname');
|
this.processNote(results.IDCARD, "Fullname");
|
||||||
}
|
}
|
||||||
if (results.PAYMENTMEANS_CREDITCARD != null) {
|
if (results.PAYMENTMEANS_CREDITCARD != null) {
|
||||||
this.processCard(results.PAYMENTMEANS_CREDITCARD);
|
this.processCard(results.PAYMENTMEANS_CREDITCARD);
|
||||||
@@ -46,7 +54,7 @@ export class DashlaneJsonImporter extends BaseImporter implements Importer {
|
|||||||
|
|
||||||
for (const key in results) {
|
for (const key in results) {
|
||||||
if (results.hasOwnProperty(key) && !HandledResults.has(key)) {
|
if (results.hasOwnProperty(key) && !HandledResults.has(key)) {
|
||||||
this.processNote(results[key], null, 'Generic Note');
|
this.processNote(results[key], null, "Generic Note");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,17 +67,19 @@ export class DashlaneJsonImporter extends BaseImporter implements Importer {
|
|||||||
const cipher = this.initLoginCipher();
|
const cipher = this.initLoginCipher();
|
||||||
cipher.name = this.getValueOrDefault(credential.title);
|
cipher.name = this.getValueOrDefault(credential.title);
|
||||||
|
|
||||||
cipher.login.username = this.getValueOrDefault(credential.login,
|
cipher.login.username = this.getValueOrDefault(
|
||||||
this.getValueOrDefault(credential.secondaryLogin));
|
credential.login,
|
||||||
|
this.getValueOrDefault(credential.secondaryLogin)
|
||||||
|
);
|
||||||
if (this.isNullOrWhitespace(cipher.login.username)) {
|
if (this.isNullOrWhitespace(cipher.login.username)) {
|
||||||
cipher.login.username = this.getValueOrDefault(credential.email);
|
cipher.login.username = this.getValueOrDefault(credential.email);
|
||||||
} else if (!this.isNullOrWhitespace(credential.email)) {
|
} else if (!this.isNullOrWhitespace(credential.email)) {
|
||||||
cipher.notes = ('Email: ' + credential.email + '\n');
|
cipher.notes = "Email: " + credential.email + "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
cipher.login.password = this.getValueOrDefault(credential.password);
|
cipher.login.password = this.getValueOrDefault(credential.password);
|
||||||
cipher.login.uris = this.makeUriArray(credential.domain);
|
cipher.login.uris = this.makeUriArray(credential.domain);
|
||||||
cipher.notes += this.getValueOrDefault(credential.note, '');
|
cipher.notes += this.getValueOrDefault(credential.note, "");
|
||||||
|
|
||||||
this.convertToNoteIfNeeded(cipher);
|
this.convertToNoteIfNeeded(cipher);
|
||||||
this.cleanupCipher(cipher);
|
this.cleanupCipher(cipher);
|
||||||
@@ -82,8 +92,8 @@ export class DashlaneJsonImporter extends BaseImporter implements Importer {
|
|||||||
const cipher = new CipherView();
|
const cipher = new CipherView();
|
||||||
cipher.identity = new IdentityView();
|
cipher.identity = new IdentityView();
|
||||||
cipher.type = CipherType.Identity;
|
cipher.type = CipherType.Identity;
|
||||||
cipher.name = this.getValueOrDefault(obj.fullName, '');
|
cipher.name = this.getValueOrDefault(obj.fullName, "");
|
||||||
const nameParts = cipher.name.split(' ');
|
const nameParts = cipher.name.split(" ");
|
||||||
if (nameParts.length > 0) {
|
if (nameParts.length > 0) {
|
||||||
cipher.identity.firstName = this.getValueOrDefault(nameParts[0]);
|
cipher.identity.firstName = this.getValueOrDefault(nameParts[0]);
|
||||||
}
|
}
|
||||||
@@ -131,7 +141,7 @@ export class DashlaneJsonImporter extends BaseImporter implements Importer {
|
|||||||
if (this.isNullOrWhitespace(cipher.name)) {
|
if (this.isNullOrWhitespace(cipher.name)) {
|
||||||
cipher.name = cipher.card.brand;
|
cipher.name = cipher.card.brand;
|
||||||
} else {
|
} else {
|
||||||
cipher.name += (' - ' + cipher.card.brand);
|
cipher.name += " - " + cipher.card.brand;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.cleanupCipher(cipher);
|
this.cleanupCipher(cipher);
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import { BaseImporter } from './baseImporter';
|
import { BaseImporter } from "./baseImporter";
|
||||||
import { Importer } from './importer';
|
import { Importer } from "./importer";
|
||||||
|
|
||||||
import { ImportResult } from '../models/domain/importResult';
|
import { ImportResult } from "../models/domain/importResult";
|
||||||
|
|
||||||
import { CardView } from '../models/view/cardView';
|
import { CardView } from "../models/view/cardView";
|
||||||
|
|
||||||
import { CipherType } from '../enums/cipherType';
|
import { CipherType } from "../enums/cipherType";
|
||||||
|
|
||||||
export class EncryptrCsvImporter extends BaseImporter implements Importer {
|
export class EncryptrCsvImporter extends BaseImporter implements Importer {
|
||||||
parse(data: string): Promise<ImportResult> {
|
parse(data: string): Promise<ImportResult> {
|
||||||
@@ -16,34 +16,34 @@ export class EncryptrCsvImporter extends BaseImporter implements Importer {
|
|||||||
return Promise.resolve(result);
|
return Promise.resolve(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
results.forEach(value => {
|
results.forEach((value) => {
|
||||||
const cipher = this.initLoginCipher();
|
const cipher = this.initLoginCipher();
|
||||||
cipher.name = this.getValueOrDefault(value.Label, '--');
|
cipher.name = this.getValueOrDefault(value.Label, "--");
|
||||||
cipher.notes = this.getValueOrDefault(value.Notes);
|
cipher.notes = this.getValueOrDefault(value.Notes);
|
||||||
const text = this.getValueOrDefault(value.Text);
|
const text = this.getValueOrDefault(value.Text);
|
||||||
if (!this.isNullOrWhitespace(text)) {
|
if (!this.isNullOrWhitespace(text)) {
|
||||||
if (this.isNullOrWhitespace(cipher.notes)) {
|
if (this.isNullOrWhitespace(cipher.notes)) {
|
||||||
cipher.notes = text;
|
cipher.notes = text;
|
||||||
} else {
|
} else {
|
||||||
cipher.notes += ('\n\n' + text);
|
cipher.notes += "\n\n" + text;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const type = value['Entry Type'];
|
const type = value["Entry Type"];
|
||||||
if (type === 'Password') {
|
if (type === "Password") {
|
||||||
cipher.login.username = this.getValueOrDefault(value.Username);
|
cipher.login.username = this.getValueOrDefault(value.Username);
|
||||||
cipher.login.password = this.getValueOrDefault(value.Password);
|
cipher.login.password = this.getValueOrDefault(value.Password);
|
||||||
cipher.login.uris = this.makeUriArray(value['Site URL']);
|
cipher.login.uris = this.makeUriArray(value["Site URL"]);
|
||||||
} else if (type === 'Credit Card') {
|
} else if (type === "Credit Card") {
|
||||||
cipher.type = CipherType.Card;
|
cipher.type = CipherType.Card;
|
||||||
cipher.card = new CardView();
|
cipher.card = new CardView();
|
||||||
cipher.card.cardholderName = this.getValueOrDefault(value['Name on card']);
|
cipher.card.cardholderName = this.getValueOrDefault(value["Name on card"]);
|
||||||
cipher.card.number = this.getValueOrDefault(value['Card Number']);
|
cipher.card.number = this.getValueOrDefault(value["Card Number"]);
|
||||||
cipher.card.brand = this.getCardBrand(cipher.card.number);
|
cipher.card.brand = this.getCardBrand(cipher.card.number);
|
||||||
cipher.card.code = this.getValueOrDefault(value.CVV);
|
cipher.card.code = this.getValueOrDefault(value.CVV);
|
||||||
const expiry = this.getValueOrDefault(value.Expiry);
|
const expiry = this.getValueOrDefault(value.Expiry);
|
||||||
if (!this.isNullOrWhitespace(expiry)) {
|
if (!this.isNullOrWhitespace(expiry)) {
|
||||||
const expParts = expiry.split('/');
|
const expParts = expiry.split("/");
|
||||||
if (expParts.length > 1) {
|
if (expParts.length > 1) {
|
||||||
cipher.card.expMonth = parseInt(expParts[0], null).toString();
|
cipher.card.expMonth = parseInt(expParts[0], null).toString();
|
||||||
cipher.card.expYear = (2000 + parseInt(expParts[1], null)).toString();
|
cipher.card.expYear = (2000 + parseInt(expParts[1], null)).toString();
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import { BaseImporter } from './baseImporter';
|
import { BaseImporter } from "./baseImporter";
|
||||||
import { Importer } from './importer';
|
import { Importer } from "./importer";
|
||||||
|
|
||||||
import { ImportResult } from '../models/domain/importResult';
|
import { ImportResult } from "../models/domain/importResult";
|
||||||
|
|
||||||
import { CipherType } from '../enums/cipherType';
|
import { CipherType } from "../enums/cipherType";
|
||||||
import { SecureNoteType } from '../enums/secureNoteType';
|
import { SecureNoteType } from "../enums/secureNoteType";
|
||||||
|
|
||||||
import { CardView } from '../models/view/cardView';
|
import { CardView } from "../models/view/cardView";
|
||||||
import { SecureNoteView } from '../models/view/secureNoteView';
|
import { SecureNoteView } from "../models/view/secureNoteView";
|
||||||
|
|
||||||
export class EnpassCsvImporter extends BaseImporter implements Importer {
|
export class EnpassCsvImporter extends BaseImporter implements Importer {
|
||||||
parse(data: string): Promise<ImportResult> {
|
parse(data: string): Promise<ImportResult> {
|
||||||
@@ -19,31 +19,38 @@ export class EnpassCsvImporter extends BaseImporter implements Importer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let firstRow = true;
|
let firstRow = true;
|
||||||
results.forEach(value => {
|
results.forEach((value) => {
|
||||||
if (value.length < 2 || (firstRow && (value[0] === 'Title' || value[0] === 'title'))) {
|
if (value.length < 2 || (firstRow && (value[0] === "Title" || value[0] === "title"))) {
|
||||||
firstRow = false;
|
firstRow = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const cipher = this.initLoginCipher();
|
const cipher = this.initLoginCipher();
|
||||||
cipher.notes = this.getValueOrDefault(value[value.length - 1]);
|
cipher.notes = this.getValueOrDefault(value[value.length - 1]);
|
||||||
cipher.name = this.getValueOrDefault(value[0], '--');
|
cipher.name = this.getValueOrDefault(value[0], "--");
|
||||||
|
|
||||||
if (value.length === 2 || (!this.containsField(value, 'username') &&
|
if (
|
||||||
!this.containsField(value, 'password') && !this.containsField(value, 'email') &&
|
value.length === 2 ||
|
||||||
!this.containsField(value, 'url'))) {
|
(!this.containsField(value, "username") &&
|
||||||
|
!this.containsField(value, "password") &&
|
||||||
|
!this.containsField(value, "email") &&
|
||||||
|
!this.containsField(value, "url"))
|
||||||
|
) {
|
||||||
cipher.type = CipherType.SecureNote;
|
cipher.type = CipherType.SecureNote;
|
||||||
cipher.secureNote = new SecureNoteView();
|
cipher.secureNote = new SecureNoteView();
|
||||||
cipher.secureNote.type = SecureNoteType.Generic;
|
cipher.secureNote.type = SecureNoteType.Generic;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.containsField(value, 'cardholder') && this.containsField(value, 'number') &&
|
if (
|
||||||
this.containsField(value, 'expiry date')) {
|
this.containsField(value, "cardholder") &&
|
||||||
|
this.containsField(value, "number") &&
|
||||||
|
this.containsField(value, "expiry date")
|
||||||
|
) {
|
||||||
cipher.type = CipherType.Card;
|
cipher.type = CipherType.Card;
|
||||||
cipher.card = new CardView();
|
cipher.card = new CardView();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value.length > 2 && (value.length % 2) === 0) {
|
if (value.length > 2 && value.length % 2 === 0) {
|
||||||
for (let i = 0; i < value.length - 2; i += 2) {
|
for (let i = 0; i < value.length - 2; i += 2) {
|
||||||
const fieldValue: string = value[i + 2];
|
const fieldValue: string = value[i + 2];
|
||||||
if (this.isNullOrWhitespace(fieldValue)) {
|
if (this.isNullOrWhitespace(fieldValue)) {
|
||||||
@@ -54,37 +61,51 @@ export class EnpassCsvImporter extends BaseImporter implements Importer {
|
|||||||
const fieldNameLower = fieldName.toLowerCase();
|
const fieldNameLower = fieldName.toLowerCase();
|
||||||
|
|
||||||
if (cipher.type === CipherType.Login) {
|
if (cipher.type === CipherType.Login) {
|
||||||
if (fieldNameLower === 'url' && (cipher.login.uris == null || cipher.login.uris.length === 0)) {
|
if (
|
||||||
|
fieldNameLower === "url" &&
|
||||||
|
(cipher.login.uris == null || cipher.login.uris.length === 0)
|
||||||
|
) {
|
||||||
cipher.login.uris = this.makeUriArray(fieldValue);
|
cipher.login.uris = this.makeUriArray(fieldValue);
|
||||||
continue;
|
continue;
|
||||||
} else if ((fieldNameLower === 'username' || fieldNameLower === 'email') &&
|
} else if (
|
||||||
this.isNullOrWhitespace(cipher.login.username)) {
|
(fieldNameLower === "username" || fieldNameLower === "email") &&
|
||||||
|
this.isNullOrWhitespace(cipher.login.username)
|
||||||
|
) {
|
||||||
cipher.login.username = fieldValue;
|
cipher.login.username = fieldValue;
|
||||||
continue;
|
continue;
|
||||||
} else if (fieldNameLower === 'password' && this.isNullOrWhitespace(cipher.login.password)) {
|
} else if (
|
||||||
|
fieldNameLower === "password" &&
|
||||||
|
this.isNullOrWhitespace(cipher.login.password)
|
||||||
|
) {
|
||||||
cipher.login.password = fieldValue;
|
cipher.login.password = fieldValue;
|
||||||
continue;
|
continue;
|
||||||
} else if (fieldNameLower === 'totp' && this.isNullOrWhitespace(cipher.login.totp)) {
|
} else if (fieldNameLower === "totp" && this.isNullOrWhitespace(cipher.login.totp)) {
|
||||||
cipher.login.totp = fieldValue;
|
cipher.login.totp = fieldValue;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else if (cipher.type === CipherType.Card) {
|
} else if (cipher.type === CipherType.Card) {
|
||||||
if (fieldNameLower === 'cardholder' && this.isNullOrWhitespace(cipher.card.cardholderName)) {
|
if (
|
||||||
|
fieldNameLower === "cardholder" &&
|
||||||
|
this.isNullOrWhitespace(cipher.card.cardholderName)
|
||||||
|
) {
|
||||||
cipher.card.cardholderName = fieldValue;
|
cipher.card.cardholderName = fieldValue;
|
||||||
continue;
|
continue;
|
||||||
} else if (fieldNameLower === 'number' && this.isNullOrWhitespace(cipher.card.number)) {
|
} else if (fieldNameLower === "number" && this.isNullOrWhitespace(cipher.card.number)) {
|
||||||
cipher.card.number = fieldValue;
|
cipher.card.number = fieldValue;
|
||||||
cipher.card.brand = this.getCardBrand(fieldValue);
|
cipher.card.brand = this.getCardBrand(fieldValue);
|
||||||
continue;
|
continue;
|
||||||
} else if (fieldNameLower === 'cvc' && this.isNullOrWhitespace(cipher.card.code)) {
|
} else if (fieldNameLower === "cvc" && this.isNullOrWhitespace(cipher.card.code)) {
|
||||||
cipher.card.code = fieldValue;
|
cipher.card.code = fieldValue;
|
||||||
continue;
|
continue;
|
||||||
} else if (fieldNameLower === 'expiry date' && this.isNullOrWhitespace(cipher.card.expMonth) &&
|
} else if (
|
||||||
this.isNullOrWhitespace(cipher.card.expYear)) {
|
fieldNameLower === "expiry date" &&
|
||||||
|
this.isNullOrWhitespace(cipher.card.expMonth) &&
|
||||||
|
this.isNullOrWhitespace(cipher.card.expYear)
|
||||||
|
) {
|
||||||
if (this.setCardExpiration(cipher, fieldValue)) {
|
if (this.setCardExpiration(cipher, fieldValue)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else if (fieldNameLower === 'type') {
|
} else if (fieldNameLower === "type") {
|
||||||
// Skip since brand was determined from number above
|
// Skip since brand was determined from number above
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -106,7 +127,9 @@ export class EnpassCsvImporter extends BaseImporter implements Importer {
|
|||||||
if (fields == null || name == null) {
|
if (fields == null || name == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return fields.filter(f => !this.isNullOrWhitespace(f) &&
|
return (
|
||||||
f.toLowerCase() === name.toLowerCase()).length > 0;
|
fields.filter((f) => !this.isNullOrWhitespace(f) && f.toLowerCase() === name.toLowerCase())
|
||||||
|
.length > 0
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
import { BaseImporter } from './baseImporter';
|
import { BaseImporter } from "./baseImporter";
|
||||||
import { Importer } from './importer';
|
import { Importer } from "./importer";
|
||||||
|
|
||||||
import { ImportResult } from '../models/domain/importResult';
|
import { ImportResult } from "../models/domain/importResult";
|
||||||
|
|
||||||
import { CardView } from '../models/view/cardView';
|
import { CardView } from "../models/view/cardView";
|
||||||
import { CipherView } from '../models/view/cipherView';
|
import { CipherView } from "../models/view/cipherView";
|
||||||
import { FolderView } from '../models/view/folderView';
|
import { FolderView } from "../models/view/folderView";
|
||||||
|
|
||||||
import { CipherType } from '../enums/cipherType';
|
import { CipherType } from "../enums/cipherType";
|
||||||
import { FieldType } from '../enums/fieldType';
|
import { FieldType } from "../enums/fieldType";
|
||||||
|
|
||||||
export class EnpassJsonImporter extends BaseImporter implements Importer {
|
export class EnpassJsonImporter extends BaseImporter implements Importer {
|
||||||
parse(data: string): Promise<ImportResult> {
|
parse(data: string): Promise<ImportResult> {
|
||||||
@@ -32,7 +32,10 @@ export class EnpassJsonImporter extends BaseImporter implements Importer {
|
|||||||
|
|
||||||
results.items.forEach((item: any) => {
|
results.items.forEach((item: any) => {
|
||||||
if (item.folders != null && item.folders.length > 0 && foldersIndexMap.has(item.folders[0])) {
|
if (item.folders != null && item.folders.length > 0 && foldersIndexMap.has(item.folders[0])) {
|
||||||
result.folderRelationships.push([result.ciphers.length, foldersIndexMap.get(item.folders[0])]);
|
result.folderRelationships.push([
|
||||||
|
result.ciphers.length,
|
||||||
|
foldersIndexMap.get(item.folders[0]),
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
const cipher = this.initLoginCipher();
|
const cipher = this.initLoginCipher();
|
||||||
@@ -40,19 +43,24 @@ export class EnpassJsonImporter extends BaseImporter implements Importer {
|
|||||||
cipher.favorite = item.favorite > 0;
|
cipher.favorite = item.favorite > 0;
|
||||||
|
|
||||||
if (item.template_type != null && item.fields != null && item.fields.length > 0) {
|
if (item.template_type != null && item.fields != null && item.fields.length > 0) {
|
||||||
if (item.template_type.indexOf('login.') === 0 || item.template_type.indexOf('password.') === 0) {
|
if (
|
||||||
|
item.template_type.indexOf("login.") === 0 ||
|
||||||
|
item.template_type.indexOf("password.") === 0
|
||||||
|
) {
|
||||||
this.processLogin(cipher, item.fields);
|
this.processLogin(cipher, item.fields);
|
||||||
} else if (item.template_type.indexOf('creditcard.') === 0) {
|
} else if (item.template_type.indexOf("creditcard.") === 0) {
|
||||||
this.processCard(cipher, item.fields);
|
this.processCard(cipher, item.fields);
|
||||||
} else if (item.template_type.indexOf('identity.') < 0 &&
|
} else if (
|
||||||
item.fields.some((f: any) => f.type === 'password' && !this.isNullOrWhitespace(f.value))) {
|
item.template_type.indexOf("identity.") < 0 &&
|
||||||
|
item.fields.some((f: any) => f.type === "password" && !this.isNullOrWhitespace(f.value))
|
||||||
|
) {
|
||||||
this.processLogin(cipher, item.fields);
|
this.processLogin(cipher, item.fields);
|
||||||
} else {
|
} else {
|
||||||
this.processNote(cipher, item.fields);
|
this.processNote(cipher, item.fields);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cipher.notes += ('\n' + this.getValueOrDefault(item.note, ''));
|
cipher.notes += "\n" + this.getValueOrDefault(item.note, "");
|
||||||
this.convertToNoteIfNeeded(cipher);
|
this.convertToNoteIfNeeded(cipher);
|
||||||
this.cleanupCipher(cipher);
|
this.cleanupCipher(cipher);
|
||||||
result.ciphers.push(cipher);
|
result.ciphers.push(cipher);
|
||||||
@@ -65,22 +73,28 @@ export class EnpassJsonImporter extends BaseImporter implements Importer {
|
|||||||
private processLogin(cipher: CipherView, fields: any[]) {
|
private processLogin(cipher: CipherView, fields: any[]) {
|
||||||
const urls: string[] = [];
|
const urls: string[] = [];
|
||||||
fields.forEach((field: any) => {
|
fields.forEach((field: any) => {
|
||||||
if (this.isNullOrWhitespace(field.value) || field.type === 'section') {
|
if (this.isNullOrWhitespace(field.value) || field.type === "section") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((field.type === 'username' || field.type === 'email') &&
|
if (
|
||||||
this.isNullOrWhitespace(cipher.login.username)) {
|
(field.type === "username" || field.type === "email") &&
|
||||||
|
this.isNullOrWhitespace(cipher.login.username)
|
||||||
|
) {
|
||||||
cipher.login.username = field.value;
|
cipher.login.username = field.value;
|
||||||
} else if (field.type === 'password' && this.isNullOrWhitespace(cipher.login.password)) {
|
} else if (field.type === "password" && this.isNullOrWhitespace(cipher.login.password)) {
|
||||||
cipher.login.password = field.value;
|
cipher.login.password = field.value;
|
||||||
} else if (field.type === 'totp' && this.isNullOrWhitespace(cipher.login.totp)) {
|
} else if (field.type === "totp" && this.isNullOrWhitespace(cipher.login.totp)) {
|
||||||
cipher.login.totp = field.value;
|
cipher.login.totp = field.value;
|
||||||
} else if (field.type === 'url') {
|
} else if (field.type === "url") {
|
||||||
urls.push(field.value);
|
urls.push(field.value);
|
||||||
} else {
|
} else {
|
||||||
this.processKvp(cipher, field.label, field.value,
|
this.processKvp(
|
||||||
field.sensitive === 1 ? FieldType.Hidden : FieldType.Text);
|
cipher,
|
||||||
|
field.label,
|
||||||
|
field.value,
|
||||||
|
field.sensitive === 1 ? FieldType.Hidden : FieldType.Text
|
||||||
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
cipher.login.uris = this.makeUriArray(urls);
|
cipher.login.uris = this.makeUriArray(urls);
|
||||||
@@ -90,36 +104,52 @@ export class EnpassJsonImporter extends BaseImporter implements Importer {
|
|||||||
cipher.card = new CardView();
|
cipher.card = new CardView();
|
||||||
cipher.type = CipherType.Card;
|
cipher.type = CipherType.Card;
|
||||||
fields.forEach((field: any) => {
|
fields.forEach((field: any) => {
|
||||||
if (this.isNullOrWhitespace(field.value) || field.type === 'section' || field.type === 'ccType') {
|
if (
|
||||||
|
this.isNullOrWhitespace(field.value) ||
|
||||||
|
field.type === "section" ||
|
||||||
|
field.type === "ccType"
|
||||||
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (field.type === 'ccName' && this.isNullOrWhitespace(cipher.card.cardholderName)) {
|
if (field.type === "ccName" && this.isNullOrWhitespace(cipher.card.cardholderName)) {
|
||||||
cipher.card.cardholderName = field.value;
|
cipher.card.cardholderName = field.value;
|
||||||
} else if (field.type === 'ccNumber' && this.isNullOrWhitespace(cipher.card.number)) {
|
} else if (field.type === "ccNumber" && this.isNullOrWhitespace(cipher.card.number)) {
|
||||||
cipher.card.number = field.value;
|
cipher.card.number = field.value;
|
||||||
cipher.card.brand = this.getCardBrand(cipher.card.number);
|
cipher.card.brand = this.getCardBrand(cipher.card.number);
|
||||||
} else if (field.type === 'ccCvc' && this.isNullOrWhitespace(cipher.card.code)) {
|
} else if (field.type === "ccCvc" && this.isNullOrWhitespace(cipher.card.code)) {
|
||||||
cipher.card.code = field.value;
|
cipher.card.code = field.value;
|
||||||
} else if (field.type === 'ccExpiry' && this.isNullOrWhitespace(cipher.card.expYear)) {
|
} else if (field.type === "ccExpiry" && this.isNullOrWhitespace(cipher.card.expYear)) {
|
||||||
if (!this.setCardExpiration(cipher, field.value)) {
|
if (!this.setCardExpiration(cipher, field.value)) {
|
||||||
this.processKvp(cipher, field.label, field.value,
|
this.processKvp(
|
||||||
field.sensitive === 1 ? FieldType.Hidden : FieldType.Text);
|
cipher,
|
||||||
|
field.label,
|
||||||
|
field.value,
|
||||||
|
field.sensitive === 1 ? FieldType.Hidden : FieldType.Text
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.processKvp(cipher, field.label, field.value,
|
this.processKvp(
|
||||||
field.sensitive === 1 ? FieldType.Hidden : FieldType.Text);
|
cipher,
|
||||||
|
field.label,
|
||||||
|
field.value,
|
||||||
|
field.sensitive === 1 ? FieldType.Hidden : FieldType.Text
|
||||||
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private processNote(cipher: CipherView, fields: any[]) {
|
private processNote(cipher: CipherView, fields: any[]) {
|
||||||
fields.forEach((field: any) => {
|
fields.forEach((field: any) => {
|
||||||
if (this.isNullOrWhitespace(field.value) || field.type === 'section') {
|
if (this.isNullOrWhitespace(field.value) || field.type === "section") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.processKvp(cipher, field.label, field.value,
|
this.processKvp(
|
||||||
field.sensitive === 1 ? FieldType.Hidden : FieldType.Text);
|
cipher,
|
||||||
|
field.label,
|
||||||
|
field.value,
|
||||||
|
field.sensitive === 1 ? FieldType.Hidden : FieldType.Text
|
||||||
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,7 +164,7 @@ export class EnpassJsonImporter extends BaseImporter implements Importer {
|
|||||||
obj.children = [];
|
obj.children = [];
|
||||||
});
|
});
|
||||||
folders.forEach((obj: any) => {
|
folders.forEach((obj: any) => {
|
||||||
if (obj.parent_uuid != null && obj.parent_uuid !== '' && map.has(obj.parent_uuid)) {
|
if (obj.parent_uuid != null && obj.parent_uuid !== "" && map.has(obj.parent_uuid)) {
|
||||||
map.get(obj.parent_uuid).children.push(obj);
|
map.get(obj.parent_uuid).children.push(obj);
|
||||||
} else {
|
} else {
|
||||||
folderTree.push(obj);
|
folderTree.push(obj);
|
||||||
@@ -148,10 +178,10 @@ export class EnpassJsonImporter extends BaseImporter implements Importer {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
tree.forEach((f: any) => {
|
tree.forEach((f: any) => {
|
||||||
if (f.title != null && f.title.trim() !== '') {
|
if (f.title != null && f.title.trim() !== "") {
|
||||||
let title = f.title.trim();
|
let title = f.title.trim();
|
||||||
if (titlePrefix != null && titlePrefix.trim() !== '') {
|
if (titlePrefix != null && titlePrefix.trim() !== "") {
|
||||||
title = titlePrefix + '/' + title;
|
title = titlePrefix + "/" + title;
|
||||||
}
|
}
|
||||||
map.set(f.uuid, title);
|
map.set(f.uuid, title);
|
||||||
if (f.children != null && f.children.length !== 0) {
|
if (f.children != null && f.children.length !== 0) {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { BaseImporter } from './baseImporter';
|
import { BaseImporter } from "./baseImporter";
|
||||||
import { Importer } from './importer';
|
import { Importer } from "./importer";
|
||||||
|
|
||||||
import { ImportResult } from '../models/domain/importResult';
|
import { ImportResult } from "../models/domain/importResult";
|
||||||
|
|
||||||
export class FirefoxCsvImporter extends BaseImporter implements Importer {
|
export class FirefoxCsvImporter extends BaseImporter implements Importer {
|
||||||
parse(data: string): Promise<ImportResult> {
|
parse(data: string): Promise<ImportResult> {
|
||||||
@@ -12,12 +12,14 @@ export class FirefoxCsvImporter extends BaseImporter implements Importer {
|
|||||||
return Promise.resolve(result);
|
return Promise.resolve(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
results.filter(value => {
|
results
|
||||||
return value.url !== 'chrome://FirefoxAccounts';
|
.filter((value) => {
|
||||||
}).forEach(value => {
|
return value.url !== "chrome://FirefoxAccounts";
|
||||||
|
})
|
||||||
|
.forEach((value) => {
|
||||||
const cipher = this.initLoginCipher();
|
const cipher = this.initLoginCipher();
|
||||||
const url = this.getValueOrDefault(value.url, this.getValueOrDefault(value.hostname));
|
const url = this.getValueOrDefault(value.url, this.getValueOrDefault(value.hostname));
|
||||||
cipher.name = this.getValueOrDefault(this.nameFromUrl(url), '--');
|
cipher.name = this.getValueOrDefault(this.nameFromUrl(url), "--");
|
||||||
cipher.login.username = this.getValueOrDefault(value.username);
|
cipher.login.username = this.getValueOrDefault(value.username);
|
||||||
cipher.login.password = this.getValueOrDefault(value.password);
|
cipher.login.password = this.getValueOrDefault(value.password);
|
||||||
cipher.login.uris = this.makeUriArray(url);
|
cipher.login.uris = this.makeUriArray(url);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { BaseImporter } from './baseImporter';
|
import { BaseImporter } from "./baseImporter";
|
||||||
import { Importer } from './importer';
|
import { Importer } from "./importer";
|
||||||
|
|
||||||
import { ImportResult } from '../models/domain/importResult';
|
import { ImportResult } from "../models/domain/importResult";
|
||||||
|
|
||||||
export class GnomeJsonImporter extends BaseImporter implements Importer {
|
export class GnomeJsonImporter extends BaseImporter implements Importer {
|
||||||
parse(data: string): Promise<ImportResult> {
|
parse(data: string): Promise<ImportResult> {
|
||||||
@@ -13,19 +13,25 @@ export class GnomeJsonImporter extends BaseImporter implements Importer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (const keyRing in results) {
|
for (const keyRing in results) {
|
||||||
if (!results.hasOwnProperty(keyRing) || this.isNullOrWhitespace(keyRing) ||
|
if (
|
||||||
results[keyRing].length === 0) {
|
!results.hasOwnProperty(keyRing) ||
|
||||||
|
this.isNullOrWhitespace(keyRing) ||
|
||||||
|
results[keyRing].length === 0
|
||||||
|
) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
results[keyRing].forEach((value: any) => {
|
results[keyRing].forEach((value: any) => {
|
||||||
if (this.isNullOrWhitespace(value.display_name) || value.display_name.indexOf('http') !== 0) {
|
if (
|
||||||
|
this.isNullOrWhitespace(value.display_name) ||
|
||||||
|
value.display_name.indexOf("http") !== 0
|
||||||
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.processFolder(result, keyRing);
|
this.processFolder(result, keyRing);
|
||||||
const cipher = this.initLoginCipher();
|
const cipher = this.initLoginCipher();
|
||||||
cipher.name = value.display_name.replace('http://', '').replace('https://', '');
|
cipher.name = value.display_name.replace("http://", "").replace("https://", "");
|
||||||
if (cipher.name.length > 30) {
|
if (cipher.name.length > 30) {
|
||||||
cipher.name = cipher.name.substring(0, 30);
|
cipher.name = cipher.name.substring(0, 30);
|
||||||
}
|
}
|
||||||
@@ -33,11 +39,16 @@ export class GnomeJsonImporter extends BaseImporter implements Importer {
|
|||||||
cipher.login.uris = this.makeUriArray(value.display_name);
|
cipher.login.uris = this.makeUriArray(value.display_name);
|
||||||
|
|
||||||
if (value.attributes != null) {
|
if (value.attributes != null) {
|
||||||
cipher.login.username = value.attributes != null ?
|
cipher.login.username =
|
||||||
this.getValueOrDefault(value.attributes.username_value) : null;
|
value.attributes != null
|
||||||
|
? this.getValueOrDefault(value.attributes.username_value)
|
||||||
|
: null;
|
||||||
for (const attr in value.attributes) {
|
for (const attr in value.attributes) {
|
||||||
if (!value.attributes.hasOwnProperty(attr) || attr === 'username_value' ||
|
if (
|
||||||
attr === 'xdg:schema') {
|
!value.attributes.hasOwnProperty(attr) ||
|
||||||
|
attr === "username_value" ||
|
||||||
|
attr === "xdg:schema"
|
||||||
|
) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
this.processKvp(cipher, attr, value.attributes[attr]);
|
this.processKvp(cipher, attr, value.attributes[attr]);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { ImportResult } from '../models/domain/importResult';
|
import { ImportResult } from "../models/domain/importResult";
|
||||||
|
|
||||||
export interface Importer {
|
export interface Importer {
|
||||||
organizationId: string;
|
organizationId: string;
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import { BaseImporter } from './baseImporter';
|
import { BaseImporter } from "./baseImporter";
|
||||||
import { Importer } from './importer';
|
import { Importer } from "./importer";
|
||||||
|
|
||||||
import { ImportResult } from '../models/domain/importResult';
|
import { ImportResult } from "../models/domain/importResult";
|
||||||
|
|
||||||
const NotesHeader = 'Notes\n\n';
|
const NotesHeader = "Notes\n\n";
|
||||||
const ApplicationsHeader = 'Applications\n\n';
|
const ApplicationsHeader = "Applications\n\n";
|
||||||
const WebsitesHeader = 'Websites\n\n';
|
const WebsitesHeader = "Websites\n\n";
|
||||||
const Delimiter = '\n---\n';
|
const Delimiter = "\n---\n";
|
||||||
|
|
||||||
export class KasperskyTxtImporter extends BaseImporter implements Importer {
|
export class KasperskyTxtImporter extends BaseImporter implements Importer {
|
||||||
parse(data: string): Promise<ImportResult> {
|
parse(data: string): Promise<ImportResult> {
|
||||||
@@ -15,7 +15,7 @@ export class KasperskyTxtImporter extends BaseImporter implements Importer {
|
|||||||
let notesData: string;
|
let notesData: string;
|
||||||
let applicationsData: string;
|
let applicationsData: string;
|
||||||
let websitesData: string;
|
let websitesData: string;
|
||||||
let workingData = this.splitNewLine(data).join('\n');
|
let workingData = this.splitNewLine(data).join("\n");
|
||||||
|
|
||||||
if (workingData.indexOf(NotesHeader) !== -1) {
|
if (workingData.indexOf(NotesHeader) !== -1) {
|
||||||
const parts = workingData.split(NotesHeader);
|
const parts = workingData.split(NotesHeader);
|
||||||
@@ -43,30 +43,30 @@ export class KasperskyTxtImporter extends BaseImporter implements Importer {
|
|||||||
const applications = this.parseDataCategory(applicationsData);
|
const applications = this.parseDataCategory(applicationsData);
|
||||||
const websites = this.parseDataCategory(websitesData);
|
const websites = this.parseDataCategory(websitesData);
|
||||||
|
|
||||||
notes.forEach(n => {
|
notes.forEach((n) => {
|
||||||
const cipher = this.initLoginCipher();
|
const cipher = this.initLoginCipher();
|
||||||
cipher.name = this.getValueOrDefault(n.get('Name'));
|
cipher.name = this.getValueOrDefault(n.get("Name"));
|
||||||
cipher.notes = this.getValueOrDefault(n.get('Text'));
|
cipher.notes = this.getValueOrDefault(n.get("Text"));
|
||||||
this.cleanupCipher(cipher);
|
this.cleanupCipher(cipher);
|
||||||
result.ciphers.push(cipher);
|
result.ciphers.push(cipher);
|
||||||
});
|
});
|
||||||
|
|
||||||
websites.concat(applications).forEach(w => {
|
websites.concat(applications).forEach((w) => {
|
||||||
const cipher = this.initLoginCipher();
|
const cipher = this.initLoginCipher();
|
||||||
const nameKey = w.has('Website name') ? 'Website name' : 'Application';
|
const nameKey = w.has("Website name") ? "Website name" : "Application";
|
||||||
cipher.name = this.getValueOrDefault(w.get(nameKey), '');
|
cipher.name = this.getValueOrDefault(w.get(nameKey), "");
|
||||||
if (!this.isNullOrWhitespace(w.get('Login name'))) {
|
if (!this.isNullOrWhitespace(w.get("Login name"))) {
|
||||||
if (!this.isNullOrWhitespace(cipher.name)) {
|
if (!this.isNullOrWhitespace(cipher.name)) {
|
||||||
cipher.name += ': ';
|
cipher.name += ": ";
|
||||||
}
|
}
|
||||||
cipher.name += w.get('Login name');
|
cipher.name += w.get("Login name");
|
||||||
}
|
}
|
||||||
cipher.notes = this.getValueOrDefault(w.get('Comment'));
|
cipher.notes = this.getValueOrDefault(w.get("Comment"));
|
||||||
if (w.has('Website URL')) {
|
if (w.has("Website URL")) {
|
||||||
cipher.login.uris = this.makeUriArray(w.get('Website URL'));
|
cipher.login.uris = this.makeUriArray(w.get("Website URL"));
|
||||||
}
|
}
|
||||||
cipher.login.username = this.getValueOrDefault(w.get('Login'));
|
cipher.login.username = this.getValueOrDefault(w.get("Login"));
|
||||||
cipher.login.password = this.getValueOrDefault(w.get('Password'));
|
cipher.login.password = this.getValueOrDefault(w.get("Password"));
|
||||||
this.cleanupCipher(cipher);
|
this.cleanupCipher(cipher);
|
||||||
result.ciphers.push(cipher);
|
result.ciphers.push(cipher);
|
||||||
});
|
});
|
||||||
@@ -80,19 +80,19 @@ export class KasperskyTxtImporter extends BaseImporter implements Importer {
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
const items: Map<string, string>[] = [];
|
const items: Map<string, string>[] = [];
|
||||||
data.split(Delimiter).forEach(p => {
|
data.split(Delimiter).forEach((p) => {
|
||||||
if (p.indexOf('\n') === -1) {
|
if (p.indexOf("\n") === -1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const item = new Map<string, string>();
|
const item = new Map<string, string>();
|
||||||
let itemComment: string;
|
let itemComment: string;
|
||||||
let itemCommentKey: string;
|
let itemCommentKey: string;
|
||||||
p.split('\n').forEach(l => {
|
p.split("\n").forEach((l) => {
|
||||||
if (itemComment != null) {
|
if (itemComment != null) {
|
||||||
itemComment += ('\n' + l);
|
itemComment += "\n" + l;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const colonIndex = l.indexOf(':');
|
const colonIndex = l.indexOf(":");
|
||||||
let key: string;
|
let key: string;
|
||||||
let val: string;
|
let val: string;
|
||||||
if (colonIndex === -1) {
|
if (colonIndex === -1) {
|
||||||
@@ -106,7 +106,7 @@ export class KasperskyTxtImporter extends BaseImporter implements Importer {
|
|||||||
if (key != null) {
|
if (key != null) {
|
||||||
item.set(key, val);
|
item.set(key, val);
|
||||||
}
|
}
|
||||||
if (key === 'Comment' || key === 'Text') {
|
if (key === "Comment" || key === "Text") {
|
||||||
itemComment = val;
|
itemComment = val;
|
||||||
itemCommentKey = key;
|
itemCommentKey = key;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import { BaseImporter } from './baseImporter';
|
import { BaseImporter } from "./baseImporter";
|
||||||
import { Importer } from './importer';
|
import { Importer } from "./importer";
|
||||||
|
|
||||||
import { FieldType } from '../enums/fieldType';
|
import { FieldType } from "../enums/fieldType";
|
||||||
|
|
||||||
import { ImportResult } from '../models/domain/importResult';
|
import { ImportResult } from "../models/domain/importResult";
|
||||||
|
|
||||||
import { FolderView } from '../models/view/folderView';
|
import { FolderView } from "../models/view/folderView";
|
||||||
|
|
||||||
export class KeePass2XmlImporter extends BaseImporter implements Importer {
|
export class KeePass2XmlImporter extends BaseImporter implements Importer {
|
||||||
result = new ImportResult();
|
result = new ImportResult();
|
||||||
@@ -17,14 +17,14 @@ export class KeePass2XmlImporter extends BaseImporter implements Importer {
|
|||||||
return Promise.resolve(this.result);
|
return Promise.resolve(this.result);
|
||||||
}
|
}
|
||||||
|
|
||||||
const rootGroup = doc.querySelector('KeePassFile > Root > Group');
|
const rootGroup = doc.querySelector("KeePassFile > Root > Group");
|
||||||
if (rootGroup == null) {
|
if (rootGroup == null) {
|
||||||
this.result.errorMessage = 'Missing `KeePassFile > Root > Group` node.';
|
this.result.errorMessage = "Missing `KeePassFile > Root > Group` node.";
|
||||||
this.result.success = false;
|
this.result.success = false;
|
||||||
return Promise.resolve(this.result);
|
return Promise.resolve(this.result);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.traverse(rootGroup, true, '');
|
this.traverse(rootGroup, true, "");
|
||||||
|
|
||||||
if (this.organization) {
|
if (this.organization) {
|
||||||
this.moveFoldersToCollections(this.result);
|
this.moveFoldersToCollections(this.result);
|
||||||
@@ -39,46 +39,49 @@ export class KeePass2XmlImporter extends BaseImporter implements Importer {
|
|||||||
let groupName = groupPrefixName;
|
let groupName = groupPrefixName;
|
||||||
|
|
||||||
if (!isRootNode) {
|
if (!isRootNode) {
|
||||||
if (groupName !== '') {
|
if (groupName !== "") {
|
||||||
groupName += '/';
|
groupName += "/";
|
||||||
}
|
}
|
||||||
const nameEl = this.querySelectorDirectChild(node, 'Name');
|
const nameEl = this.querySelectorDirectChild(node, "Name");
|
||||||
groupName += nameEl == null ? '-' : nameEl.textContent;
|
groupName += nameEl == null ? "-" : nameEl.textContent;
|
||||||
const folder = new FolderView();
|
const folder = new FolderView();
|
||||||
folder.name = groupName;
|
folder.name = groupName;
|
||||||
this.result.folders.push(folder);
|
this.result.folders.push(folder);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.querySelectorAllDirectChild(node, 'Entry').forEach(entry => {
|
this.querySelectorAllDirectChild(node, "Entry").forEach((entry) => {
|
||||||
const cipherIndex = this.result.ciphers.length;
|
const cipherIndex = this.result.ciphers.length;
|
||||||
|
|
||||||
const cipher = this.initLoginCipher();
|
const cipher = this.initLoginCipher();
|
||||||
this.querySelectorAllDirectChild(entry, 'String').forEach(entryString => {
|
this.querySelectorAllDirectChild(entry, "String").forEach((entryString) => {
|
||||||
const valueEl = this.querySelectorDirectChild(entryString, 'Value');
|
const valueEl = this.querySelectorDirectChild(entryString, "Value");
|
||||||
const value = valueEl != null ? valueEl.textContent : null;
|
const value = valueEl != null ? valueEl.textContent : null;
|
||||||
if (this.isNullOrWhitespace(value)) {
|
if (this.isNullOrWhitespace(value)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const keyEl = this.querySelectorDirectChild(entryString, 'Key');
|
const keyEl = this.querySelectorDirectChild(entryString, "Key");
|
||||||
const key = keyEl != null ? keyEl.textContent : null;
|
const key = keyEl != null ? keyEl.textContent : null;
|
||||||
|
|
||||||
if (key === 'URL') {
|
if (key === "URL") {
|
||||||
cipher.login.uris = this.makeUriArray(value);
|
cipher.login.uris = this.makeUriArray(value);
|
||||||
} else if (key === 'UserName') {
|
} else if (key === "UserName") {
|
||||||
cipher.login.username = value;
|
cipher.login.username = value;
|
||||||
} else if (key === 'Password') {
|
} else if (key === "Password") {
|
||||||
cipher.login.password = value;
|
cipher.login.password = value;
|
||||||
} else if (key === 'otp') {
|
} else if (key === "otp") {
|
||||||
cipher.login.totp = value.replace('key=', '');
|
cipher.login.totp = value.replace("key=", "");
|
||||||
} else if (key === 'Title') {
|
} else if (key === "Title") {
|
||||||
cipher.name = value;
|
cipher.name = value;
|
||||||
} else if (key === 'Notes') {
|
} else if (key === "Notes") {
|
||||||
cipher.notes += (value + '\n');
|
cipher.notes += value + "\n";
|
||||||
} else {
|
} else {
|
||||||
let type = FieldType.Text;
|
let type = FieldType.Text;
|
||||||
const attrs = (valueEl.attributes as any);
|
const attrs = valueEl.attributes as any;
|
||||||
if (attrs.length > 0 && attrs.ProtectInMemory != null &&
|
if (
|
||||||
attrs.ProtectInMemory.value === 'True') {
|
attrs.length > 0 &&
|
||||||
|
attrs.ProtectInMemory != null &&
|
||||||
|
attrs.ProtectInMemory.value === "True"
|
||||||
|
) {
|
||||||
type = FieldType.Hidden;
|
type = FieldType.Hidden;
|
||||||
}
|
}
|
||||||
this.processKvp(cipher, key, value, type);
|
this.processKvp(cipher, key, value, type);
|
||||||
@@ -93,7 +96,7 @@ export class KeePass2XmlImporter extends BaseImporter implements Importer {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.querySelectorAllDirectChild(node, 'Group').forEach(group => {
|
this.querySelectorAllDirectChild(node, "Group").forEach((group) => {
|
||||||
this.traverse(group, false, groupName);
|
this.traverse(group, false, groupName);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { BaseImporter } from './baseImporter';
|
import { BaseImporter } from "./baseImporter";
|
||||||
import { Importer } from './importer';
|
import { Importer } from "./importer";
|
||||||
|
|
||||||
import { ImportResult } from '../models/domain/importResult';
|
import { ImportResult } from "../models/domain/importResult";
|
||||||
|
|
||||||
export class KeePassXCsvImporter extends BaseImporter implements Importer {
|
export class KeePassXCsvImporter extends BaseImporter implements Importer {
|
||||||
parse(data: string): Promise<ImportResult> {
|
parse(data: string): Promise<ImportResult> {
|
||||||
@@ -12,19 +12,21 @@ export class KeePassXCsvImporter extends BaseImporter implements Importer {
|
|||||||
return Promise.resolve(result);
|
return Promise.resolve(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
results.forEach(value => {
|
results.forEach((value) => {
|
||||||
if (this.isNullOrWhitespace(value.Title)) {
|
if (this.isNullOrWhitespace(value.Title)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
value.Group = !this.isNullOrWhitespace(value.Group) && value.Group.startsWith('Root/') ?
|
value.Group =
|
||||||
value.Group.replace('Root/', '') : value.Group;
|
!this.isNullOrWhitespace(value.Group) && value.Group.startsWith("Root/")
|
||||||
|
? value.Group.replace("Root/", "")
|
||||||
|
: value.Group;
|
||||||
const groupName = !this.isNullOrWhitespace(value.Group) ? value.Group : null;
|
const groupName = !this.isNullOrWhitespace(value.Group) ? value.Group : null;
|
||||||
this.processFolder(result, groupName);
|
this.processFolder(result, groupName);
|
||||||
|
|
||||||
const cipher = this.initLoginCipher();
|
const cipher = this.initLoginCipher();
|
||||||
cipher.notes = this.getValueOrDefault(value.Notes);
|
cipher.notes = this.getValueOrDefault(value.Notes);
|
||||||
cipher.name = this.getValueOrDefault(value.Title, '--');
|
cipher.name = this.getValueOrDefault(value.Title, "--");
|
||||||
cipher.login.username = this.getValueOrDefault(value.Username);
|
cipher.login.username = this.getValueOrDefault(value.Username);
|
||||||
cipher.login.password = this.getValueOrDefault(value.Password);
|
cipher.login.password = this.getValueOrDefault(value.Password);
|
||||||
cipher.login.uris = this.makeUriArray(value.URL);
|
cipher.login.uris = this.makeUriArray(value.URL);
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { BaseImporter } from './baseImporter';
|
import { BaseImporter } from "./baseImporter";
|
||||||
import { Importer } from './importer';
|
import { Importer } from "./importer";
|
||||||
|
|
||||||
import { ImportResult } from '../models/domain/importResult';
|
import { ImportResult } from "../models/domain/importResult";
|
||||||
|
|
||||||
import { FolderView } from '../models/view/folderView';
|
import { FolderView } from "../models/view/folderView";
|
||||||
|
|
||||||
export class KeeperCsvImporter extends BaseImporter implements Importer {
|
export class KeeperCsvImporter extends BaseImporter implements Importer {
|
||||||
parse(data: string): Promise<ImportResult> {
|
parse(data: string): Promise<ImportResult> {
|
||||||
@@ -14,15 +14,15 @@ export class KeeperCsvImporter extends BaseImporter implements Importer {
|
|||||||
return Promise.resolve(result);
|
return Promise.resolve(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
results.forEach(value => {
|
results.forEach((value) => {
|
||||||
if (value.length < 6) {
|
if (value.length < 6) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.processFolder(result, value[0]);
|
this.processFolder(result, value[0]);
|
||||||
const cipher = this.initLoginCipher();
|
const cipher = this.initLoginCipher();
|
||||||
cipher.notes = this.getValueOrDefault(value[5]) + '\n';
|
cipher.notes = this.getValueOrDefault(value[5]) + "\n";
|
||||||
cipher.name = this.getValueOrDefault(value[1], '--');
|
cipher.name = this.getValueOrDefault(value[1], "--");
|
||||||
cipher.login.username = this.getValueOrDefault(value[2]);
|
cipher.login.username = this.getValueOrDefault(value[2]);
|
||||||
cipher.login.password = this.getValueOrDefault(value[3]);
|
cipher.login.password = this.getValueOrDefault(value[3]);
|
||||||
cipher.login.uris = this.makeUriArray(value[4]);
|
cipher.login.uris = this.makeUriArray(value[4]);
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
import { BaseImporter } from './baseImporter';
|
import { BaseImporter } from "./baseImporter";
|
||||||
import { Importer } from './importer';
|
import { Importer } from "./importer";
|
||||||
|
|
||||||
import { ImportResult } from '../models/domain/importResult';
|
import { ImportResult } from "../models/domain/importResult";
|
||||||
|
|
||||||
import { CardView } from '../models/view/cardView';
|
import { CardView } from "../models/view/cardView";
|
||||||
import { CipherView } from '../models/view/cipherView';
|
import { CipherView } from "../models/view/cipherView";
|
||||||
import { FolderView } from '../models/view/folderView';
|
import { FolderView } from "../models/view/folderView";
|
||||||
import { IdentityView } from '../models/view/identityView';
|
import { IdentityView } from "../models/view/identityView";
|
||||||
import { LoginView } from '../models/view/loginView';
|
import { LoginView } from "../models/view/loginView";
|
||||||
import { SecureNoteView } from '../models/view/secureNoteView';
|
import { SecureNoteView } from "../models/view/secureNoteView";
|
||||||
|
|
||||||
import { CipherType } from '../enums/cipherType';
|
import { CipherType } from "../enums/cipherType";
|
||||||
import { SecureNoteType } from '../enums/secureNoteType';
|
import { SecureNoteType } from "../enums/secureNoteType";
|
||||||
|
|
||||||
export class LastPassCsvImporter extends BaseImporter implements Importer {
|
export class LastPassCsvImporter extends BaseImporter implements Importer {
|
||||||
parse(data: string): Promise<ImportResult> {
|
parse(data: string): Promise<ImportResult> {
|
||||||
@@ -27,9 +27,9 @@ export class LastPassCsvImporter extends BaseImporter implements Importer {
|
|||||||
let folderIndex = result.folders.length;
|
let folderIndex = result.folders.length;
|
||||||
let grouping = value.grouping;
|
let grouping = value.grouping;
|
||||||
if (grouping != null) {
|
if (grouping != null) {
|
||||||
grouping = grouping.replace(/\\/g, '/').replace(/[\x00-\x1F\x7F-\x9F]/g, '');
|
grouping = grouping.replace(/\\/g, "/").replace(/[\x00-\x1F\x7F-\x9F]/g, "");
|
||||||
}
|
}
|
||||||
const hasFolder = this.getValueOrDefault(grouping, '(none)') !== '(none)';
|
const hasFolder = this.getValueOrDefault(grouping, "(none)") !== "(none)";
|
||||||
let addFolder = hasFolder;
|
let addFolder = hasFolder;
|
||||||
|
|
||||||
if (hasFolder) {
|
if (hasFolder) {
|
||||||
@@ -90,23 +90,28 @@ export class LastPassCsvImporter extends BaseImporter implements Importer {
|
|||||||
|
|
||||||
private buildBaseCipher(value: any) {
|
private buildBaseCipher(value: any) {
|
||||||
const cipher = new CipherView();
|
const cipher = new CipherView();
|
||||||
if (value.hasOwnProperty('profilename') && value.hasOwnProperty('profilelanguage')) {
|
if (value.hasOwnProperty("profilename") && value.hasOwnProperty("profilelanguage")) {
|
||||||
// form fill
|
// form fill
|
||||||
cipher.favorite = false;
|
cipher.favorite = false;
|
||||||
cipher.name = this.getValueOrDefault(value.profilename, '--');
|
cipher.name = this.getValueOrDefault(value.profilename, "--");
|
||||||
cipher.type = CipherType.Card;
|
cipher.type = CipherType.Card;
|
||||||
|
|
||||||
if (!this.isNullOrWhitespace(value.title) || !this.isNullOrWhitespace(value.firstname) ||
|
if (
|
||||||
!this.isNullOrWhitespace(value.lastname) || !this.isNullOrWhitespace(value.address1) ||
|
!this.isNullOrWhitespace(value.title) ||
|
||||||
!this.isNullOrWhitespace(value.phone) || !this.isNullOrWhitespace(value.username) ||
|
!this.isNullOrWhitespace(value.firstname) ||
|
||||||
!this.isNullOrWhitespace(value.email)) {
|
!this.isNullOrWhitespace(value.lastname) ||
|
||||||
|
!this.isNullOrWhitespace(value.address1) ||
|
||||||
|
!this.isNullOrWhitespace(value.phone) ||
|
||||||
|
!this.isNullOrWhitespace(value.username) ||
|
||||||
|
!this.isNullOrWhitespace(value.email)
|
||||||
|
) {
|
||||||
cipher.type = CipherType.Identity;
|
cipher.type = CipherType.Identity;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// site or secure note
|
// site or secure note
|
||||||
cipher.favorite = !this.organization && this.getValueOrDefault(value.fav, '0') === '1';
|
cipher.favorite = !this.organization && this.getValueOrDefault(value.fav, "0") === "1";
|
||||||
cipher.name = this.getValueOrDefault(value.name, '--');
|
cipher.name = this.getValueOrDefault(value.name, "--");
|
||||||
cipher.type = value.url === 'http://sn' ? CipherType.SecureNote : CipherType.Login;
|
cipher.type = value.url === "http://sn" ? CipherType.SecureNote : CipherType.Login;
|
||||||
}
|
}
|
||||||
return cipher;
|
return cipher;
|
||||||
}
|
}
|
||||||
@@ -118,12 +123,12 @@ export class LastPassCsvImporter extends BaseImporter implements Importer {
|
|||||||
card.code = this.getValueOrDefault(value.cccsc);
|
card.code = this.getValueOrDefault(value.cccsc);
|
||||||
card.brand = this.getCardBrand(value.ccnum);
|
card.brand = this.getCardBrand(value.ccnum);
|
||||||
|
|
||||||
if (!this.isNullOrWhitespace(value.ccexp) && value.ccexp.indexOf('-') > -1) {
|
if (!this.isNullOrWhitespace(value.ccexp) && value.ccexp.indexOf("-") > -1) {
|
||||||
const ccexpParts = (value.ccexp as string).split('-');
|
const ccexpParts = (value.ccexp as string).split("-");
|
||||||
if (ccexpParts.length > 1) {
|
if (ccexpParts.length > 1) {
|
||||||
card.expYear = ccexpParts[0];
|
card.expYear = ccexpParts[0];
|
||||||
card.expMonth = ccexpParts[1];
|
card.expMonth = ccexpParts[1];
|
||||||
if (card.expMonth.length === 2 && card.expMonth[0] === '0') {
|
if (card.expMonth.length === 2 && card.expMonth[0] === "0") {
|
||||||
card.expMonth = card.expMonth[1];
|
card.expMonth = card.expMonth[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -163,27 +168,30 @@ export class LastPassCsvImporter extends BaseImporter implements Importer {
|
|||||||
let processedNote = false;
|
let processedNote = false;
|
||||||
|
|
||||||
if (extraParts.length) {
|
if (extraParts.length) {
|
||||||
const typeParts = extraParts[0].split(':');
|
const typeParts = extraParts[0].split(":");
|
||||||
if (typeParts.length > 1 && typeParts[0] === 'NoteType' &&
|
if (
|
||||||
(typeParts[1] === 'Credit Card' || typeParts[1] === 'Address')) {
|
typeParts.length > 1 &&
|
||||||
if (typeParts[1] === 'Credit Card') {
|
typeParts[0] === "NoteType" &&
|
||||||
|
(typeParts[1] === "Credit Card" || typeParts[1] === "Address")
|
||||||
|
) {
|
||||||
|
if (typeParts[1] === "Credit Card") {
|
||||||
const mappedData = this.parseSecureNoteMapping<CardView>(cipher, extraParts, {
|
const mappedData = this.parseSecureNoteMapping<CardView>(cipher, extraParts, {
|
||||||
'Number': 'number',
|
Number: "number",
|
||||||
'Name on Card': 'cardholderName',
|
"Name on Card": "cardholderName",
|
||||||
'Security Code': 'code',
|
"Security Code": "code",
|
||||||
// LP provides date in a format like 'June,2020'
|
// LP provides date in a format like 'June,2020'
|
||||||
// Store in expMonth, then parse and modify
|
// Store in expMonth, then parse and modify
|
||||||
'Expiration Date': 'expMonth',
|
"Expiration Date": "expMonth",
|
||||||
});
|
});
|
||||||
|
|
||||||
if (this.isNullOrWhitespace(mappedData.expMonth) || mappedData.expMonth === ',') {
|
if (this.isNullOrWhitespace(mappedData.expMonth) || mappedData.expMonth === ",") {
|
||||||
// No expiration data
|
// No expiration data
|
||||||
mappedData.expMonth = undefined;
|
mappedData.expMonth = undefined;
|
||||||
} else {
|
} else {
|
||||||
const [monthString, year] = mappedData.expMonth.split(',');
|
const [monthString, year] = mappedData.expMonth.split(",");
|
||||||
// Parse month name into number
|
// Parse month name into number
|
||||||
if (!this.isNullOrWhitespace(monthString)) {
|
if (!this.isNullOrWhitespace(monthString)) {
|
||||||
const month = new Date(Date.parse(monthString.trim() + ' 1, 2012')).getMonth() + 1;
|
const month = new Date(Date.parse(monthString.trim() + " 1, 2012")).getMonth() + 1;
|
||||||
if (isNaN(month)) {
|
if (isNaN(month)) {
|
||||||
mappedData.expMonth = undefined;
|
mappedData.expMonth = undefined;
|
||||||
} else {
|
} else {
|
||||||
@@ -199,22 +207,22 @@ export class LastPassCsvImporter extends BaseImporter implements Importer {
|
|||||||
|
|
||||||
cipher.type = CipherType.Card;
|
cipher.type = CipherType.Card;
|
||||||
cipher.card = mappedData;
|
cipher.card = mappedData;
|
||||||
} else if (typeParts[1] === 'Address') {
|
} else if (typeParts[1] === "Address") {
|
||||||
const mappedData = this.parseSecureNoteMapping<IdentityView>(cipher, extraParts, {
|
const mappedData = this.parseSecureNoteMapping<IdentityView>(cipher, extraParts, {
|
||||||
'Title': 'title',
|
Title: "title",
|
||||||
'First Name': 'firstName',
|
"First Name": "firstName",
|
||||||
'Last Name': 'lastName',
|
"Last Name": "lastName",
|
||||||
'Middle Name': 'middleName',
|
"Middle Name": "middleName",
|
||||||
'Company': 'company',
|
Company: "company",
|
||||||
'Address 1': 'address1',
|
"Address 1": "address1",
|
||||||
'Address 2': 'address2',
|
"Address 2": "address2",
|
||||||
'Address 3': 'address3',
|
"Address 3": "address3",
|
||||||
'City / Town': 'city',
|
"City / Town": "city",
|
||||||
'State': 'state',
|
State: "state",
|
||||||
'Zip / Postal Code': 'postalCode',
|
"Zip / Postal Code": "postalCode",
|
||||||
'Country': 'country',
|
Country: "country",
|
||||||
'Email Address': 'email',
|
"Email Address": "email",
|
||||||
'Username': 'username',
|
Username: "username",
|
||||||
});
|
});
|
||||||
cipher.type = CipherType.Identity;
|
cipher.type = CipherType.Identity;
|
||||||
cipher.identity = mappedData;
|
cipher.identity = mappedData;
|
||||||
@@ -234,14 +242,14 @@ export class LastPassCsvImporter extends BaseImporter implements Importer {
|
|||||||
const dataObj: any = {};
|
const dataObj: any = {};
|
||||||
|
|
||||||
let processingNotes = false;
|
let processingNotes = false;
|
||||||
extraParts.forEach(extraPart => {
|
extraParts.forEach((extraPart) => {
|
||||||
let key: string = null;
|
let key: string = null;
|
||||||
let val: string = null;
|
let val: string = null;
|
||||||
if (!processingNotes) {
|
if (!processingNotes) {
|
||||||
if (this.isNullOrWhitespace(extraPart)) {
|
if (this.isNullOrWhitespace(extraPart)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const colonIndex = extraPart.indexOf(':');
|
const colonIndex = extraPart.indexOf(":");
|
||||||
if (colonIndex === -1) {
|
if (colonIndex === -1) {
|
||||||
key = extraPart;
|
key = extraPart;
|
||||||
} else {
|
} else {
|
||||||
@@ -250,16 +258,16 @@ export class LastPassCsvImporter extends BaseImporter implements Importer {
|
|||||||
val = extraPart.substring(colonIndex + 1);
|
val = extraPart.substring(colonIndex + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.isNullOrWhitespace(key) || this.isNullOrWhitespace(val) || key === 'NoteType') {
|
if (this.isNullOrWhitespace(key) || this.isNullOrWhitespace(val) || key === "NoteType") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (processingNotes) {
|
if (processingNotes) {
|
||||||
cipher.notes += ('\n' + extraPart);
|
cipher.notes += "\n" + extraPart;
|
||||||
} else if (key === 'Notes') {
|
} else if (key === "Notes") {
|
||||||
if (!this.isNullOrWhitespace(cipher.notes)) {
|
if (!this.isNullOrWhitespace(cipher.notes)) {
|
||||||
cipher.notes += ('\n' + val);
|
cipher.notes += "\n" + val;
|
||||||
} else {
|
} else {
|
||||||
cipher.notes = val;
|
cipher.notes = val;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { BaseImporter } from './baseImporter';
|
import { BaseImporter } from "./baseImporter";
|
||||||
import { Importer } from './importer';
|
import { Importer } from "./importer";
|
||||||
|
|
||||||
import { ImportResult } from '../models/domain/importResult';
|
import { ImportResult } from "../models/domain/importResult";
|
||||||
|
|
||||||
export class LogMeOnceCsvImporter extends BaseImporter implements Importer {
|
export class LogMeOnceCsvImporter extends BaseImporter implements Importer {
|
||||||
parse(data: string): Promise<ImportResult> {
|
parse(data: string): Promise<ImportResult> {
|
||||||
@@ -12,12 +12,12 @@ export class LogMeOnceCsvImporter extends BaseImporter implements Importer {
|
|||||||
return Promise.resolve(result);
|
return Promise.resolve(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
results.forEach(value => {
|
results.forEach((value) => {
|
||||||
if (value.length < 4) {
|
if (value.length < 4) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const cipher = this.initLoginCipher();
|
const cipher = this.initLoginCipher();
|
||||||
cipher.name = this.getValueOrDefault(value[0], '--');
|
cipher.name = this.getValueOrDefault(value[0], "--");
|
||||||
cipher.login.username = this.getValueOrDefault(value[2]);
|
cipher.login.username = this.getValueOrDefault(value[2]);
|
||||||
cipher.login.password = this.getValueOrDefault(value[3]);
|
cipher.login.password = this.getValueOrDefault(value[3]);
|
||||||
cipher.login.uris = this.makeUriArray(value[1]);
|
cipher.login.uris = this.makeUriArray(value[1]);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { BaseImporter } from './baseImporter';
|
import { BaseImporter } from "./baseImporter";
|
||||||
import { Importer } from './importer';
|
import { Importer } from "./importer";
|
||||||
|
|
||||||
import { ImportResult } from '../models/domain/importResult';
|
import { ImportResult } from "../models/domain/importResult";
|
||||||
|
|
||||||
export class MeldiumCsvImporter extends BaseImporter implements Importer {
|
export class MeldiumCsvImporter extends BaseImporter implements Importer {
|
||||||
parse(data: string): Promise<ImportResult> {
|
parse(data: string): Promise<ImportResult> {
|
||||||
@@ -12,9 +12,9 @@ export class MeldiumCsvImporter extends BaseImporter implements Importer {
|
|||||||
return Promise.resolve(result);
|
return Promise.resolve(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
results.forEach(value => {
|
results.forEach((value) => {
|
||||||
const cipher = this.initLoginCipher();
|
const cipher = this.initLoginCipher();
|
||||||
cipher.name = this.getValueOrDefault(value.DisplayName, '--');
|
cipher.name = this.getValueOrDefault(value.DisplayName, "--");
|
||||||
cipher.notes = this.getValueOrDefault(value.Notes);
|
cipher.notes = this.getValueOrDefault(value.Notes);
|
||||||
cipher.login.username = this.getValueOrDefault(value.UserName);
|
cipher.login.username = this.getValueOrDefault(value.UserName);
|
||||||
cipher.login.password = this.getValueOrDefault(value.Password);
|
cipher.login.password = this.getValueOrDefault(value.Password);
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import { BaseImporter } from './baseImporter';
|
import { BaseImporter } from "./baseImporter";
|
||||||
import { Importer } from './importer';
|
import { Importer } from "./importer";
|
||||||
|
|
||||||
import { ImportResult } from '../models/domain/importResult';
|
import { ImportResult } from "../models/domain/importResult";
|
||||||
|
|
||||||
import { CipherType } from '../enums/cipherType';
|
import { CipherType } from "../enums/cipherType";
|
||||||
import { SecureNoteType } from '../enums/secureNoteType';
|
import { SecureNoteType } from "../enums/secureNoteType";
|
||||||
|
|
||||||
import { SecureNoteView } from '../models/view/secureNoteView';
|
import { SecureNoteView } from "../models/view/secureNoteView";
|
||||||
|
|
||||||
export class MSecureCsvImporter extends BaseImporter implements Importer {
|
export class MSecureCsvImporter extends BaseImporter implements Importer {
|
||||||
parse(data: string): Promise<ImportResult> {
|
parse(data: string): Promise<ImportResult> {
|
||||||
@@ -17,35 +17,36 @@ export class MSecureCsvImporter extends BaseImporter implements Importer {
|
|||||||
return Promise.resolve(result);
|
return Promise.resolve(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
results.forEach(value => {
|
results.forEach((value) => {
|
||||||
if (value.length < 3) {
|
if (value.length < 3) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const folderName = this.getValueOrDefault(value[0], 'Unassigned') !== 'Unassigned' ? value[0] : null;
|
const folderName =
|
||||||
|
this.getValueOrDefault(value[0], "Unassigned") !== "Unassigned" ? value[0] : null;
|
||||||
this.processFolder(result, folderName);
|
this.processFolder(result, folderName);
|
||||||
|
|
||||||
const cipher = this.initLoginCipher();
|
const cipher = this.initLoginCipher();
|
||||||
cipher.name = this.getValueOrDefault(value[2], '--');
|
cipher.name = this.getValueOrDefault(value[2], "--");
|
||||||
|
|
||||||
if (value[1] === 'Web Logins' || value[1] === 'Login') {
|
if (value[1] === "Web Logins" || value[1] === "Login") {
|
||||||
cipher.login.uris = this.makeUriArray(value[4]);
|
cipher.login.uris = this.makeUriArray(value[4]);
|
||||||
cipher.login.username = this.getValueOrDefault(value[5]);
|
cipher.login.username = this.getValueOrDefault(value[5]);
|
||||||
cipher.login.password = this.getValueOrDefault(value[6]);
|
cipher.login.password = this.getValueOrDefault(value[6]);
|
||||||
cipher.notes = !this.isNullOrWhitespace(value[3]) ? value[3].split('\\n').join('\n') : null;
|
cipher.notes = !this.isNullOrWhitespace(value[3]) ? value[3].split("\\n").join("\n") : null;
|
||||||
} else if (value.length > 3) {
|
} else if (value.length > 3) {
|
||||||
cipher.type = CipherType.SecureNote;
|
cipher.type = CipherType.SecureNote;
|
||||||
cipher.secureNote = new SecureNoteView();
|
cipher.secureNote = new SecureNoteView();
|
||||||
cipher.secureNote.type = SecureNoteType.Generic;
|
cipher.secureNote.type = SecureNoteType.Generic;
|
||||||
for (let i = 3; i < value.length; i++) {
|
for (let i = 3; i < value.length; i++) {
|
||||||
if (!this.isNullOrWhitespace(value[i])) {
|
if (!this.isNullOrWhitespace(value[i])) {
|
||||||
cipher.notes += (value[i] + '\n');
|
cipher.notes += value[i] + "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.isNullOrWhitespace(value[1]) && cipher.type !== CipherType.Login) {
|
if (!this.isNullOrWhitespace(value[1]) && cipher.type !== CipherType.Login) {
|
||||||
cipher.name = value[1] + ': ' + cipher.name;
|
cipher.name = value[1] + ": " + cipher.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.cleanupCipher(cipher);
|
this.cleanupCipher(cipher);
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
import { BaseImporter } from './baseImporter';
|
import { BaseImporter } from "./baseImporter";
|
||||||
import { Importer } from './importer';
|
import { Importer } from "./importer";
|
||||||
|
|
||||||
import { CipherType } from '../enums/cipherType';
|
import { CipherType } from "../enums/cipherType";
|
||||||
import { SecureNoteType } from '../enums/secureNoteType';
|
import { SecureNoteType } from "../enums/secureNoteType";
|
||||||
|
|
||||||
import { CardView } from '../models/view/cardView';
|
import { CardView } from "../models/view/cardView";
|
||||||
import { IdentityView } from '../models/view/identityView';
|
import { IdentityView } from "../models/view/identityView";
|
||||||
import { SecureNoteView } from '../models/view/secureNoteView';
|
import { SecureNoteView } from "../models/view/secureNoteView";
|
||||||
|
|
||||||
import { ImportResult } from '../models/domain/importResult';
|
import { ImportResult } from "../models/domain/importResult";
|
||||||
|
|
||||||
export class MykiCsvImporter extends BaseImporter implements Importer {
|
export class MykiCsvImporter extends BaseImporter implements Importer {
|
||||||
parse(data: string): Promise<ImportResult> {
|
parse(data: string): Promise<ImportResult> {
|
||||||
@@ -19,9 +19,9 @@ export class MykiCsvImporter extends BaseImporter implements Importer {
|
|||||||
return Promise.resolve(result);
|
return Promise.resolve(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
results.forEach(value => {
|
results.forEach((value) => {
|
||||||
const cipher = this.initLoginCipher();
|
const cipher = this.initLoginCipher();
|
||||||
cipher.name = this.getValueOrDefault(value.nickname, '--');
|
cipher.name = this.getValueOrDefault(value.nickname, "--");
|
||||||
cipher.notes = this.getValueOrDefault(value.additionalInfo);
|
cipher.notes = this.getValueOrDefault(value.additionalInfo);
|
||||||
|
|
||||||
if (value.url !== undefined) {
|
if (value.url !== undefined) {
|
||||||
@@ -60,7 +60,7 @@ export class MykiCsvImporter extends BaseImporter implements Importer {
|
|||||||
cipher.secureNote = new SecureNoteView();
|
cipher.secureNote = new SecureNoteView();
|
||||||
cipher.type = CipherType.SecureNote;
|
cipher.type = CipherType.SecureNote;
|
||||||
cipher.secureNote.type = SecureNoteType.Generic;
|
cipher.secureNote.type = SecureNoteType.Generic;
|
||||||
cipher.name = this.getValueOrDefault(value.title, '--');
|
cipher.name = this.getValueOrDefault(value.title, "--");
|
||||||
cipher.notes = this.getValueOrDefault(value.content);
|
cipher.notes = this.getValueOrDefault(value.content);
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import { BaseImporter } from './baseImporter';
|
import { BaseImporter } from "./baseImporter";
|
||||||
import { Importer } from './importer';
|
import { Importer } from "./importer";
|
||||||
|
|
||||||
import { ImportResult } from '../models/domain/importResult';
|
import { ImportResult } from "../models/domain/importResult";
|
||||||
|
|
||||||
import { CipherView } from '../models/view/cipherView';
|
import { CipherView } from "../models/view/cipherView";
|
||||||
import { LoginView } from '../models/view/loginView';
|
import { LoginView } from "../models/view/loginView";
|
||||||
|
|
||||||
import { CipherType } from '../enums/cipherType';
|
import { CipherType } from "../enums/cipherType";
|
||||||
import { SecureNoteType } from '../enums/secureNoteType';
|
import { SecureNoteType } from "../enums/secureNoteType";
|
||||||
|
|
||||||
type nodePassCsvParsed = {
|
type nodePassCsvParsed = {
|
||||||
name: string;
|
name: string;
|
||||||
@@ -40,8 +40,7 @@ export class NordPassCsvImporter extends BaseImporter implements Importer {
|
|||||||
return Promise.resolve(result);
|
return Promise.resolve(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
results.forEach(record => {
|
results.forEach((record) => {
|
||||||
|
|
||||||
const recordType = this.evaluateType(record);
|
const recordType = this.evaluateType(record);
|
||||||
if (recordType === undefined) {
|
if (recordType === undefined) {
|
||||||
return;
|
return;
|
||||||
@@ -52,7 +51,7 @@ export class NordPassCsvImporter extends BaseImporter implements Importer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const cipher = new CipherView();
|
const cipher = new CipherView();
|
||||||
cipher.name = this.getValueOrDefault(record.name, '--');
|
cipher.name = this.getValueOrDefault(record.name, "--");
|
||||||
cipher.notes = this.getValueOrDefault(record.note);
|
cipher.notes = this.getValueOrDefault(record.note);
|
||||||
|
|
||||||
switch (recordType) {
|
switch (recordType) {
|
||||||
@@ -109,7 +108,6 @@ export class NordPassCsvImporter extends BaseImporter implements Importer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private evaluateType(record: nodePassCsvParsed): CipherType {
|
private evaluateType(record: nodePassCsvParsed): CipherType {
|
||||||
|
|
||||||
if (!this.isNullOrWhitespace(record.username)) {
|
if (!this.isNullOrWhitespace(record.username)) {
|
||||||
return CipherType.Login;
|
return CipherType.Login;
|
||||||
}
|
}
|
||||||
@@ -130,12 +128,11 @@ export class NordPassCsvImporter extends BaseImporter implements Importer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private processName(cipher: CipherView, fullName: string) {
|
private processName(cipher: CipherView, fullName: string) {
|
||||||
|
|
||||||
if (this.isNullOrWhitespace(fullName)) {
|
if (this.isNullOrWhitespace(fullName)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const nameParts = fullName.split(' ');
|
const nameParts = fullName.split(" ");
|
||||||
if (nameParts.length > 0) {
|
if (nameParts.length > 0) {
|
||||||
cipher.identity.firstName = this.getValueOrDefault(nameParts[0]);
|
cipher.identity.firstName = this.getValueOrDefault(nameParts[0]);
|
||||||
}
|
}
|
||||||
@@ -143,7 +140,7 @@ export class NordPassCsvImporter extends BaseImporter implements Importer {
|
|||||||
cipher.identity.lastName = this.getValueOrDefault(nameParts[1]);
|
cipher.identity.lastName = this.getValueOrDefault(nameParts[1]);
|
||||||
} else if (nameParts.length >= 3) {
|
} else if (nameParts.length >= 3) {
|
||||||
cipher.identity.middleName = this.getValueOrDefault(nameParts[1]);
|
cipher.identity.middleName = this.getValueOrDefault(nameParts[1]);
|
||||||
cipher.identity.lastName = nameParts.slice(2, nameParts.length).join(' ');
|
cipher.identity.lastName = nameParts.slice(2, nameParts.length).join(" ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { CipherView } from '../../models/view/cipherView';
|
import { CipherView } from "../../models/view/cipherView";
|
||||||
|
|
||||||
export class CipherImportContext {
|
export class CipherImportContext {
|
||||||
lowerProperty: string;
|
lowerProperty: string;
|
||||||
|
|||||||
@@ -1,24 +1,24 @@
|
|||||||
import { BaseImporter } from '../baseImporter';
|
import { BaseImporter } from "../baseImporter";
|
||||||
import { Importer } from '../importer';
|
import { Importer } from "../importer";
|
||||||
|
|
||||||
import { ImportResult } from '../../models/domain/importResult';
|
import { ImportResult } from "../../models/domain/importResult";
|
||||||
|
|
||||||
import { CardView } from '../../models/view/cardView';
|
import { CardView } from "../../models/view/cardView";
|
||||||
import { CipherView } from '../../models/view/cipherView';
|
import { CipherView } from "../../models/view/cipherView";
|
||||||
import { IdentityView } from '../../models/view/identityView';
|
import { IdentityView } from "../../models/view/identityView";
|
||||||
import { PasswordHistoryView } from '../../models/view/passwordHistoryView';
|
import { PasswordHistoryView } from "../../models/view/passwordHistoryView";
|
||||||
import { SecureNoteView } from '../../models/view/secureNoteView';
|
import { SecureNoteView } from "../../models/view/secureNoteView";
|
||||||
|
|
||||||
import { CipherType } from '../../enums/cipherType';
|
import { CipherType } from "../../enums/cipherType";
|
||||||
import { FieldType } from '../../enums/fieldType';
|
import { FieldType } from "../../enums/fieldType";
|
||||||
import { SecureNoteType } from '../../enums/secureNoteType';
|
import { SecureNoteType } from "../../enums/secureNoteType";
|
||||||
|
|
||||||
export class OnePassword1PifImporter extends BaseImporter implements Importer {
|
export class OnePassword1PifImporter extends BaseImporter implements Importer {
|
||||||
result = new ImportResult();
|
result = new ImportResult();
|
||||||
|
|
||||||
parse(data: string): Promise<ImportResult> {
|
parse(data: string): Promise<ImportResult> {
|
||||||
data.split(this.newLineRegex).forEach(line => {
|
data.split(this.newLineRegex).forEach((line) => {
|
||||||
if (this.isNullOrWhitespace(line) || line[0] !== '{') {
|
if (this.isNullOrWhitespace(line) || line[0] !== "{") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const item = JSON.parse(line);
|
const item = JSON.parse(line);
|
||||||
@@ -60,11 +60,16 @@ export class OnePassword1PifImporter extends BaseImporter implements Importer {
|
|||||||
if (item.details.passwordHistory != null) {
|
if (item.details.passwordHistory != null) {
|
||||||
this.parsePasswordHistory(item.details.passwordHistory, cipher);
|
this.parsePasswordHistory(item.details.passwordHistory, cipher);
|
||||||
}
|
}
|
||||||
if (!this.isNullOrWhitespace(item.details.ccnum) || !this.isNullOrWhitespace(item.details.cvv)) {
|
if (
|
||||||
|
!this.isNullOrWhitespace(item.details.ccnum) ||
|
||||||
|
!this.isNullOrWhitespace(item.details.cvv)
|
||||||
|
) {
|
||||||
cipher.type = CipherType.Card;
|
cipher.type = CipherType.Card;
|
||||||
cipher.card = new CardView();
|
cipher.card = new CardView();
|
||||||
} else if (!this.isNullOrWhitespace(item.details.firstname) ||
|
} else if (
|
||||||
!this.isNullOrWhitespace(item.details.address1)) {
|
!this.isNullOrWhitespace(item.details.firstname) ||
|
||||||
|
!this.isNullOrWhitespace(item.details.address1)
|
||||||
|
) {
|
||||||
cipher.type = CipherType.Identity;
|
cipher.type = CipherType.Identity;
|
||||||
cipher.identity = new IdentityView();
|
cipher.identity = new IdentityView();
|
||||||
}
|
}
|
||||||
@@ -72,15 +77,15 @@ export class OnePassword1PifImporter extends BaseImporter implements Importer {
|
|||||||
cipher.login.password = item.details.password;
|
cipher.login.password = item.details.password;
|
||||||
}
|
}
|
||||||
if (!this.isNullOrWhitespace(item.details.notesPlain)) {
|
if (!this.isNullOrWhitespace(item.details.notesPlain)) {
|
||||||
cipher.notes = item.details.notesPlain.split(this.newLineRegex).join('\n') + '\n';
|
cipher.notes = item.details.notesPlain.split(this.newLineRegex).join("\n") + "\n";
|
||||||
}
|
}
|
||||||
if (item.details.fields != null) {
|
if (item.details.fields != null) {
|
||||||
this.parseFields(item.details.fields, cipher, 'designation', 'value', 'name');
|
this.parseFields(item.details.fields, cipher, "designation", "value", "name");
|
||||||
}
|
}
|
||||||
if (item.details.sections != null) {
|
if (item.details.sections != null) {
|
||||||
item.details.sections.forEach((section: any) => {
|
item.details.sections.forEach((section: any) => {
|
||||||
if (section.fields != null) {
|
if (section.fields != null) {
|
||||||
this.parseFields(section.fields, cipher, 'n', 'v', 't');
|
this.parseFields(section.fields, cipher, "n", "v", "t");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -91,14 +96,14 @@ export class OnePassword1PifImporter extends BaseImporter implements Importer {
|
|||||||
cipher.favorite = item.openContents && item.openContents.faveIndex ? true : false;
|
cipher.favorite = item.openContents && item.openContents.faveIndex ? true : false;
|
||||||
cipher.name = this.getValueOrDefault(item.title);
|
cipher.name = this.getValueOrDefault(item.title);
|
||||||
|
|
||||||
if (item.typeName === 'securenotes.SecureNote') {
|
if (item.typeName === "securenotes.SecureNote") {
|
||||||
cipher.type = CipherType.SecureNote;
|
cipher.type = CipherType.SecureNote;
|
||||||
cipher.secureNote = new SecureNoteView();
|
cipher.secureNote = new SecureNoteView();
|
||||||
cipher.secureNote.type = SecureNoteType.Generic;
|
cipher.secureNote.type = SecureNoteType.Generic;
|
||||||
} else if (item.typeName === 'wallet.financial.CreditCard') {
|
} else if (item.typeName === "wallet.financial.CreditCard") {
|
||||||
cipher.type = CipherType.Card;
|
cipher.type = CipherType.Card;
|
||||||
cipher.card = new CardView();
|
cipher.card = new CardView();
|
||||||
} else if (item.typeName === 'identities.Identity') {
|
} else if (item.typeName === "identities.Identity") {
|
||||||
cipher.type = CipherType.Identity;
|
cipher.type = CipherType.Identity;
|
||||||
cipher.identity = new IdentityView();
|
cipher.identity = new IdentityView();
|
||||||
} else {
|
} else {
|
||||||
@@ -110,7 +115,7 @@ export class OnePassword1PifImporter extends BaseImporter implements Importer {
|
|||||||
this.parsePasswordHistory(item.secureContents.passwordHistory, cipher);
|
this.parsePasswordHistory(item.secureContents.passwordHistory, cipher);
|
||||||
}
|
}
|
||||||
if (!this.isNullOrWhitespace(item.secureContents.notesPlain)) {
|
if (!this.isNullOrWhitespace(item.secureContents.notesPlain)) {
|
||||||
cipher.notes = item.secureContents.notesPlain.split(this.newLineRegex).join('\n') + '\n';
|
cipher.notes = item.secureContents.notesPlain.split(this.newLineRegex).join("\n") + "\n";
|
||||||
}
|
}
|
||||||
if (cipher.type === CipherType.Login) {
|
if (cipher.type === CipherType.Login) {
|
||||||
if (!this.isNullOrWhitespace(item.secureContents.password)) {
|
if (!this.isNullOrWhitespace(item.secureContents.password)) {
|
||||||
@@ -129,12 +134,12 @@ export class OnePassword1PifImporter extends BaseImporter implements Importer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (item.secureContents.fields != null) {
|
if (item.secureContents.fields != null) {
|
||||||
this.parseFields(item.secureContents.fields, cipher, 'designation', 'value', 'name');
|
this.parseFields(item.secureContents.fields, cipher, "designation", "value", "name");
|
||||||
}
|
}
|
||||||
if (item.secureContents.sections != null) {
|
if (item.secureContents.sections != null) {
|
||||||
item.secureContents.sections.forEach((section: any) => {
|
item.secureContents.sections.forEach((section: any) => {
|
||||||
if (section.fields != null) {
|
if (section.fields != null) {
|
||||||
this.parseFields(section.fields, cipher, 'n', 'v', 't');
|
this.parseFields(section.fields, cipher, "n", "v", "t");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -150,79 +155,98 @@ export class OnePassword1PifImporter extends BaseImporter implements Importer {
|
|||||||
.map((h: any) => {
|
.map((h: any) => {
|
||||||
const ph = new PasswordHistoryView();
|
const ph = new PasswordHistoryView();
|
||||||
ph.password = h.value;
|
ph.password = h.value;
|
||||||
ph.lastUsedDate = new Date(('' + h.time).length >= 13 ? h.time : h.time * 1000);
|
ph.lastUsedDate = new Date(("" + h.time).length >= 13 ? h.time : h.time * 1000);
|
||||||
return ph;
|
return ph;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private parseFields(fields: any[], cipher: CipherView, designationKey: string, valueKey: string, nameKey: string) {
|
private parseFields(
|
||||||
|
fields: any[],
|
||||||
|
cipher: CipherView,
|
||||||
|
designationKey: string,
|
||||||
|
valueKey: string,
|
||||||
|
nameKey: string
|
||||||
|
) {
|
||||||
fields.forEach((field: any) => {
|
fields.forEach((field: any) => {
|
||||||
if (field[valueKey] == null || field[valueKey].toString().trim() === '') {
|
if (field[valueKey] == null || field[valueKey].toString().trim() === "") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const fieldValue = field[valueKey].toString();
|
const fieldValue = field[valueKey].toString();
|
||||||
const fieldDesignation = field[designationKey] != null ? field[designationKey].toString() : null;
|
const fieldDesignation =
|
||||||
|
field[designationKey] != null ? field[designationKey].toString() : null;
|
||||||
|
|
||||||
if (cipher.type === CipherType.Login) {
|
if (cipher.type === CipherType.Login) {
|
||||||
if (this.isNullOrWhitespace(cipher.login.username) && fieldDesignation === 'username') {
|
if (this.isNullOrWhitespace(cipher.login.username) && fieldDesignation === "username") {
|
||||||
cipher.login.username = fieldValue;
|
cipher.login.username = fieldValue;
|
||||||
return;
|
return;
|
||||||
} else if (this.isNullOrWhitespace(cipher.login.password) && fieldDesignation === 'password') {
|
} else if (
|
||||||
|
this.isNullOrWhitespace(cipher.login.password) &&
|
||||||
|
fieldDesignation === "password"
|
||||||
|
) {
|
||||||
cipher.login.password = fieldValue;
|
cipher.login.password = fieldValue;
|
||||||
return;
|
return;
|
||||||
} else if (this.isNullOrWhitespace(cipher.login.totp) && fieldDesignation != null &&
|
} else if (
|
||||||
fieldDesignation.startsWith('TOTP_')) {
|
this.isNullOrWhitespace(cipher.login.totp) &&
|
||||||
|
fieldDesignation != null &&
|
||||||
|
fieldDesignation.startsWith("TOTP_")
|
||||||
|
) {
|
||||||
cipher.login.totp = fieldValue;
|
cipher.login.totp = fieldValue;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (cipher.type === CipherType.Card) {
|
} else if (cipher.type === CipherType.Card) {
|
||||||
if (this.isNullOrWhitespace(cipher.card.number) && fieldDesignation === 'ccnum') {
|
if (this.isNullOrWhitespace(cipher.card.number) && fieldDesignation === "ccnum") {
|
||||||
cipher.card.number = fieldValue;
|
cipher.card.number = fieldValue;
|
||||||
cipher.card.brand = this.getCardBrand(fieldValue);
|
cipher.card.brand = this.getCardBrand(fieldValue);
|
||||||
return;
|
return;
|
||||||
} else if (this.isNullOrWhitespace(cipher.card.code) && fieldDesignation === 'cvv') {
|
} else if (this.isNullOrWhitespace(cipher.card.code) && fieldDesignation === "cvv") {
|
||||||
cipher.card.code = fieldValue;
|
cipher.card.code = fieldValue;
|
||||||
return;
|
return;
|
||||||
} else if (this.isNullOrWhitespace(cipher.card.cardholderName) && fieldDesignation === 'cardholder') {
|
} else if (
|
||||||
|
this.isNullOrWhitespace(cipher.card.cardholderName) &&
|
||||||
|
fieldDesignation === "cardholder"
|
||||||
|
) {
|
||||||
cipher.card.cardholderName = fieldValue;
|
cipher.card.cardholderName = fieldValue;
|
||||||
return;
|
return;
|
||||||
} else if (this.isNullOrWhitespace(cipher.card.expiration) && fieldDesignation === 'expiry' &&
|
} else if (
|
||||||
fieldValue.length === 6) {
|
this.isNullOrWhitespace(cipher.card.expiration) &&
|
||||||
|
fieldDesignation === "expiry" &&
|
||||||
|
fieldValue.length === 6
|
||||||
|
) {
|
||||||
cipher.card.expMonth = (fieldValue as string).substr(4, 2);
|
cipher.card.expMonth = (fieldValue as string).substr(4, 2);
|
||||||
if (cipher.card.expMonth[0] === '0') {
|
if (cipher.card.expMonth[0] === "0") {
|
||||||
cipher.card.expMonth = cipher.card.expMonth.substr(1, 1);
|
cipher.card.expMonth = cipher.card.expMonth.substr(1, 1);
|
||||||
}
|
}
|
||||||
cipher.card.expYear = (fieldValue as string).substr(0, 4);
|
cipher.card.expYear = (fieldValue as string).substr(0, 4);
|
||||||
return;
|
return;
|
||||||
} else if (fieldDesignation === 'type') {
|
} else if (fieldDesignation === "type") {
|
||||||
// Skip since brand was determined from number above
|
// Skip since brand was determined from number above
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (cipher.type === CipherType.Identity) {
|
} else if (cipher.type === CipherType.Identity) {
|
||||||
const identity = cipher.identity;
|
const identity = cipher.identity;
|
||||||
if (this.isNullOrWhitespace(identity.firstName) && fieldDesignation === 'firstname') {
|
if (this.isNullOrWhitespace(identity.firstName) && fieldDesignation === "firstname") {
|
||||||
identity.firstName = fieldValue;
|
identity.firstName = fieldValue;
|
||||||
return;
|
return;
|
||||||
} else if (this.isNullOrWhitespace(identity.lastName) && fieldDesignation === 'lastname') {
|
} else if (this.isNullOrWhitespace(identity.lastName) && fieldDesignation === "lastname") {
|
||||||
identity.lastName = fieldValue;
|
identity.lastName = fieldValue;
|
||||||
return;
|
return;
|
||||||
} else if (this.isNullOrWhitespace(identity.middleName) && fieldDesignation === 'initial') {
|
} else if (this.isNullOrWhitespace(identity.middleName) && fieldDesignation === "initial") {
|
||||||
identity.middleName = fieldValue;
|
identity.middleName = fieldValue;
|
||||||
return;
|
return;
|
||||||
} else if (this.isNullOrWhitespace(identity.phone) && fieldDesignation === 'defphone') {
|
} else if (this.isNullOrWhitespace(identity.phone) && fieldDesignation === "defphone") {
|
||||||
identity.phone = fieldValue;
|
identity.phone = fieldValue;
|
||||||
return;
|
return;
|
||||||
} else if (this.isNullOrWhitespace(identity.company) && fieldDesignation === 'company') {
|
} else if (this.isNullOrWhitespace(identity.company) && fieldDesignation === "company") {
|
||||||
identity.company = fieldValue;
|
identity.company = fieldValue;
|
||||||
return;
|
return;
|
||||||
} else if (this.isNullOrWhitespace(identity.email) && fieldDesignation === 'email') {
|
} else if (this.isNullOrWhitespace(identity.email) && fieldDesignation === "email") {
|
||||||
identity.email = fieldValue;
|
identity.email = fieldValue;
|
||||||
return;
|
return;
|
||||||
} else if (this.isNullOrWhitespace(identity.username) && fieldDesignation === 'username') {
|
} else if (this.isNullOrWhitespace(identity.username) && fieldDesignation === "username") {
|
||||||
identity.username = fieldValue;
|
identity.username = fieldValue;
|
||||||
return;
|
return;
|
||||||
} else if (fieldDesignation === 'address') {
|
} else if (fieldDesignation === "address") {
|
||||||
// fieldValue is an object casted into a string, so access the plain value instead
|
// fieldValue is an object casted into a string, so access the plain value instead
|
||||||
const { street, city, country, zip } = field[valueKey];
|
const { street, city, country, zip } = field[valueKey];
|
||||||
identity.address1 = this.getValueOrDefault(street);
|
identity.address1 = this.getValueOrDefault(street);
|
||||||
@@ -235,13 +259,16 @@ export class OnePassword1PifImporter extends BaseImporter implements Importer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const fieldName = this.isNullOrWhitespace(field[nameKey]) ? 'no_name' : field[nameKey];
|
const fieldName = this.isNullOrWhitespace(field[nameKey]) ? "no_name" : field[nameKey];
|
||||||
if (fieldName === 'password' && cipher.passwordHistory != null &&
|
if (
|
||||||
cipher.passwordHistory.some(h => h.password === fieldValue)) {
|
fieldName === "password" &&
|
||||||
|
cipher.passwordHistory != null &&
|
||||||
|
cipher.passwordHistory.some((h) => h.password === fieldValue)
|
||||||
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const fieldType = field.k === 'concealed' ? FieldType.Hidden : FieldType.Text;
|
const fieldType = field.k === "concealed" ? FieldType.Hidden : FieldType.Text;
|
||||||
this.processKvp(cipher, fieldName, fieldValue, fieldType);
|
this.processKvp(cipher, fieldName, fieldValue, fieldType);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,18 +1,45 @@
|
|||||||
import { ImportResult } from '../../models/domain/importResult';
|
import { ImportResult } from "../../models/domain/importResult";
|
||||||
import { BaseImporter } from '../baseImporter';
|
import { BaseImporter } from "../baseImporter";
|
||||||
import { Importer } from '../importer';
|
import { Importer } from "../importer";
|
||||||
|
|
||||||
import { CipherType } from '../../enums/cipherType';
|
import { CipherType } from "../../enums/cipherType";
|
||||||
import { FieldType } from '../../enums/fieldType';
|
import { FieldType } from "../../enums/fieldType";
|
||||||
import { CipherView } from '../../models/view/cipherView';
|
import { CipherView } from "../../models/view/cipherView";
|
||||||
import { CipherImportContext } from './cipherImportContext';
|
import { CipherImportContext } from "./cipherImportContext";
|
||||||
|
|
||||||
export const IgnoredProperties = ['ainfo', 'autosubmit', 'notesplain', 'ps', 'scope', 'tags', 'title', 'uuid', 'notes'];
|
export const IgnoredProperties = [
|
||||||
|
"ainfo",
|
||||||
|
"autosubmit",
|
||||||
|
"notesplain",
|
||||||
|
"ps",
|
||||||
|
"scope",
|
||||||
|
"tags",
|
||||||
|
"title",
|
||||||
|
"uuid",
|
||||||
|
"notes",
|
||||||
|
];
|
||||||
|
|
||||||
export abstract class OnePasswordCsvImporter extends BaseImporter implements Importer {
|
export abstract class OnePasswordCsvImporter extends BaseImporter implements Importer {
|
||||||
protected loginPropertyParsers = [this.setLoginUsername, this.setLoginPassword, this.setLoginUris];
|
protected loginPropertyParsers = [
|
||||||
protected creditCardPropertyParsers = [this.setCreditCardNumber, this.setCreditCardVerification, this.setCreditCardCardholderName, this.setCreditCardExpiry];
|
this.setLoginUsername,
|
||||||
protected identityPropertyParsers = [this.setIdentityFirstName, this.setIdentityInitial, this.setIdentityLastName, this.setIdentityUserName, this.setIdentityEmail, this.setIdentityPhone, this.setIdentityCompany];
|
this.setLoginPassword,
|
||||||
|
this.setLoginUris,
|
||||||
|
];
|
||||||
|
protected creditCardPropertyParsers = [
|
||||||
|
this.setCreditCardNumber,
|
||||||
|
this.setCreditCardVerification,
|
||||||
|
this.setCreditCardCardholderName,
|
||||||
|
this.setCreditCardExpiry,
|
||||||
|
];
|
||||||
|
protected identityPropertyParsers = [
|
||||||
|
this.setIdentityFirstName,
|
||||||
|
this.setIdentityInitial,
|
||||||
|
this.setIdentityLastName,
|
||||||
|
this.setIdentityUserName,
|
||||||
|
this.setIdentityEmail,
|
||||||
|
this.setIdentityPhone,
|
||||||
|
this.setIdentityCompany,
|
||||||
|
];
|
||||||
|
|
||||||
abstract setCipherType(value: any, cipher: CipherView): void;
|
abstract setCipherType(value: any, cipher: CipherView): void;
|
||||||
|
|
||||||
@@ -20,20 +47,20 @@ export abstract class OnePasswordCsvImporter extends BaseImporter implements Imp
|
|||||||
const result = new ImportResult();
|
const result = new ImportResult();
|
||||||
const results = this.parseCsv(data, true, {
|
const results = this.parseCsv(data, true, {
|
||||||
quoteChar: '"',
|
quoteChar: '"',
|
||||||
escapeChar: '\\',
|
escapeChar: "\\",
|
||||||
});
|
});
|
||||||
if (results == null) {
|
if (results == null) {
|
||||||
result.success = false;
|
result.success = false;
|
||||||
return Promise.resolve(result);
|
return Promise.resolve(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
results.forEach(value => {
|
results.forEach((value) => {
|
||||||
if (this.isNullOrWhitespace(this.getProp(value, 'title'))) {
|
if (this.isNullOrWhitespace(this.getProp(value, "title"))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const cipher = this.initLoginCipher();
|
const cipher = this.initLoginCipher();
|
||||||
cipher.name = this.getValueOrDefault(this.getProp(value, 'title'), '--');
|
cipher.name = this.getValueOrDefault(this.getProp(value, "title"), "--");
|
||||||
|
|
||||||
this.setNotes(value, cipher);
|
this.setNotes(value, cipher);
|
||||||
|
|
||||||
@@ -57,8 +84,12 @@ export abstract class OnePasswordCsvImporter extends BaseImporter implements Imp
|
|||||||
altUsername = this.setUnknownValue(context, altUsername);
|
altUsername = this.setUnknownValue(context, altUsername);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cipher.type === CipherType.Login && !this.isNullOrWhitespace(altUsername) &&
|
if (
|
||||||
this.isNullOrWhitespace(cipher.login.username) && altUsername.indexOf('://') === -1) {
|
cipher.type === CipherType.Login &&
|
||||||
|
!this.isNullOrWhitespace(altUsername) &&
|
||||||
|
this.isNullOrWhitespace(cipher.login.username) &&
|
||||||
|
altUsername.indexOf("://") === -1
|
||||||
|
) {
|
||||||
cipher.login.username = altUsername;
|
cipher.login.username = altUsername;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,10 +139,12 @@ export abstract class OnePasswordCsvImporter extends BaseImporter implements Imp
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected setNotes(importRecord: any, cipher: CipherView) {
|
protected setNotes(importRecord: any, cipher: CipherView) {
|
||||||
cipher.notes = this.getValueOrDefault(this.getProp(importRecord, 'notesPlain'), '') + '\n' +
|
cipher.notes =
|
||||||
this.getValueOrDefault(this.getProp(importRecord, 'notes'), '') + '\n';
|
this.getValueOrDefault(this.getProp(importRecord, "notesPlain"), "") +
|
||||||
|
"\n" +
|
||||||
|
this.getValueOrDefault(this.getProp(importRecord, "notes"), "") +
|
||||||
|
"\n";
|
||||||
cipher.notes.trim();
|
cipher.notes.trim();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected setKnownLoginValue(context: CipherImportContext): boolean {
|
protected setKnownLoginValue(context: CipherImportContext): boolean {
|
||||||
@@ -142,18 +175,34 @@ export abstract class OnePasswordCsvImporter extends BaseImporter implements Imp
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected setUnknownValue(context: CipherImportContext, altUsername: string): string {
|
protected setUnknownValue(context: CipherImportContext, altUsername: string): string {
|
||||||
if (IgnoredProperties.indexOf(context.lowerProperty) === -1 && !context.lowerProperty.startsWith('section:') &&
|
if (
|
||||||
!context.lowerProperty.startsWith('section ')) {
|
IgnoredProperties.indexOf(context.lowerProperty) === -1 &&
|
||||||
if (altUsername == null && context.lowerProperty === 'email') {
|
!context.lowerProperty.startsWith("section:") &&
|
||||||
|
!context.lowerProperty.startsWith("section ")
|
||||||
|
) {
|
||||||
|
if (altUsername == null && context.lowerProperty === "email") {
|
||||||
return context.importRecord[context.property];
|
return context.importRecord[context.property];
|
||||||
}
|
} else if (
|
||||||
else if (context.lowerProperty === 'created date' || context.lowerProperty === 'modified date') {
|
context.lowerProperty === "created date" ||
|
||||||
const readableDate = new Date(parseInt(context.importRecord[context.property], 10) * 1000).toUTCString();
|
context.lowerProperty === "modified date"
|
||||||
this.processKvp(context.cipher, '1Password ' + context.property, readableDate);
|
) {
|
||||||
|
const readableDate = new Date(
|
||||||
|
parseInt(context.importRecord[context.property], 10) * 1000
|
||||||
|
).toUTCString();
|
||||||
|
this.processKvp(context.cipher, "1Password " + context.property, readableDate);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (context.lowerProperty.includes('password') || context.lowerProperty.includes('key') || context.lowerProperty.includes('secret')) {
|
if (
|
||||||
this.processKvp(context.cipher, context.property, context.importRecord[context.property], FieldType.Hidden);
|
context.lowerProperty.includes("password") ||
|
||||||
|
context.lowerProperty.includes("key") ||
|
||||||
|
context.lowerProperty.includes("secret")
|
||||||
|
) {
|
||||||
|
this.processKvp(
|
||||||
|
context.cipher,
|
||||||
|
context.property,
|
||||||
|
context.importRecord[context.property],
|
||||||
|
FieldType.Hidden
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
this.processKvp(context.cipher, context.property, context.importRecord[context.property]);
|
this.processKvp(context.cipher, context.property, context.importRecord[context.property]);
|
||||||
}
|
}
|
||||||
@@ -162,7 +211,10 @@ export abstract class OnePasswordCsvImporter extends BaseImporter implements Imp
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected setIdentityFirstName(context: CipherImportContext) {
|
protected setIdentityFirstName(context: CipherImportContext) {
|
||||||
if (this.isNullOrWhitespace(context.cipher.identity.firstName) && context.lowerProperty.includes('first name')) {
|
if (
|
||||||
|
this.isNullOrWhitespace(context.cipher.identity.firstName) &&
|
||||||
|
context.lowerProperty.includes("first name")
|
||||||
|
) {
|
||||||
context.cipher.identity.firstName = context.importRecord[context.property];
|
context.cipher.identity.firstName = context.importRecord[context.property];
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -170,7 +222,10 @@ export abstract class OnePasswordCsvImporter extends BaseImporter implements Imp
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected setIdentityInitial(context: CipherImportContext) {
|
protected setIdentityInitial(context: CipherImportContext) {
|
||||||
if (this.isNullOrWhitespace(context.cipher.identity.middleName) && context.lowerProperty.includes('initial')) {
|
if (
|
||||||
|
this.isNullOrWhitespace(context.cipher.identity.middleName) &&
|
||||||
|
context.lowerProperty.includes("initial")
|
||||||
|
) {
|
||||||
context.cipher.identity.middleName = context.importRecord[context.property];
|
context.cipher.identity.middleName = context.importRecord[context.property];
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -178,7 +233,10 @@ export abstract class OnePasswordCsvImporter extends BaseImporter implements Imp
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected setIdentityLastName(context: CipherImportContext) {
|
protected setIdentityLastName(context: CipherImportContext) {
|
||||||
if (this.isNullOrWhitespace(context.cipher.identity.lastName) && context.lowerProperty.includes('last name')) {
|
if (
|
||||||
|
this.isNullOrWhitespace(context.cipher.identity.lastName) &&
|
||||||
|
context.lowerProperty.includes("last name")
|
||||||
|
) {
|
||||||
context.cipher.identity.lastName = context.importRecord[context.property];
|
context.cipher.identity.lastName = context.importRecord[context.property];
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -186,7 +244,10 @@ export abstract class OnePasswordCsvImporter extends BaseImporter implements Imp
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected setIdentityUserName(context: CipherImportContext) {
|
protected setIdentityUserName(context: CipherImportContext) {
|
||||||
if (this.isNullOrWhitespace(context.cipher.identity.username) && context.lowerProperty.includes('username')) {
|
if (
|
||||||
|
this.isNullOrWhitespace(context.cipher.identity.username) &&
|
||||||
|
context.lowerProperty.includes("username")
|
||||||
|
) {
|
||||||
context.cipher.identity.username = context.importRecord[context.property];
|
context.cipher.identity.username = context.importRecord[context.property];
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -194,7 +255,10 @@ export abstract class OnePasswordCsvImporter extends BaseImporter implements Imp
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected setIdentityCompany(context: CipherImportContext) {
|
protected setIdentityCompany(context: CipherImportContext) {
|
||||||
if (this.isNullOrWhitespace(context.cipher.identity.company) && context.lowerProperty.includes('company')) {
|
if (
|
||||||
|
this.isNullOrWhitespace(context.cipher.identity.company) &&
|
||||||
|
context.lowerProperty.includes("company")
|
||||||
|
) {
|
||||||
context.cipher.identity.company = context.importRecord[context.property];
|
context.cipher.identity.company = context.importRecord[context.property];
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -202,7 +266,10 @@ export abstract class OnePasswordCsvImporter extends BaseImporter implements Imp
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected setIdentityPhone(context: CipherImportContext) {
|
protected setIdentityPhone(context: CipherImportContext) {
|
||||||
if (this.isNullOrWhitespace(context.cipher.identity.phone) && context.lowerProperty.includes('default phone')) {
|
if (
|
||||||
|
this.isNullOrWhitespace(context.cipher.identity.phone) &&
|
||||||
|
context.lowerProperty.includes("default phone")
|
||||||
|
) {
|
||||||
context.cipher.identity.phone = context.importRecord[context.property];
|
context.cipher.identity.phone = context.importRecord[context.property];
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -210,7 +277,10 @@ export abstract class OnePasswordCsvImporter extends BaseImporter implements Imp
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected setIdentityEmail(context: CipherImportContext) {
|
protected setIdentityEmail(context: CipherImportContext) {
|
||||||
if (this.isNullOrWhitespace(context.cipher.identity.email) && context.lowerProperty.includes('email')) {
|
if (
|
||||||
|
this.isNullOrWhitespace(context.cipher.identity.email) &&
|
||||||
|
context.lowerProperty.includes("email")
|
||||||
|
) {
|
||||||
context.cipher.identity.email = context.importRecord[context.property];
|
context.cipher.identity.email = context.importRecord[context.property];
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -218,7 +288,10 @@ export abstract class OnePasswordCsvImporter extends BaseImporter implements Imp
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected setCreditCardNumber(context: CipherImportContext): boolean {
|
protected setCreditCardNumber(context: CipherImportContext): boolean {
|
||||||
if (this.isNullOrWhitespace(context.cipher.card.number) && context.lowerProperty.includes('number')) {
|
if (
|
||||||
|
this.isNullOrWhitespace(context.cipher.card.number) &&
|
||||||
|
context.lowerProperty.includes("number")
|
||||||
|
) {
|
||||||
context.cipher.card.number = context.importRecord[context.property];
|
context.cipher.card.number = context.importRecord[context.property];
|
||||||
context.cipher.card.brand = this.getCardBrand(context.cipher.card.number);
|
context.cipher.card.brand = this.getCardBrand(context.cipher.card.number);
|
||||||
return true;
|
return true;
|
||||||
@@ -227,7 +300,10 @@ export abstract class OnePasswordCsvImporter extends BaseImporter implements Imp
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected setCreditCardVerification(context: CipherImportContext) {
|
protected setCreditCardVerification(context: CipherImportContext) {
|
||||||
if (this.isNullOrWhitespace(context.cipher.card.code) && context.lowerProperty.includes('verification number')) {
|
if (
|
||||||
|
this.isNullOrWhitespace(context.cipher.card.code) &&
|
||||||
|
context.lowerProperty.includes("verification number")
|
||||||
|
) {
|
||||||
context.cipher.card.code = context.importRecord[context.property];
|
context.cipher.card.code = context.importRecord[context.property];
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -235,7 +311,10 @@ export abstract class OnePasswordCsvImporter extends BaseImporter implements Imp
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected setCreditCardCardholderName(context: CipherImportContext) {
|
protected setCreditCardCardholderName(context: CipherImportContext) {
|
||||||
if (this.isNullOrWhitespace(context.cipher.card.cardholderName) && context.lowerProperty.includes('cardholder name')) {
|
if (
|
||||||
|
this.isNullOrWhitespace(context.cipher.card.cardholderName) &&
|
||||||
|
context.lowerProperty.includes("cardholder name")
|
||||||
|
) {
|
||||||
context.cipher.card.cardholderName = context.importRecord[context.property];
|
context.cipher.card.cardholderName = context.importRecord[context.property];
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -243,10 +322,16 @@ export abstract class OnePasswordCsvImporter extends BaseImporter implements Imp
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected setCreditCardExpiry(context: CipherImportContext) {
|
protected setCreditCardExpiry(context: CipherImportContext) {
|
||||||
if (this.isNullOrWhitespace(context.cipher.card.expiration) && context.lowerProperty.includes('expiry date') &&
|
if (
|
||||||
context.importRecord[context.property].length === 7) {
|
this.isNullOrWhitespace(context.cipher.card.expiration) &&
|
||||||
context.cipher.card.expMonth = (context.importRecord[context.property] as string).substr(0, 2);
|
context.lowerProperty.includes("expiry date") &&
|
||||||
if (context.cipher.card.expMonth[0] === '0') {
|
context.importRecord[context.property].length === 7
|
||||||
|
) {
|
||||||
|
context.cipher.card.expMonth = (context.importRecord[context.property] as string).substr(
|
||||||
|
0,
|
||||||
|
2
|
||||||
|
);
|
||||||
|
if (context.cipher.card.expMonth[0] === "0") {
|
||||||
context.cipher.card.expMonth = context.cipher.card.expMonth.substr(1, 1);
|
context.cipher.card.expMonth = context.cipher.card.expMonth.substr(1, 1);
|
||||||
}
|
}
|
||||||
context.cipher.card.expYear = (context.importRecord[context.property] as string).substr(3, 4);
|
context.cipher.card.expYear = (context.importRecord[context.property] as string).substr(3, 4);
|
||||||
@@ -256,7 +341,10 @@ export abstract class OnePasswordCsvImporter extends BaseImporter implements Imp
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected setLoginPassword(context: CipherImportContext) {
|
protected setLoginPassword(context: CipherImportContext) {
|
||||||
if (this.isNullOrWhitespace(context.cipher.login.password) && context.lowerProperty === 'password') {
|
if (
|
||||||
|
this.isNullOrWhitespace(context.cipher.login.password) &&
|
||||||
|
context.lowerProperty === "password"
|
||||||
|
) {
|
||||||
context.cipher.login.password = context.importRecord[context.property];
|
context.cipher.login.password = context.importRecord[context.property];
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -264,7 +352,10 @@ export abstract class OnePasswordCsvImporter extends BaseImporter implements Imp
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected setLoginUsername(context: CipherImportContext) {
|
protected setLoginUsername(context: CipherImportContext) {
|
||||||
if (this.isNullOrWhitespace(context.cipher.login.username) && context.lowerProperty === 'username') {
|
if (
|
||||||
|
this.isNullOrWhitespace(context.cipher.login.username) &&
|
||||||
|
context.lowerProperty === "username"
|
||||||
|
) {
|
||||||
context.cipher.login.username = context.importRecord[context.property];
|
context.cipher.login.username = context.importRecord[context.property];
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -272,11 +363,14 @@ export abstract class OnePasswordCsvImporter extends BaseImporter implements Imp
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected setLoginUris(context: CipherImportContext) {
|
protected setLoginUris(context: CipherImportContext) {
|
||||||
if ((context.cipher.login.uris == null || context.cipher.login.uris.length === 0) && context.lowerProperty === 'urls') {
|
if (
|
||||||
|
(context.cipher.login.uris == null || context.cipher.login.uris.length === 0) &&
|
||||||
|
context.lowerProperty === "urls"
|
||||||
|
) {
|
||||||
const urls = context.importRecord[context.property].split(this.newLineRegex);
|
const urls = context.importRecord[context.property].split(this.newLineRegex);
|
||||||
context.cipher.login.uris = this.makeUriArray(urls);
|
context.cipher.login.uris = this.makeUriArray(urls);
|
||||||
return true;
|
return true;
|
||||||
} else if ((context.lowerProperty === 'url')) {
|
} else if (context.lowerProperty === "url") {
|
||||||
if (context.cipher.login.uris == null) {
|
if (context.cipher.login.uris == null) {
|
||||||
context.cipher.login.uris = [];
|
context.cipher.login.uris = [];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,28 +1,28 @@
|
|||||||
import { Importer } from '../importer';
|
import { Importer } from "../importer";
|
||||||
import { IgnoredProperties, OnePasswordCsvImporter } from './onepasswordCsvImporter';
|
import { IgnoredProperties, OnePasswordCsvImporter } from "./onepasswordCsvImporter";
|
||||||
|
|
||||||
import { CipherType } from '../../enums/cipherType';
|
import { CipherType } from "../../enums/cipherType";
|
||||||
import { CardView } from '../../models/view/cardView';
|
import { CardView } from "../../models/view/cardView";
|
||||||
import { CipherView } from '../../models/view/cipherView';
|
import { CipherView } from "../../models/view/cipherView";
|
||||||
import { IdentityView } from '../../models/view/identityView';
|
import { IdentityView } from "../../models/view/identityView";
|
||||||
|
|
||||||
export class OnePasswordMacCsvImporter extends OnePasswordCsvImporter implements Importer {
|
export class OnePasswordMacCsvImporter extends OnePasswordCsvImporter implements Importer {
|
||||||
setCipherType(value: any, cipher: CipherView) {
|
setCipherType(value: any, cipher: CipherView) {
|
||||||
const onePassType = this.getValueOrDefault(this.getProp(value, 'type'), 'Login');
|
const onePassType = this.getValueOrDefault(this.getProp(value, "type"), "Login");
|
||||||
switch (onePassType) {
|
switch (onePassType) {
|
||||||
case 'Credit Card':
|
case "Credit Card":
|
||||||
cipher.type = CipherType.Card;
|
cipher.type = CipherType.Card;
|
||||||
cipher.card = new CardView();
|
cipher.card = new CardView();
|
||||||
IgnoredProperties.push('type');
|
IgnoredProperties.push("type");
|
||||||
break;
|
break;
|
||||||
case 'Identity':
|
case "Identity":
|
||||||
cipher.type = CipherType.Identity;
|
cipher.type = CipherType.Identity;
|
||||||
cipher.identity = new IdentityView();
|
cipher.identity = new IdentityView();
|
||||||
IgnoredProperties.push('type');
|
IgnoredProperties.push("type");
|
||||||
break;
|
break;
|
||||||
case 'Login':
|
case "Login":
|
||||||
case 'Secure Note':
|
case "Secure Note":
|
||||||
IgnoredProperties.push('type');
|
IgnoredProperties.push("type");
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import { Importer } from '../importer';
|
import { Importer } from "../importer";
|
||||||
import { CipherImportContext } from './cipherImportContext';
|
import { CipherImportContext } from "./cipherImportContext";
|
||||||
import { OnePasswordCsvImporter } from './onepasswordCsvImporter';
|
import { OnePasswordCsvImporter } from "./onepasswordCsvImporter";
|
||||||
|
|
||||||
import { CipherType } from '../../enums/cipherType';
|
import { CipherType } from "../../enums/cipherType";
|
||||||
import { CardView } from '../../models/view/cardView';
|
import { CardView } from "../../models/view/cardView";
|
||||||
import { CipherView } from '../../models/view/cipherView';
|
import { CipherView } from "../../models/view/cipherView";
|
||||||
import { IdentityView } from '../../models/view/identityView';
|
import { IdentityView } from "../../models/view/identityView";
|
||||||
import { LoginView } from '../../models/view/loginView';
|
import { LoginView } from "../../models/view/loginView";
|
||||||
|
|
||||||
export class OnePasswordWinCsvImporter extends OnePasswordCsvImporter implements Importer {
|
export class OnePasswordWinCsvImporter extends OnePasswordCsvImporter implements Importer {
|
||||||
constructor() {
|
constructor() {
|
||||||
@@ -18,16 +18,20 @@ export class OnePasswordWinCsvImporter extends OnePasswordCsvImporter implements
|
|||||||
cipher.type = CipherType.Login;
|
cipher.type = CipherType.Login;
|
||||||
cipher.login = new LoginView();
|
cipher.login = new LoginView();
|
||||||
|
|
||||||
if (!this.isNullOrWhitespace(this.getPropByRegexp(value, /\d+: number/i)) &&
|
if (
|
||||||
!this.isNullOrWhitespace(this.getPropByRegexp(value, /\d+: expiry date/i))) {
|
!this.isNullOrWhitespace(this.getPropByRegexp(value, /\d+: number/i)) &&
|
||||||
|
!this.isNullOrWhitespace(this.getPropByRegexp(value, /\d+: expiry date/i))
|
||||||
|
) {
|
||||||
cipher.type = CipherType.Card;
|
cipher.type = CipherType.Card;
|
||||||
cipher.card = new CardView();
|
cipher.card = new CardView();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.isNullOrWhitespace(this.getPropByRegexp(value, /name \d+: first name/i)) ||
|
if (
|
||||||
|
!this.isNullOrWhitespace(this.getPropByRegexp(value, /name \d+: first name/i)) ||
|
||||||
!this.isNullOrWhitespace(this.getPropByRegexp(value, /name \d+: initial/i)) ||
|
!this.isNullOrWhitespace(this.getPropByRegexp(value, /name \d+: initial/i)) ||
|
||||||
!this.isNullOrWhitespace(this.getPropByRegexp(value, /name \d+: last name/i)) ||
|
!this.isNullOrWhitespace(this.getPropByRegexp(value, /name \d+: last name/i)) ||
|
||||||
!this.isNullOrWhitespace(this.getPropByRegexp(value, /internet \d+: email/i))) {
|
!this.isNullOrWhitespace(this.getPropByRegexp(value, /internet \d+: email/i))
|
||||||
|
) {
|
||||||
cipher.type = CipherType.Identity;
|
cipher.type = CipherType.Identity;
|
||||||
cipher.identity = new IdentityView();
|
cipher.identity = new IdentityView();
|
||||||
}
|
}
|
||||||
@@ -35,17 +39,20 @@ export class OnePasswordWinCsvImporter extends OnePasswordCsvImporter implements
|
|||||||
|
|
||||||
setIdentityAddress(context: CipherImportContext) {
|
setIdentityAddress(context: CipherImportContext) {
|
||||||
if (context.lowerProperty.match(/address \d+: address/i)) {
|
if (context.lowerProperty.match(/address \d+: address/i)) {
|
||||||
this.processKvp(context.cipher, 'address', context.importRecord[context.property]);
|
this.processKvp(context.cipher, "address", context.importRecord[context.property]);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
setCreditCardExpiry(context: CipherImportContext) {
|
setCreditCardExpiry(context: CipherImportContext) {
|
||||||
if (this.isNullOrWhitespace(context.cipher.card.expiration) && context.lowerProperty.includes('expiry date')) {
|
if (
|
||||||
const expSplit = (context.importRecord[context.property] as string).split('/');
|
this.isNullOrWhitespace(context.cipher.card.expiration) &&
|
||||||
|
context.lowerProperty.includes("expiry date")
|
||||||
|
) {
|
||||||
|
const expSplit = (context.importRecord[context.property] as string).split("/");
|
||||||
context.cipher.card.expMonth = expSplit[0];
|
context.cipher.card.expMonth = expSplit[0];
|
||||||
if (context.cipher.card.expMonth[0] === '0' && context.cipher.card.expMonth.length === 2) {
|
if (context.cipher.card.expMonth[0] === "0" && context.cipher.card.expMonth.length === 2) {
|
||||||
context.cipher.card.expMonth = context.cipher.card.expMonth.substr(1, 1);
|
context.cipher.card.expMonth = context.cipher.card.expMonth.substr(1, 1);
|
||||||
}
|
}
|
||||||
context.cipher.card.expYear = expSplit[2].length > 4 ? expSplit[2].substr(0, 4) : expSplit[2];
|
context.cipher.card.expYear = expSplit[2].length > 4 ? expSplit[2].substr(0, 4) : expSplit[2];
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import { BaseImporter } from './baseImporter';
|
import { BaseImporter } from "./baseImporter";
|
||||||
import { Importer } from './importer';
|
import { Importer } from "./importer";
|
||||||
|
|
||||||
import { ImportResult } from '../models/domain/importResult';
|
import { ImportResult } from "../models/domain/importResult";
|
||||||
|
|
||||||
import { CollectionView } from '../models/view/collectionView';
|
import { CollectionView } from "../models/view/collectionView";
|
||||||
import { FolderView } from '../models/view/folderView';
|
import { FolderView } from "../models/view/folderView";
|
||||||
|
|
||||||
export class PadlockCsvImporter extends BaseImporter implements Importer {
|
export class PadlockCsvImporter extends BaseImporter implements Importer {
|
||||||
parse(data: string): Promise<ImportResult> {
|
parse(data: string): Promise<ImportResult> {
|
||||||
@@ -16,7 +16,7 @@ export class PadlockCsvImporter extends BaseImporter implements Importer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let headers: string[] = null;
|
let headers: string[] = null;
|
||||||
results.forEach(value => {
|
results.forEach((value) => {
|
||||||
if (headers == null) {
|
if (headers == null) {
|
||||||
headers = value.map((v: string) => v);
|
headers = value.map((v: string) => v);
|
||||||
return;
|
return;
|
||||||
@@ -28,8 +28,8 @@ export class PadlockCsvImporter extends BaseImporter implements Importer {
|
|||||||
|
|
||||||
if (!this.isNullOrWhitespace(value[1])) {
|
if (!this.isNullOrWhitespace(value[1])) {
|
||||||
if (this.organization) {
|
if (this.organization) {
|
||||||
const tags = (value[1] as string).split(',');
|
const tags = (value[1] as string).split(",");
|
||||||
tags.forEach(tag => {
|
tags.forEach((tag) => {
|
||||||
tag = tag.trim();
|
tag = tag.trim();
|
||||||
let addCollection = true;
|
let addCollection = true;
|
||||||
let collectionIndex = result.collections.length;
|
let collectionIndex = result.collections.length;
|
||||||
@@ -51,14 +51,14 @@ export class PadlockCsvImporter extends BaseImporter implements Importer {
|
|||||||
result.collectionRelationships.push([result.ciphers.length, collectionIndex]);
|
result.collectionRelationships.push([result.ciphers.length, collectionIndex]);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
const tags = (value[1] as string).split(',');
|
const tags = (value[1] as string).split(",");
|
||||||
const tag = tags.length > 0 ? tags[0].trim() : null;
|
const tag = tags.length > 0 ? tags[0].trim() : null;
|
||||||
this.processFolder(result, tag);
|
this.processFolder(result, tag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const cipher = this.initLoginCipher();
|
const cipher = this.initLoginCipher();
|
||||||
cipher.name = this.getValueOrDefault(value[0], '--');
|
cipher.name = this.getValueOrDefault(value[0], "--");
|
||||||
|
|
||||||
for (let i = 2; i < value.length; i++) {
|
for (let i = 2; i < value.length; i++) {
|
||||||
const header = headers[i].trim().toLowerCase();
|
const header = headers[i].trim().toLowerCase();
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { BaseImporter } from './baseImporter';
|
import { BaseImporter } from "./baseImporter";
|
||||||
import { Importer } from './importer';
|
import { Importer } from "./importer";
|
||||||
|
|
||||||
import { ImportResult } from '../models/domain/importResult';
|
import { ImportResult } from "../models/domain/importResult";
|
||||||
|
|
||||||
export class PassKeepCsvImporter extends BaseImporter implements Importer {
|
export class PassKeepCsvImporter extends BaseImporter implements Importer {
|
||||||
parse(data: string): Promise<ImportResult> {
|
parse(data: string): Promise<ImportResult> {
|
||||||
@@ -12,15 +12,15 @@ export class PassKeepCsvImporter extends BaseImporter implements Importer {
|
|||||||
return Promise.resolve(result);
|
return Promise.resolve(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
results.forEach(value => {
|
results.forEach((value) => {
|
||||||
this.processFolder(result, this.getValue('category', value));
|
this.processFolder(result, this.getValue("category", value));
|
||||||
const cipher = this.initLoginCipher();
|
const cipher = this.initLoginCipher();
|
||||||
cipher.notes = this.getValue('description', value);
|
cipher.notes = this.getValue("description", value);
|
||||||
cipher.name = this.getValueOrDefault(this.getValue('title', value), '--');
|
cipher.name = this.getValueOrDefault(this.getValue("title", value), "--");
|
||||||
cipher.login.username = this.getValue('username', value);
|
cipher.login.username = this.getValue("username", value);
|
||||||
cipher.login.password = this.getValue('password', value);
|
cipher.login.password = this.getValue("password", value);
|
||||||
cipher.login.uris = this.makeUriArray(this.getValue('site', value));
|
cipher.login.uris = this.makeUriArray(this.getValue("site", value));
|
||||||
this.processKvp(cipher, 'Password 2', this.getValue('password2', value));
|
this.processKvp(cipher, "Password 2", this.getValue("password2", value));
|
||||||
this.cleanupCipher(cipher);
|
this.cleanupCipher(cipher);
|
||||||
result.ciphers.push(cipher);
|
result.ciphers.push(cipher);
|
||||||
});
|
});
|
||||||
@@ -34,6 +34,6 @@ export class PassKeepCsvImporter extends BaseImporter implements Importer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private getValue(key: string, value: any) {
|
private getValue(key: string, value: any) {
|
||||||
return this.getValueOrDefault(value[key], this.getValueOrDefault(value[(' ' + key)]));
|
return this.getValueOrDefault(value[key], this.getValueOrDefault(value[" " + key]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { BaseImporter } from './baseImporter';
|
import { BaseImporter } from "./baseImporter";
|
||||||
import { Importer } from './importer';
|
import { Importer } from "./importer";
|
||||||
|
|
||||||
import { ImportResult } from '../models/domain/importResult';
|
import { ImportResult } from "../models/domain/importResult";
|
||||||
|
|
||||||
export class PassmanJsonImporter extends BaseImporter implements Importer {
|
export class PassmanJsonImporter extends BaseImporter implements Importer {
|
||||||
parse(data: string): Promise<ImportResult> {
|
parse(data: string): Promise<ImportResult> {
|
||||||
@@ -25,12 +25,12 @@ export class PassmanJsonImporter extends BaseImporter implements Importer {
|
|||||||
if (this.isNullOrWhitespace(cipher.login.username)) {
|
if (this.isNullOrWhitespace(cipher.login.username)) {
|
||||||
cipher.login.username = this.getValueOrDefault(credential.email);
|
cipher.login.username = this.getValueOrDefault(credential.email);
|
||||||
} else if (!this.isNullOrWhitespace(credential.email)) {
|
} else if (!this.isNullOrWhitespace(credential.email)) {
|
||||||
cipher.notes = ('Email: ' + credential.email + '\n');
|
cipher.notes = "Email: " + credential.email + "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
cipher.login.password = this.getValueOrDefault(credential.password);
|
cipher.login.password = this.getValueOrDefault(credential.password);
|
||||||
cipher.login.uris = this.makeUriArray(credential.url);
|
cipher.login.uris = this.makeUriArray(credential.url);
|
||||||
cipher.notes += this.getValueOrDefault(credential.description, '');
|
cipher.notes += this.getValueOrDefault(credential.description, "");
|
||||||
if (credential.otp != null) {
|
if (credential.otp != null) {
|
||||||
cipher.login.totp = this.getValueOrDefault(credential.otp.secret);
|
cipher.login.totp = this.getValueOrDefault(credential.otp.secret);
|
||||||
}
|
}
|
||||||
@@ -38,8 +38,8 @@ export class PassmanJsonImporter extends BaseImporter implements Importer {
|
|||||||
if (credential.custom_fields != null) {
|
if (credential.custom_fields != null) {
|
||||||
credential.custom_fields.forEach((customField: any) => {
|
credential.custom_fields.forEach((customField: any) => {
|
||||||
switch (customField.field_type) {
|
switch (customField.field_type) {
|
||||||
case 'text':
|
case "text":
|
||||||
case 'password':
|
case "password":
|
||||||
this.processKvp(cipher, customField.label, customField.value);
|
this.processKvp(cipher, customField.label, customField.value);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user