mirror of
https://github.com/bitwarden/browser
synced 2025-12-11 13:53:34 +00:00
[Account Switching] [Refactor] Implement new account centric services (#1220)
* [chore] updated services.module to use account services * [refactor] sorted services provided by services.module * [chore] removed references to deleted jslib services * [chore] used activeAccount over storageService for account level storage items * [chore] resolved linter warnings * Refactor activeAccountService to stateService * [bug] Remove uneeded calls to state service on logout This was causing console erros on logout. Clearing of data is handled fully in dedicated services, clearing them in state afterwards is essentially a redundant call. * [bug] Add back null locked callback to VaultTimeoutService * Move call to get showUpdateKey * [bug] Ensure HtmlStorageService does not override StateService options and locations * [bug] Adjust theme logic to pull from the new storage locations * [bug] Correct theme not sticking on refresh * [bug] Add enableFullWidth to the account model * [bug] fix theme option empty when light is selected * [bug] init state on application start * [bug] Reinit state when coming back from a lock * [style] Fix lint complaints * [bug] Clean state on logout * [chore] Resolved merge issues * [bug] Correct default for enableGravitars * Bump angular to 12. * Remove angular.json * Bump rxjs * Fix build errors, remove file-loader with asset/resource * Use contenthash * Bump jslib * Bump ngx-toastr * [chore] resolve issues from merge * [chore] resolve issues from merge * [bug] Add missing bracket * Use newer import syntax * [bug] Correct service orge * [style] Fix lint complaints * [chore] update jslib * [review] Address code review * [review] Address code review * [review] Rename providerService to webProviderService Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com> Co-authored-by: Hinton <oscar@oscarhinton.com>
This commit is contained in:
@@ -7,8 +7,8 @@ import { ActivatedRoute } from '@angular/router';
|
|||||||
|
|
||||||
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 { OrganizationService } from 'jslib-common/abstractions/organization.service';
|
||||||
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
|
||||||
|
|
||||||
import { Organization } from 'jslib-common/models/domain/organization';
|
import { Organization } from 'jslib-common/models/domain/organization';
|
||||||
|
|
||||||
@@ -81,7 +81,7 @@ export class SsoComponent implements OnInit {
|
|||||||
|
|
||||||
constructor(private fb: FormBuilder, private route: ActivatedRoute, private apiService: ApiService,
|
constructor(private fb: FormBuilder, private route: ActivatedRoute, private apiService: ApiService,
|
||||||
private platformUtilsService: PlatformUtilsService, private i18nService: I18nService,
|
private platformUtilsService: PlatformUtilsService, private i18nService: I18nService,
|
||||||
private userService: UserService) { }
|
private organizationService: OrganizationService) { }
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
this.route.parent.parent.params.subscribe(async params => {
|
this.route.parent.parent.params.subscribe(async params => {
|
||||||
@@ -91,7 +91,7 @@ export class SsoComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async load() {
|
async load() {
|
||||||
this.organization = await this.userService.getOrganization(this.organizationId);
|
this.organization = await this.organizationService.get(this.organizationId);
|
||||||
const ssoSettings = await this.apiService.getOrganizationSso(this.organizationId);
|
const ssoSettings = await this.apiService.getOrganizationSso(this.organizationId);
|
||||||
|
|
||||||
this.data.patchValue(ssoSettings.data);
|
this.data.patchValue(ssoSettings.data);
|
||||||
|
|||||||
@@ -8,11 +8,11 @@ import {
|
|||||||
|
|
||||||
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 { UserService } from 'jslib-common/abstractions/user.service';
|
import { ProviderService } from 'jslib-common/abstractions/provider.service';
|
||||||
|
|
||||||
import { ValidationService } from 'jslib-angular/services/validation.service';
|
import { ValidationService } from 'jslib-angular/services/validation.service';
|
||||||
|
|
||||||
import { ProviderService } from '../services/provider.service';
|
import { WebProviderService } from '../services/webProvider.service';
|
||||||
|
|
||||||
import { Organization } from 'jslib-common/models/domain/organization';
|
import { Organization } from 'jslib-common/models/domain/organization';
|
||||||
import { Provider } from 'jslib-common/models/domain/provider';
|
import { Provider } from 'jslib-common/models/domain/provider';
|
||||||
@@ -31,9 +31,13 @@ export class AddOrganizationComponent implements OnInit {
|
|||||||
formPromise: Promise<any>;
|
formPromise: Promise<any>;
|
||||||
loading = true;
|
loading = true;
|
||||||
|
|
||||||
constructor(private userService: UserService, private providerService: ProviderService,
|
constructor(
|
||||||
private i18nService: I18nService, private platformUtilsService: PlatformUtilsService,
|
private providerService: ProviderService,
|
||||||
private validationService: ValidationService) { }
|
private webProviderService: WebProviderService,
|
||||||
|
private i18nService: I18nService,
|
||||||
|
private platformUtilsService: PlatformUtilsService,
|
||||||
|
private validationService: ValidationService
|
||||||
|
) { }
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
await this.load();
|
await this.load();
|
||||||
@@ -44,7 +48,7 @@ export class AddOrganizationComponent implements OnInit {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.provider = await this.userService.getProvider(this.providerId);
|
this.provider = await this.providerService.get(this.providerId);
|
||||||
|
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
}
|
}
|
||||||
@@ -63,7 +67,7 @@ export class AddOrganizationComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.formPromise = this.providerService.addOrganizationToProvider(this.providerId, organization.id);
|
this.formPromise = this.webProviderService.addOrganizationToProvider(this.providerId, organization.id);
|
||||||
await this.formPromise;
|
await this.formPromise;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.validationService.showError(e);
|
this.validationService.showError(e);
|
||||||
|
|||||||
@@ -11,9 +11,10 @@ import { first } from 'rxjs/operators';
|
|||||||
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 { OrganizationService } from 'jslib-common/abstractions/organization.service';
|
||||||
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
||||||
|
import { ProviderService } from 'jslib-common/abstractions/provider.service';
|
||||||
import { SearchService } from 'jslib-common/abstractions/search.service';
|
import { SearchService } from 'jslib-common/abstractions/search.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
|
||||||
|
|
||||||
import { ModalService } from 'jslib-angular/services/modal.service';
|
import { ModalService } from 'jslib-angular/services/modal.service';
|
||||||
import { ValidationService } from 'jslib-angular/services/validation.service';
|
import { ValidationService } from 'jslib-angular/services/validation.service';
|
||||||
@@ -26,7 +27,7 @@ import {
|
|||||||
ProviderOrganizationOrganizationDetailsResponse
|
ProviderOrganizationOrganizationDetailsResponse
|
||||||
} from 'jslib-common/models/response/provider/providerOrganizationResponse';
|
} from 'jslib-common/models/response/provider/providerOrganizationResponse';
|
||||||
|
|
||||||
import { ProviderService } from '../services/provider.service';
|
import { WebProviderService } from '../services/webProvider.service';
|
||||||
|
|
||||||
import { AddOrganizationComponent } from './add-organization.component';
|
import { AddOrganizationComponent } from './add-organization.component';
|
||||||
|
|
||||||
@@ -54,11 +55,19 @@ export class ClientsComponent implements OnInit {
|
|||||||
protected actionPromise: Promise<any>;
|
protected actionPromise: Promise<any>;
|
||||||
private pagedClientsCount = 0;
|
private pagedClientsCount = 0;
|
||||||
|
|
||||||
constructor(private route: ActivatedRoute, private userService: UserService,
|
constructor(
|
||||||
private apiService: ApiService, private searchService: SearchService,
|
private route: ActivatedRoute,
|
||||||
private platformUtilsService: PlatformUtilsService, private i18nService: I18nService,
|
private providerService: ProviderService,
|
||||||
private validationService: ValidationService, private providerService: ProviderService,
|
private apiService: ApiService,
|
||||||
private logService: LogService, private modalService: ModalService) { }
|
private searchService: SearchService,
|
||||||
|
private platformUtilsService: PlatformUtilsService,
|
||||||
|
private i18nService: I18nService,
|
||||||
|
private validationService: ValidationService,
|
||||||
|
private webProviderService: WebProviderService,
|
||||||
|
private logService: LogService,
|
||||||
|
private modalService: ModalService,
|
||||||
|
private organizationService: OrganizationService
|
||||||
|
) { }
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
this.route.parent.params.subscribe(async params => {
|
this.route.parent.params.subscribe(async params => {
|
||||||
@@ -75,8 +84,8 @@ export class ClientsComponent implements OnInit {
|
|||||||
async load() {
|
async load() {
|
||||||
const response = await this.apiService.getProviderClients(this.providerId);
|
const response = await this.apiService.getProviderClients(this.providerId);
|
||||||
this.clients = response.data != null && response.data.length > 0 ? response.data : [];
|
this.clients = response.data != null && response.data.length > 0 ? response.data : [];
|
||||||
this.manageOrganizations = (await this.userService.getProvider(this.providerId)).type === ProviderUserType.ProviderAdmin;
|
this.manageOrganizations = (await this.providerService.get(this.providerId)).type === ProviderUserType.ProviderAdmin;
|
||||||
const candidateOrgs = (await this.userService.getAllOrganizations()).filter(o => o.isOwner && o.providerId == null);
|
const candidateOrgs = (await this.organizationService.getAll()).filter(o => o.isOwner && o.providerId == null);
|
||||||
const allowedOrgsIds = await Promise.all(candidateOrgs.map(o => this.apiService.getOrganization(o.id))).then(orgs =>
|
const allowedOrgsIds = await Promise.all(candidateOrgs.map(o => this.apiService.getOrganization(o.id))).then(orgs =>
|
||||||
orgs.filter(o => !DisallowedPlanTypes.includes(o.planType))
|
orgs.filter(o => !DisallowedPlanTypes.includes(o.planType))
|
||||||
.map(o => o.id));
|
.map(o => o.id));
|
||||||
@@ -144,7 +153,7 @@ export class ClientsComponent implements OnInit {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.actionPromise = this.providerService.detachOrganizastion(this.providerId, organization.id);
|
this.actionPromise = this.webProviderService.detachOrganizastion(this.providerId, organization.id);
|
||||||
try {
|
try {
|
||||||
await this.actionPromise;
|
await this.actionPromise;
|
||||||
this.platformUtilsService.showToast('success', null,
|
this.platformUtilsService.showToast('success', null,
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ 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 { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
||||||
import { StateService } from 'jslib-common/abstractions/state.service';
|
import { StateService } from 'jslib-common/abstractions/state.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
|
||||||
import { ProviderUserAcceptRequest } from 'jslib-common/models/request/provider/providerUserAcceptRequest';
|
import { ProviderUserAcceptRequest } from 'jslib-common/models/request/provider/providerUserAcceptRequest';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -22,10 +21,15 @@ export class AcceptProviderComponent extends BaseAcceptComponent {
|
|||||||
|
|
||||||
requiredParameters = ['providerId', 'providerUserId', 'token'];
|
requiredParameters = ['providerId', 'providerUserId', 'token'];
|
||||||
|
|
||||||
constructor(router: Router, i18nService: I18nService, route: ActivatedRoute,
|
constructor(
|
||||||
userService: UserService, stateService: StateService, private apiService: ApiService,
|
router: Router,
|
||||||
platformUtilService: PlatformUtilsService) {
|
i18nService: I18nService,
|
||||||
super(router, platformUtilService, i18nService, route, userService, stateService);
|
route: ActivatedRoute,
|
||||||
|
stateService: StateService,
|
||||||
|
private apiService: ApiService,
|
||||||
|
platformUtilService: PlatformUtilsService,
|
||||||
|
) {
|
||||||
|
super(router, platformUtilService, i18nService, route, stateService);
|
||||||
}
|
}
|
||||||
|
|
||||||
async authedHandler(qParams: any) {
|
async authedHandler(qParams: any) {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ 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 { UserService } from 'jslib-common/abstractions/user.service';
|
import { ProviderService } from 'jslib-common/abstractions/provider.service';
|
||||||
|
|
||||||
import { UserNamePipe } from 'jslib-angular/pipes/user-name.pipe';
|
import { UserNamePipe } from 'jslib-angular/pipes/user-name.pipe';
|
||||||
|
|
||||||
@@ -30,17 +30,31 @@ export class EventsComponent extends BaseEventsComponent implements OnInit {
|
|||||||
private providerUsersUserIdMap = new Map<string, any>();
|
private providerUsersUserIdMap = new Map<string, any>();
|
||||||
private providerUsersIdMap = new Map<string, any>();
|
private providerUsersIdMap = new Map<string, any>();
|
||||||
|
|
||||||
constructor(private apiService: ApiService, private route: ActivatedRoute, eventService: EventService,
|
constructor(
|
||||||
i18nService: I18nService, private userService: UserService, exportService: ExportService,
|
private apiService: ApiService,
|
||||||
platformUtilsService: PlatformUtilsService, private router: Router, logService: LogService,
|
private route: ActivatedRoute,
|
||||||
private userNamePipe: UserNamePipe) {
|
eventService: EventService,
|
||||||
super(eventService, i18nService, exportService, platformUtilsService, logService);
|
i18nService: I18nService,
|
||||||
|
private providerService: ProviderService,
|
||||||
|
exportService: ExportService,
|
||||||
|
platformUtilsService: PlatformUtilsService,
|
||||||
|
private router: Router,
|
||||||
|
logService: LogService,
|
||||||
|
private userNamePipe: UserNamePipe,
|
||||||
|
) {
|
||||||
|
super(
|
||||||
|
eventService,
|
||||||
|
i18nService,
|
||||||
|
exportService,
|
||||||
|
platformUtilsService,
|
||||||
|
logService,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
this.route.parent.parent.params.subscribe(async params => {
|
this.route.parent.parent.params.subscribe(async params => {
|
||||||
this.providerId = params.providerId;
|
this.providerId = params.providerId;
|
||||||
const provider = await this.userService.getProvider(this.providerId);
|
const provider = await this.providerService.get(this.providerId);
|
||||||
if (provider == null || !provider.useEvents) {
|
if (provider == null || !provider.useEvents) {
|
||||||
this.router.navigate(['/providers', this.providerId]);
|
this.router.navigate(['/providers', this.providerId]);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import {
|
|||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
import { ActivatedRoute } from '@angular/router';
|
import { ActivatedRoute } from '@angular/router';
|
||||||
|
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
import { ProviderService } from 'jslib-common/abstractions/provider.service';
|
||||||
|
|
||||||
import { Provider } from 'jslib-common/models/domain/provider';
|
import { Provider } from 'jslib-common/models/domain/provider';
|
||||||
|
|
||||||
@@ -16,11 +16,11 @@ export class ManageComponent implements OnInit {
|
|||||||
provider: Provider;
|
provider: Provider;
|
||||||
accessEvents = false;
|
accessEvents = false;
|
||||||
|
|
||||||
constructor(private route: ActivatedRoute, private userService: UserService) { }
|
constructor(private route: ActivatedRoute, private providerService: ProviderService) { }
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.route.parent.params.subscribe(async params => {
|
this.route.parent.params.subscribe(async params => {
|
||||||
this.provider = await this.userService.getProvider(params.providerId);
|
this.provider = await this.providerService.get(params.providerId);
|
||||||
this.accessEvents = this.provider.useEvents;
|
this.accessEvents = this.provider.useEvents;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,9 +13,9 @@ 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 { 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 { ProviderService } from 'jslib-common/abstractions/provider.service';
|
||||||
import { SearchService } from 'jslib-common/abstractions/search.service';
|
import { SearchService } from 'jslib-common/abstractions/search.service';
|
||||||
import { StorageService } from 'jslib-common/abstractions/storage.service';
|
import { StateService } from 'jslib-common/abstractions/state.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
|
||||||
|
|
||||||
import { ModalService } from 'jslib-angular/services/modal.service';
|
import { ModalService } from 'jslib-angular/services/modal.service';
|
||||||
import { ValidationService } from 'jslib-angular/services/validation.service';
|
import { ValidationService } from 'jslib-angular/services/validation.service';
|
||||||
@@ -58,20 +58,41 @@ export class PeopleComponent extends BasePeopleComponent<ProviderUserUserDetails
|
|||||||
providerId: string;
|
providerId: string;
|
||||||
accessEvents = false;
|
accessEvents = false;
|
||||||
|
|
||||||
constructor(apiService: ApiService, private route: ActivatedRoute,
|
constructor(
|
||||||
i18nService: I18nService, modalService: ModalService,
|
apiService: ApiService,
|
||||||
|
private route: ActivatedRoute,
|
||||||
|
i18nService: I18nService,
|
||||||
|
modalService: ModalService,
|
||||||
platformUtilsService: PlatformUtilsService,
|
platformUtilsService: PlatformUtilsService,
|
||||||
cryptoService: CryptoService, private userService: UserService, private router: Router,
|
cryptoService: CryptoService,
|
||||||
storageService: StorageService, searchService: SearchService, validationService: ValidationService,
|
private router: Router,
|
||||||
logService: LogService, searchPipe: SearchPipe, userNamePipe: UserNamePipe) {
|
searchService: SearchService,
|
||||||
super(apiService, searchService, i18nService, platformUtilsService, cryptoService,
|
validationService: ValidationService,
|
||||||
storageService, validationService, modalService, logService, searchPipe, userNamePipe);
|
logService: LogService,
|
||||||
|
searchPipe: SearchPipe,
|
||||||
|
userNamePipe: UserNamePipe,
|
||||||
|
stateService: StateService,
|
||||||
|
private providerService: ProviderService,
|
||||||
|
) {
|
||||||
|
super(
|
||||||
|
apiService,
|
||||||
|
searchService,
|
||||||
|
i18nService,
|
||||||
|
platformUtilsService,
|
||||||
|
cryptoService,
|
||||||
|
validationService,
|
||||||
|
modalService,
|
||||||
|
logService,
|
||||||
|
searchPipe,
|
||||||
|
userNamePipe,
|
||||||
|
stateService,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.route.parent.params.subscribe(async params => {
|
this.route.parent.params.subscribe(async params => {
|
||||||
this.providerId = params.providerId;
|
this.providerId = params.providerId;
|
||||||
const provider = await this.userService.getProvider(this.providerId);
|
const provider = await this.providerService.get(this.providerId);
|
||||||
|
|
||||||
if (!provider.canManageUsers) {
|
if (!provider.canManageUsers) {
|
||||||
this.router.navigate(['../'], { relativeTo: this.route });
|
this.router.navigate(['../'], { relativeTo: this.route });
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { ActivatedRoute } from '@angular/router';
|
import { ActivatedRoute } from '@angular/router';
|
||||||
|
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
import { ProviderService } from 'jslib-common/abstractions/provider.service';
|
||||||
|
|
||||||
import { Provider } from 'jslib-common/models/domain/provider';
|
import { Provider } from 'jslib-common/models/domain/provider';
|
||||||
|
|
||||||
@@ -14,7 +14,7 @@ export class ProvidersLayoutComponent {
|
|||||||
provider: Provider;
|
provider: Provider;
|
||||||
private providerId: string;
|
private providerId: string;
|
||||||
|
|
||||||
constructor(private route: ActivatedRoute, private userService: UserService) { }
|
constructor(private route: ActivatedRoute, private providerService: ProviderService) { }
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
document.body.classList.remove('layout_frontend');
|
document.body.classList.remove('layout_frontend');
|
||||||
@@ -25,7 +25,7 @@ export class ProvidersLayoutComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async load() {
|
async load() {
|
||||||
this.provider = await this.userService.getProvider(this.providerId);
|
this.provider = await this.providerService.get(this.providerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
get showMenuBar() {
|
get showMenuBar() {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { ModalService } from 'jslib-angular/services/modal.service';
|
|||||||
|
|
||||||
import { ProviderGuardService } from './services/provider-guard.service';
|
import { ProviderGuardService } from './services/provider-guard.service';
|
||||||
import { ProviderTypeGuardService } from './services/provider-type-guard.service';
|
import { ProviderTypeGuardService } from './services/provider-type-guard.service';
|
||||||
import { ProviderService } from './services/provider.service';
|
import { WebProviderService } from './services/webProvider.service';
|
||||||
|
|
||||||
import { ProvidersLayoutComponent } from './providers-layout.component';
|
import { ProvidersLayoutComponent } from './providers-layout.component';
|
||||||
import { ProvidersRoutingModule } from './providers-routing.module';
|
import { ProvidersRoutingModule } from './providers-routing.module';
|
||||||
@@ -57,7 +57,7 @@ import { OssModule } from 'src/app/oss.module';
|
|||||||
UserAddEditComponent,
|
UserAddEditComponent,
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
ProviderService,
|
WebProviderService,
|
||||||
ProviderGuardService,
|
ProviderGuardService,
|
||||||
ProviderTypeGuardService,
|
ProviderTypeGuardService,
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -7,15 +7,19 @@ import {
|
|||||||
|
|
||||||
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 { UserService } from 'jslib-common/abstractions/user.service';
|
import { ProviderService } from 'jslib-common/abstractions/provider.service';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ProviderGuardService implements CanActivate {
|
export class ProviderGuardService implements CanActivate {
|
||||||
constructor(private userService: UserService, private router: Router,
|
constructor(
|
||||||
private platformUtilsService: PlatformUtilsService, private i18nService: I18nService) { }
|
private router: Router,
|
||||||
|
private platformUtilsService: PlatformUtilsService,
|
||||||
|
private i18nService: I18nService,
|
||||||
|
private providerService: ProviderService,
|
||||||
|
) { }
|
||||||
|
|
||||||
async canActivate(route: ActivatedRouteSnapshot) {
|
async canActivate(route: ActivatedRouteSnapshot) {
|
||||||
const provider = await this.userService.getProvider(route.params.providerId);
|
const provider = await this.providerService.get(route.params.providerId);
|
||||||
if (provider == null) {
|
if (provider == null) {
|
||||||
this.router.navigate(['/']);
|
this.router.navigate(['/']);
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -5,16 +5,16 @@ import {
|
|||||||
Router,
|
Router,
|
||||||
} from '@angular/router';
|
} from '@angular/router';
|
||||||
|
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
import { ProviderService } from 'jslib-common/abstractions/provider.service';
|
||||||
|
|
||||||
import { Permissions } from 'jslib-common/enums/permissions';
|
import { Permissions } from 'jslib-common/enums/permissions';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ProviderTypeGuardService implements CanActivate {
|
export class ProviderTypeGuardService implements CanActivate {
|
||||||
constructor(private userService: UserService, private router: Router) { }
|
constructor(private providerService: ProviderService, private router: Router) { }
|
||||||
|
|
||||||
async canActivate(route: ActivatedRouteSnapshot) {
|
async canActivate(route: ActivatedRouteSnapshot) {
|
||||||
const provider = await this.userService.getProvider(route.params.providerId);
|
const provider = await this.providerService.get(route.params.providerId);
|
||||||
const permissions = route.data == null ? null : route.data.permissions as Permissions[];
|
const permissions = route.data == null ? null : route.data.permissions as Permissions[];
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { SyncService } from 'jslib-common/abstractions/sync.service';
|
|||||||
import { ProviderAddOrganizationRequest } from 'jslib-common/models/request/provider/providerAddOrganizationRequest';
|
import { ProviderAddOrganizationRequest } from 'jslib-common/models/request/provider/providerAddOrganizationRequest';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ProviderService {
|
export class WebProviderService {
|
||||||
constructor(private cryptoService: CryptoService, private syncService: SyncService, private apiService: ApiService) {}
|
constructor(private cryptoService: CryptoService, private syncService: SyncService, private apiService: ApiService) {}
|
||||||
|
|
||||||
async addOrganizationToProvider(providerId: string, organizationId: string) {
|
async addOrganizationToProvider(providerId: string, organizationId: string) {
|
||||||
@@ -2,19 +2,19 @@ import { Component } from '@angular/core';
|
|||||||
import { ActivatedRoute } from '@angular/router';
|
import { ActivatedRoute } from '@angular/router';
|
||||||
|
|
||||||
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
import { ProviderService } from 'jslib-common/abstractions/provider.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'provider-settings',
|
selector: 'provider-settings',
|
||||||
templateUrl: 'settings.component.html',
|
templateUrl: 'settings.component.html',
|
||||||
})
|
})
|
||||||
export class SettingsComponent {
|
export class SettingsComponent {
|
||||||
constructor(private route: ActivatedRoute, private userService: UserService,
|
constructor(private route: ActivatedRoute, private providerService: ProviderService,
|
||||||
private platformUtilsService: PlatformUtilsService) { }
|
private platformUtilsService: PlatformUtilsService) { }
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.route.parent.params.subscribe(async params => {
|
this.route.parent.params.subscribe(async params => {
|
||||||
const provider = await this.userService.getProvider(params.providerId);
|
const provider = await this.providerService.get(params.providerId);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
2
jslib
2
jslib
Submodule jslib updated: 8fc3cf50d2...f90b3456d5
@@ -8,7 +8,6 @@ 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 { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
||||||
import { StateService } from 'jslib-common/abstractions/state.service';
|
import { StateService } from 'jslib-common/abstractions/state.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
|
||||||
import { EmergencyAccessAcceptRequest } from 'jslib-common/models/request/emergencyAccessAcceptRequest';
|
import { EmergencyAccessAcceptRequest } from 'jslib-common/models/request/emergencyAccessAcceptRequest';
|
||||||
import { BaseAcceptComponent } from '../common/base.accept.component';
|
import { BaseAcceptComponent } from '../common/base.accept.component';
|
||||||
|
|
||||||
@@ -24,11 +23,21 @@ export class AcceptEmergencyComponent extends BaseAcceptComponent {
|
|||||||
protected failedShortMessage = 'emergencyInviteAcceptFailedShort';
|
protected failedShortMessage = 'emergencyInviteAcceptFailedShort';
|
||||||
protected failedMessage = 'emergencyInviteAcceptFailed';
|
protected failedMessage = 'emergencyInviteAcceptFailed';
|
||||||
|
|
||||||
constructor(router: Router, platformUtilsService: PlatformUtilsService,
|
constructor(
|
||||||
i18nService: I18nService, route: ActivatedRoute,
|
router: Router,
|
||||||
private apiService: ApiService, userService: UserService,
|
platformUtilsService: PlatformUtilsService,
|
||||||
stateService: StateService) {
|
i18nService: I18nService,
|
||||||
super(router, platformUtilsService, i18nService, route, userService, stateService);
|
route: ActivatedRoute,
|
||||||
|
private apiService: ApiService,
|
||||||
|
stateService: StateService
|
||||||
|
) {
|
||||||
|
super(
|
||||||
|
router,
|
||||||
|
platformUtilsService,
|
||||||
|
i18nService,
|
||||||
|
route,
|
||||||
|
stateService
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async authedHandler(qParams: any): Promise<void> {
|
async authedHandler(qParams: any): Promise<void> {
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ 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 { StateService } from 'jslib-common/abstractions/state.service';
|
import { StateService } from 'jslib-common/abstractions/state.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
|
||||||
|
|
||||||
import { OrganizationUserAcceptRequest } from 'jslib-common/models/request/organizationUserAcceptRequest';
|
import { OrganizationUserAcceptRequest } from 'jslib-common/models/request/organizationUserAcceptRequest';
|
||||||
import { OrganizationUserResetPasswordEnrollmentRequest } from 'jslib-common/models/request/organizationUserResetPasswordEnrollmentRequest';
|
import { OrganizationUserResetPasswordEnrollmentRequest } from 'jslib-common/models/request/organizationUserResetPasswordEnrollmentRequest';
|
||||||
@@ -29,12 +28,24 @@ export class AcceptOrganizationComponent extends BaseAcceptComponent {
|
|||||||
|
|
||||||
protected requiredParameters: string[] = ['organizationId', 'organizationUserId', 'token'];
|
protected requiredParameters: string[] = ['organizationId', 'organizationUserId', 'token'];
|
||||||
|
|
||||||
constructor(router: Router, platformUtilsService: PlatformUtilsService,
|
constructor(
|
||||||
i18nService: I18nService, route: ActivatedRoute,
|
router: Router,
|
||||||
private apiService: ApiService, userService: UserService,
|
platformUtilsService: PlatformUtilsService,
|
||||||
stateService: StateService, private cryptoService: CryptoService,
|
i18nService: I18nService,
|
||||||
private policyService: PolicyService, private logService: LogService) {
|
route: ActivatedRoute,
|
||||||
super(router, platformUtilsService, i18nService, route, userService, stateService);
|
private apiService: ApiService,
|
||||||
|
stateService: StateService,
|
||||||
|
private cryptoService: CryptoService,
|
||||||
|
private policyService: PolicyService,
|
||||||
|
private logService: LogService
|
||||||
|
) {
|
||||||
|
super(
|
||||||
|
router,
|
||||||
|
platformUtilsService,
|
||||||
|
i18nService,
|
||||||
|
route,
|
||||||
|
stateService
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async authedHandler(qParams: any): Promise<void> {
|
async authedHandler(qParams: any): Promise<void> {
|
||||||
@@ -60,10 +71,7 @@ export class AcceptOrganizationComponent extends BaseAcceptComponent {
|
|||||||
const resetRequest = new OrganizationUserResetPasswordEnrollmentRequest();
|
const resetRequest = new OrganizationUserResetPasswordEnrollmentRequest();
|
||||||
resetRequest.resetPasswordKey = encryptedKey.encryptedString;
|
resetRequest.resetPasswordKey = encryptedKey.encryptedString;
|
||||||
|
|
||||||
// Get User Id
|
return this.apiService.putOrganizationUserResetPasswordEnrollment(qParams.organizationId, await this.stateService.getUserId(), resetRequest);
|
||||||
const userId = await this.userService.getUserId();
|
|
||||||
|
|
||||||
return this.apiService.putOrganizationUserResetPasswordEnrollment(qParams.organizationId, userId, resetRequest);
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.actionPromise = this.apiService.postOrganizationUserAccept(qParams.organizationId,
|
this.actionPromise = this.apiService.postOrganizationUserAccept(qParams.organizationId,
|
||||||
@@ -74,7 +82,7 @@ export class AcceptOrganizationComponent extends BaseAcceptComponent {
|
|||||||
this.platformUtilService.showToast('success', this.i18nService.t('inviteAccepted'),
|
this.platformUtilService.showToast('success', this.i18nService.t('inviteAccepted'),
|
||||||
this.i18nService.t('inviteAcceptedDesc'), {timeout: 10000});
|
this.i18nService.t('inviteAcceptedDesc'), {timeout: 10000});
|
||||||
|
|
||||||
await this.stateService.remove('orgInvitation');
|
await this.stateService.setOrganizationInvitation(null);
|
||||||
this.router.navigate(['/vault']);
|
this.router.navigate(['/vault']);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,7 +92,7 @@ export class AcceptOrganizationComponent extends BaseAcceptComponent {
|
|||||||
// Fix URL encoding of space issue with Angular
|
// Fix URL encoding of space issue with Angular
|
||||||
this.orgName = this.orgName.replace(/\+/g, ' ');
|
this.orgName = this.orgName.replace(/\+/g, ' ');
|
||||||
}
|
}
|
||||||
await this.stateService.save('orgInvitation', qParams);
|
await this.stateService.setOrganizationInvitation(qParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async performResetPasswordAutoEnroll(qParams: any): Promise<boolean> {
|
private async performResetPasswordAutoEnroll(qParams: any): Promise<boolean> {
|
||||||
|
|||||||
@@ -13,8 +13,6 @@ import { LogService } from 'jslib-common/abstractions/log.service';
|
|||||||
import { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
import { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
||||||
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
||||||
import { StateService } from 'jslib-common/abstractions/state.service';
|
import { StateService } from 'jslib-common/abstractions/state.service';
|
||||||
import { StorageService } from 'jslib-common/abstractions/storage.service';
|
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
|
||||||
import { VaultTimeoutService } from 'jslib-common/abstractions/vaultTimeout.service';
|
import { VaultTimeoutService } from 'jslib-common/abstractions/vaultTimeout.service';
|
||||||
|
|
||||||
import { RouterService } from '../services/router.service';
|
import { RouterService } from '../services/router.service';
|
||||||
@@ -28,19 +26,18 @@ import { LockComponent as BaseLockComponent } from 'jslib-angular/components/loc
|
|||||||
export class LockComponent extends BaseLockComponent {
|
export class LockComponent extends BaseLockComponent {
|
||||||
constructor(router: Router, i18nService: I18nService,
|
constructor(router: Router, i18nService: I18nService,
|
||||||
platformUtilsService: PlatformUtilsService, messagingService: MessagingService,
|
platformUtilsService: PlatformUtilsService, messagingService: MessagingService,
|
||||||
userService: UserService, cryptoService: CryptoService,
|
cryptoService: CryptoService, vaultTimeoutService: VaultTimeoutService,
|
||||||
storageService: StorageService, vaultTimeoutService: VaultTimeoutService,
|
|
||||||
environmentService: EnvironmentService, private routerService: RouterService,
|
environmentService: EnvironmentService, private routerService: RouterService,
|
||||||
stateService: StateService, apiService: ApiService, logService: LogService,
|
stateService: StateService, apiService: ApiService, logService: LogService,
|
||||||
keyConnectorService: KeyConnectorService, ngZone: NgZone) {
|
keyConnectorService: KeyConnectorService, ngZone: NgZone) {
|
||||||
super(router, i18nService, platformUtilsService, messagingService, userService, cryptoService,
|
super(router, i18nService, platformUtilsService, messagingService, cryptoService,
|
||||||
storageService, vaultTimeoutService, environmentService, stateService, apiService, logService,
|
vaultTimeoutService, environmentService, stateService, apiService, logService,
|
||||||
keyConnectorService, ngZone);
|
keyConnectorService, ngZone);
|
||||||
}
|
}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
await super.ngOnInit();
|
await super.ngOnInit();
|
||||||
this.onSuccessfulSubmit = () => {
|
this.onSuccessfulSubmit = async () => {
|
||||||
const previousUrl = this.routerService.getPreviousUrl();
|
const previousUrl = this.routerService.getPreviousUrl();
|
||||||
if (previousUrl !== '/' && previousUrl.indexOf('lock') === -1) {
|
if (previousUrl !== '/' && previousUrl.indexOf('lock') === -1) {
|
||||||
this.successRoute = previousUrl;
|
this.successRoute = previousUrl;
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ import { PasswordGenerationService } from 'jslib-common/abstractions/passwordGen
|
|||||||
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 { StateService } from 'jslib-common/abstractions/state.service';
|
import { StateService } from 'jslib-common/abstractions/state.service';
|
||||||
import { StorageService } from 'jslib-common/abstractions/storage.service';
|
|
||||||
|
|
||||||
import { LoginComponent as BaseLoginComponent } from 'jslib-angular/components/login.component';
|
import { LoginComponent as BaseLoginComponent } from 'jslib-angular/components/login.component';
|
||||||
|
|
||||||
@@ -34,8 +33,7 @@ export class LoginComponent extends BaseLoginComponent {
|
|||||||
showResetPasswordAutoEnrollWarning = false;
|
showResetPasswordAutoEnrollWarning = false;
|
||||||
|
|
||||||
constructor(authService: AuthService, router: Router,
|
constructor(authService: AuthService, router: Router,
|
||||||
i18nService: I18nService, private route: ActivatedRoute,
|
i18nService: I18nService, private route: ActivatedRoute, stateService: StateService,
|
||||||
storageService: StorageService, stateService: StateService,
|
|
||||||
platformUtilsService: PlatformUtilsService, environmentService: EnvironmentService,
|
platformUtilsService: PlatformUtilsService, environmentService: EnvironmentService,
|
||||||
passwordGenerationService: PasswordGenerationService, cryptoFunctionService: CryptoFunctionService,
|
passwordGenerationService: PasswordGenerationService, cryptoFunctionService: CryptoFunctionService,
|
||||||
private apiService: ApiService, private policyService: PolicyService, logService: LogService,
|
private apiService: ApiService, private policyService: PolicyService, logService: LogService,
|
||||||
@@ -44,7 +42,7 @@ export class LoginComponent extends BaseLoginComponent {
|
|||||||
platformUtilsService, i18nService,
|
platformUtilsService, i18nService,
|
||||||
stateService, environmentService,
|
stateService, environmentService,
|
||||||
passwordGenerationService, cryptoFunctionService,
|
passwordGenerationService, cryptoFunctionService,
|
||||||
storageService, logService, ngZone);
|
logService, ngZone);
|
||||||
this.onSuccessfulLoginNavigate = this.goAfterLogIn;
|
this.onSuccessfulLoginNavigate = this.goAfterLogIn;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,16 +52,16 @@ export class LoginComponent extends BaseLoginComponent {
|
|||||||
this.email = qParams.email;
|
this.email = qParams.email;
|
||||||
}
|
}
|
||||||
if (qParams.premium != null) {
|
if (qParams.premium != null) {
|
||||||
this.stateService.save('loginRedirect', { route: '/settings/premium' });
|
this.stateService.setLoginRedirect({ route: '/settings/premium' });
|
||||||
} else if (qParams.org != null) {
|
} else if (qParams.org != null) {
|
||||||
this.stateService.save('loginRedirect',
|
this.stateService.setLoginRedirect(
|
||||||
{ route: '/settings/create-organization', qParams: { plan: qParams.org } });
|
{ route: '/settings/create-organization', qParams: { plan: qParams.org } });
|
||||||
}
|
}
|
||||||
|
|
||||||
// Are they coming from an email for sponsoring a families organization
|
// Are they coming from an email for sponsoring a families organization
|
||||||
if (qParams.sponsorshipToken != null) {
|
if (qParams.sponsorshipToken != null) {
|
||||||
// After logging in redirect them to setup the families sponsorship
|
// After logging in redirect them to setup the families sponsorship
|
||||||
this.stateService.save('loginRedirect', {
|
this.stateService.setLoginRedirect({
|
||||||
route: '/setup/families-for-enterprise',
|
route: '/setup/families-for-enterprise',
|
||||||
qParams: { token: qParams.sponsorshipToken },
|
qParams: { token: qParams.sponsorshipToken },
|
||||||
});
|
});
|
||||||
@@ -71,7 +69,7 @@ export class LoginComponent extends BaseLoginComponent {
|
|||||||
await super.ngOnInit();
|
await super.ngOnInit();
|
||||||
});
|
});
|
||||||
|
|
||||||
const invite = await this.stateService.get<any>('orgInvitation');
|
const invite = await this.stateService.getOrganizationInvitation();
|
||||||
if (invite != null) {
|
if (invite != null) {
|
||||||
let policyList: Policy[] = null;
|
let policyList: Policy[] = null;
|
||||||
try {
|
try {
|
||||||
@@ -91,10 +89,10 @@ export class LoginComponent extends BaseLoginComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async goAfterLogIn() {
|
async goAfterLogIn() {
|
||||||
const loginRedirect = await this.stateService.get<any>('loginRedirect');
|
const loginRedirect = await this.stateService.getLoginRedirect();
|
||||||
if (loginRedirect != null) {
|
if (loginRedirect != null) {
|
||||||
this.router.navigate([loginRedirect.route], { queryParams: loginRedirect.qParams });
|
this.router.navigate([loginRedirect.route], { queryParams: loginRedirect.qParams });
|
||||||
await this.stateService.remove('loginRedirect');
|
await this.stateService.setLoginRedirect(null);
|
||||||
} else {
|
} else {
|
||||||
this.router.navigate([this.successRoute]);
|
this.router.navigate([this.successRoute]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,11 +53,11 @@ export class RegisterComponent extends BaseRegisterComponent {
|
|||||||
this.email = qParams.email;
|
this.email = qParams.email;
|
||||||
}
|
}
|
||||||
if (qParams.premium != null) {
|
if (qParams.premium != null) {
|
||||||
this.stateService.save('loginRedirect', { route: '/settings/premium' });
|
this.stateService.setLoginRedirect({ route: '/settings/premium' });
|
||||||
} else if (qParams.org != null) {
|
} else if (qParams.org != null) {
|
||||||
this.showCreateOrgMessage = true;
|
this.showCreateOrgMessage = true;
|
||||||
this.referenceData.flow = qParams.org;
|
this.referenceData.flow = qParams.org;
|
||||||
this.stateService.save('loginRedirect',
|
this.stateService.setLoginRedirect(
|
||||||
{ route: '/settings/create-organization', qParams: { plan: qParams.org } });
|
{ route: '/settings/create-organization', qParams: { plan: qParams.org } });
|
||||||
}
|
}
|
||||||
if (qParams.layout != null) {
|
if (qParams.layout != null) {
|
||||||
@@ -71,7 +71,7 @@ export class RegisterComponent extends BaseRegisterComponent {
|
|||||||
// Are they coming from an email for sponsoring a families organization
|
// Are they coming from an email for sponsoring a families organization
|
||||||
if (qParams.sponsorshipToken != null) {
|
if (qParams.sponsorshipToken != null) {
|
||||||
// After logging in redirect them to setup the families sponsorship
|
// After logging in redirect them to setup the families sponsorship
|
||||||
this.stateService.save('loginRedirect', {
|
this.stateService.setLoginRedirect({
|
||||||
route: '/setup/families-for-enterprise',
|
route: '/setup/families-for-enterprise',
|
||||||
qParams: { token: qParams.sponsorshipToken },
|
qParams: { token: qParams.sponsorshipToken },
|
||||||
});
|
});
|
||||||
@@ -80,7 +80,7 @@ export class RegisterComponent extends BaseRegisterComponent {
|
|||||||
this.referenceData.id = null;
|
this.referenceData.id = null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
const invite = await this.stateService.get<any>('orgInvitation');
|
const invite = await this.stateService.getOrganizationInvitation();
|
||||||
if (invite != null) {
|
if (invite != null) {
|
||||||
try {
|
try {
|
||||||
const policies = await this.apiService.getPoliciesByToken(invite.organizationId, invite.token,
|
const policies = await this.apiService.getPoliciesByToken(invite.organizationId, invite.token,
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ import { MessagingService } from 'jslib-common/abstractions/messaging.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 { PolicyService } from 'jslib-common/abstractions/policy.service';
|
import { PolicyService } from 'jslib-common/abstractions/policy.service';
|
||||||
|
import { StateService } from 'jslib-common/abstractions/state.service';
|
||||||
import { SyncService } from 'jslib-common/abstractions/sync.service';
|
import { SyncService } from 'jslib-common/abstractions/sync.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
SetPasswordComponent as BaseSetPasswordComponent,
|
SetPasswordComponent as BaseSetPasswordComponent,
|
||||||
@@ -25,10 +25,10 @@ import {
|
|||||||
export class SetPasswordComponent extends BaseSetPasswordComponent {
|
export class SetPasswordComponent extends BaseSetPasswordComponent {
|
||||||
constructor(apiService: ApiService, i18nService: I18nService,
|
constructor(apiService: ApiService, i18nService: I18nService,
|
||||||
cryptoService: CryptoService, messagingService: MessagingService,
|
cryptoService: CryptoService, messagingService: MessagingService,
|
||||||
userService: UserService, passwordGenerationService: PasswordGenerationService,
|
passwordGenerationService: PasswordGenerationService, platformUtilsService: PlatformUtilsService,
|
||||||
platformUtilsService: PlatformUtilsService, policyService: PolicyService, router: Router,
|
policyService: PolicyService, router: Router,
|
||||||
syncService: SyncService, route: ActivatedRoute) {
|
syncService: SyncService, route: ActivatedRoute, stateService: StateService) {
|
||||||
super(i18nService, cryptoService, messagingService, userService, passwordGenerationService,
|
super(i18nService, cryptoService, messagingService, passwordGenerationService,
|
||||||
platformUtilsService, policyService, router, apiService, syncService, route);
|
platformUtilsService, policyService, router, apiService, syncService, route, stateService);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,12 +15,9 @@ import { LogService } from 'jslib-common/abstractions/log.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 { StateService } from 'jslib-common/abstractions/state.service';
|
import { StateService } from 'jslib-common/abstractions/state.service';
|
||||||
import { StorageService } from 'jslib-common/abstractions/storage.service';
|
|
||||||
|
|
||||||
import { SsoComponent as BaseSsoComponent } from 'jslib-angular/components/sso.component';
|
import { SsoComponent as BaseSsoComponent } from 'jslib-angular/components/sso.component';
|
||||||
|
|
||||||
const IdentifierStorageKey = 'ssoOrgIdentifier';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-sso',
|
selector: 'app-sso',
|
||||||
templateUrl: 'sso.component.html',
|
templateUrl: 'sso.component.html',
|
||||||
@@ -28,11 +25,11 @@ const IdentifierStorageKey = 'ssoOrgIdentifier';
|
|||||||
export class SsoComponent extends BaseSsoComponent {
|
export class SsoComponent extends BaseSsoComponent {
|
||||||
constructor(authService: AuthService, router: Router,
|
constructor(authService: AuthService, router: Router,
|
||||||
i18nService: I18nService, route: ActivatedRoute,
|
i18nService: I18nService, route: ActivatedRoute,
|
||||||
storageService: StorageService, stateService: StateService,
|
stateService: StateService, platformUtilsService: PlatformUtilsService,
|
||||||
platformUtilsService: PlatformUtilsService, apiService: ApiService,
|
apiService: ApiService, cryptoFunctionService: CryptoFunctionService,
|
||||||
cryptoFunctionService: CryptoFunctionService, environmentService: EnvironmentService,
|
environmentService: EnvironmentService, passwordGenerationService: PasswordGenerationService,
|
||||||
passwordGenerationService: PasswordGenerationService, logService: LogService) {
|
logService: LogService) {
|
||||||
super(authService, router, i18nService, route, storageService, stateService, platformUtilsService,
|
super(authService, router, i18nService, route, stateService, platformUtilsService,
|
||||||
apiService, cryptoFunctionService, environmentService, passwordGenerationService, logService);
|
apiService, cryptoFunctionService, environmentService, passwordGenerationService, logService);
|
||||||
this.redirectUri = window.location.origin + '/sso-connector.html';
|
this.redirectUri = window.location.origin + '/sso-connector.html';
|
||||||
this.clientId = 'web';
|
this.clientId = 'web';
|
||||||
@@ -44,7 +41,7 @@ export class SsoComponent extends BaseSsoComponent {
|
|||||||
if (qParams.identifier != null) {
|
if (qParams.identifier != null) {
|
||||||
this.identifier = qParams.identifier;
|
this.identifier = qParams.identifier;
|
||||||
} else {
|
} else {
|
||||||
const storedIdentifier = await this.storageService.get<string>(IdentifierStorageKey);
|
const storedIdentifier = await this.stateService.getSsoOrgIdentifier();
|
||||||
if (storedIdentifier != null) {
|
if (storedIdentifier != null) {
|
||||||
this.identifier = storedIdentifier;
|
this.identifier = storedIdentifier;
|
||||||
}
|
}
|
||||||
@@ -53,7 +50,7 @@ export class SsoComponent extends BaseSsoComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async submit() {
|
async submit() {
|
||||||
await this.storageService.save(IdentifierStorageKey, this.identifier);
|
await this.stateService.setSsoOrganizationIdentifier(this.identifier);
|
||||||
if (this.clientId === 'browser') {
|
if (this.clientId === 'browser') {
|
||||||
document.cookie = `ssoHandOffMessage=${this.i18nService.t('ssoHandOff')};SameSite=strict`;
|
document.cookie = `ssoHandOffMessage=${this.i18nService.t('ssoHandOff')};SameSite=strict`;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,9 +13,9 @@ import { ApiService } from 'jslib-common/abstractions/api.service';
|
|||||||
import { AuthService } from 'jslib-common/abstractions/auth.service';
|
import { AuthService } from 'jslib-common/abstractions/auth.service';
|
||||||
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 { LogService } from 'jslib-common/abstractions/log.service';
|
||||||
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
||||||
import { StateService } from 'jslib-common/abstractions/state.service';
|
import { StateService } from 'jslib-common/abstractions/state.service';
|
||||||
import { StorageService } from 'jslib-common/abstractions/storage.service';
|
|
||||||
|
|
||||||
import { ModalService } from 'jslib-angular/services/modal.service';
|
import { ModalService } from 'jslib-angular/services/modal.service';
|
||||||
|
|
||||||
@@ -23,7 +23,6 @@ import { TwoFactorProviderType } from 'jslib-common/enums/twoFactorProviderType'
|
|||||||
|
|
||||||
import { TwoFactorComponent as BaseTwoFactorComponent } from 'jslib-angular/components/two-factor.component';
|
import { TwoFactorComponent as BaseTwoFactorComponent } from 'jslib-angular/components/two-factor.component';
|
||||||
|
|
||||||
import { LogService } from 'jslib-common/abstractions/log.service';
|
|
||||||
import { TwoFactorOptionsComponent } from './two-factor-options.component';
|
import { TwoFactorOptionsComponent } from './two-factor-options.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -37,9 +36,9 @@ export class TwoFactorComponent extends BaseTwoFactorComponent {
|
|||||||
i18nService: I18nService, apiService: ApiService,
|
i18nService: I18nService, apiService: ApiService,
|
||||||
platformUtilsService: PlatformUtilsService, stateService: StateService,
|
platformUtilsService: PlatformUtilsService, stateService: StateService,
|
||||||
environmentService: EnvironmentService, private modalService: ModalService,
|
environmentService: EnvironmentService, private modalService: ModalService,
|
||||||
storageService: StorageService, route: ActivatedRoute, logService: LogService) {
|
route: ActivatedRoute, logService: LogService) {
|
||||||
super(authService, router, i18nService, apiService, platformUtilsService, window, environmentService,
|
super(authService, router, i18nService, apiService, platformUtilsService, window, environmentService,
|
||||||
stateService, storageService, route, logService);
|
stateService, route, logService);
|
||||||
this.onSuccessfulLoginNavigate = this.goAfterLogIn;
|
this.onSuccessfulLoginNavigate = this.goAfterLogIn;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,10 +56,10 @@ export class TwoFactorComponent extends BaseTwoFactorComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async goAfterLogIn() {
|
async goAfterLogIn() {
|
||||||
const loginRedirect = await this.stateService.get<any>('loginRedirect');
|
const loginRedirect = await this.stateService.getLoginRedirect();
|
||||||
if (loginRedirect != null) {
|
if (loginRedirect != null) {
|
||||||
this.router.navigate([loginRedirect.route], { queryParams: loginRedirect.qParams });
|
this.router.navigate([loginRedirect.route], { queryParams: loginRedirect.qParams });
|
||||||
await this.stateService.remove('loginRedirect');
|
await this.stateService.setLoginRedirect(null);
|
||||||
} else {
|
} else {
|
||||||
this.router.navigate([this.successRoute], {
|
this.router.navigate([this.successRoute], {
|
||||||
queryParams: {
|
queryParams: {
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ import { PasswordGenerationService } from 'jslib-common/abstractions/passwordGen
|
|||||||
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 { SyncService } from 'jslib-common/abstractions/sync.service';
|
import { SyncService } from 'jslib-common/abstractions/sync.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
|
||||||
|
|
||||||
import { UpdateTempPasswordComponent as BaseUpdateTempPasswordComponent } from 'jslib-angular/components/update-temp-password.component';
|
import { UpdateTempPasswordComponent as BaseUpdateTempPasswordComponent } from 'jslib-angular/components/update-temp-password.component';
|
||||||
|
import { StateService } from 'jslib-common/abstractions/state.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-update-temp-password',
|
selector: 'app-update-temp-password',
|
||||||
@@ -21,10 +21,9 @@ import { UpdateTempPasswordComponent as BaseUpdateTempPasswordComponent } from '
|
|||||||
export class UpdateTempPasswordComponent extends BaseUpdateTempPasswordComponent {
|
export class UpdateTempPasswordComponent extends BaseUpdateTempPasswordComponent {
|
||||||
constructor(i18nService: I18nService, platformUtilsService: PlatformUtilsService,
|
constructor(i18nService: I18nService, platformUtilsService: PlatformUtilsService,
|
||||||
passwordGenerationService: PasswordGenerationService, policyService: PolicyService,
|
passwordGenerationService: PasswordGenerationService, policyService: PolicyService,
|
||||||
cryptoService: CryptoService, userService: UserService,
|
cryptoService: CryptoService, messagingService: MessagingService,
|
||||||
messagingService: MessagingService, apiService: ApiService,
|
apiService: ApiService, logService: LogService, stateService: StateService, syncService: SyncService) {
|
||||||
syncService: SyncService, logService: LogService) {
|
|
||||||
super(i18nService, platformUtilsService, passwordGenerationService, policyService, cryptoService,
|
super(i18nService, platformUtilsService, passwordGenerationService, policyService, cryptoService,
|
||||||
userService, messagingService, apiService, syncService, logService);
|
messagingService, apiService, stateService, syncService, logService);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ 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';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
import { StateService } from 'jslib-common/abstractions/state.service';
|
||||||
|
|
||||||
import { VerifyEmailRequest } from 'jslib-common/models/request/verifyEmailRequest';
|
import { VerifyEmailRequest } from 'jslib-common/models/request/verifyEmailRequest';
|
||||||
|
|
||||||
@@ -22,10 +22,15 @@ import { VerifyEmailRequest } from 'jslib-common/models/request/verifyEmailReque
|
|||||||
templateUrl: 'verify-email-token.component.html',
|
templateUrl: 'verify-email-token.component.html',
|
||||||
})
|
})
|
||||||
export class VerifyEmailTokenComponent implements OnInit {
|
export class VerifyEmailTokenComponent implements OnInit {
|
||||||
constructor(private router: Router, private platformUtilsService: PlatformUtilsService,
|
constructor(
|
||||||
private i18nService: I18nService, private route: ActivatedRoute,
|
private router: Router,
|
||||||
private apiService: ApiService, private userService: UserService,
|
private platformUtilsService: PlatformUtilsService,
|
||||||
private logService: LogService) { }
|
private i18nService: I18nService,
|
||||||
|
private route: ActivatedRoute,
|
||||||
|
private apiService: ApiService,
|
||||||
|
private logService: LogService,
|
||||||
|
private stateService: StateService
|
||||||
|
) { }
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.route.queryParams.pipe(first()).subscribe(async qParams => {
|
this.route.queryParams.pipe(first()).subscribe(async qParams => {
|
||||||
@@ -33,8 +38,7 @@ export class VerifyEmailTokenComponent implements OnInit {
|
|||||||
try {
|
try {
|
||||||
await this.apiService.postAccountVerifyEmailToken(
|
await this.apiService.postAccountVerifyEmailToken(
|
||||||
new VerifyEmailRequest(qParams.userId, qParams.token));
|
new VerifyEmailRequest(qParams.userId, qParams.token));
|
||||||
const authed = await this.userService.isAuthenticated();
|
if (await this.stateService.getIsAuthenticated()) {
|
||||||
if (authed) {
|
|
||||||
await this.apiService.refreshIdentityToken();
|
await this.apiService.refreshIdentityToken();
|
||||||
}
|
}
|
||||||
this.platformUtilsService.showToast('success', null, this.i18nService.t('emailVerified'));
|
this.platformUtilsService.showToast('success', null, this.i18nService.t('emailVerified'));
|
||||||
|
|||||||
@@ -33,11 +33,8 @@ import { StateService } from 'jslib-common/abstractions/state.service';
|
|||||||
import { StorageService } from 'jslib-common/abstractions/storage.service';
|
import { StorageService } from 'jslib-common/abstractions/storage.service';
|
||||||
import { SyncService } from 'jslib-common/abstractions/sync.service';
|
import { SyncService } from 'jslib-common/abstractions/sync.service';
|
||||||
import { TokenService } from 'jslib-common/abstractions/token.service';
|
import { TokenService } from 'jslib-common/abstractions/token.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
|
||||||
import { VaultTimeoutService } from 'jslib-common/abstractions/vaultTimeout.service';
|
import { VaultTimeoutService } from 'jslib-common/abstractions/vaultTimeout.service';
|
||||||
|
|
||||||
import { ConstantsService } from 'jslib-common/services/constants.service';
|
|
||||||
|
|
||||||
import { PolicyListService } from './services/policy-list.service';
|
import { PolicyListService } from './services/policy-list.service';
|
||||||
import { RouterService } from './services/router.service';
|
import { RouterService } from './services/router.service';
|
||||||
|
|
||||||
@@ -65,20 +62,32 @@ export class AppComponent implements OnDestroy, OnInit {
|
|||||||
private isIdle = false;
|
private isIdle = false;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private broadcasterService: BroadcasterService, private userService: UserService,
|
private broadcasterService: BroadcasterService,
|
||||||
private tokenService: TokenService, private folderService: FolderService,
|
private tokenService: TokenService,
|
||||||
private settingsService: SettingsService, private syncService: SyncService,
|
private folderService: FolderService,
|
||||||
private passwordGenerationService: PasswordGenerationService, private cipherService: CipherService,
|
private settingsService: SettingsService,
|
||||||
private authService: AuthService, private router: Router,
|
private syncService: SyncService,
|
||||||
private toastrService: ToastrService, private i18nService: I18nService,
|
private passwordGenerationService: PasswordGenerationService,
|
||||||
private platformUtilsService: PlatformUtilsService, private ngZone: NgZone,
|
private cipherService: CipherService,
|
||||||
private vaultTimeoutService: VaultTimeoutService, private storageService: StorageService,
|
private authService: AuthService,
|
||||||
private cryptoService: CryptoService, private collectionService: CollectionService,
|
private router: Router,
|
||||||
private sanitizer: DomSanitizer, private searchService: SearchService,
|
private toastrService: ToastrService,
|
||||||
private notificationsService: NotificationsService, private routerService: RouterService,
|
private i18nService: I18nService,
|
||||||
private stateService: StateService, private eventService: EventService,
|
private platformUtilsService: PlatformUtilsService,
|
||||||
private policyService: PolicyService, protected policyListService: PolicyListService,
|
private ngZone: NgZone,
|
||||||
private keyConnectorService: KeyConnectorService) { }
|
private vaultTimeoutService: VaultTimeoutService,
|
||||||
|
private cryptoService: CryptoService,
|
||||||
|
private collectionService: CollectionService,
|
||||||
|
private sanitizer: DomSanitizer,
|
||||||
|
private searchService: SearchService,
|
||||||
|
private notificationsService: NotificationsService,
|
||||||
|
private routerService: RouterService,
|
||||||
|
private stateService: StateService,
|
||||||
|
private eventService: EventService,
|
||||||
|
private policyService: PolicyService,
|
||||||
|
protected policyListService: PolicyListService,
|
||||||
|
private keyConnectorService: KeyConnectorService
|
||||||
|
) { }
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.ngZone.runOutsideAngular(() => {
|
this.ngZone.runOutsideAngular(() => {
|
||||||
@@ -193,21 +202,18 @@ export class AppComponent implements OnDestroy, OnInit {
|
|||||||
|
|
||||||
private async logOut(expired: boolean) {
|
private async logOut(expired: boolean) {
|
||||||
await this.eventService.uploadEvents();
|
await this.eventService.uploadEvents();
|
||||||
const userId = await this.userService.getUserId();
|
const userId = await this.stateService.getUserId();
|
||||||
|
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
this.eventService.clearEvents(),
|
this.eventService.clearEvents(),
|
||||||
this.syncService.setLastSync(new Date(0)),
|
this.syncService.setLastSync(new Date(0)),
|
||||||
this.tokenService.clearToken(),
|
this.tokenService.clearToken(),
|
||||||
this.cryptoService.clearKeys(),
|
this.cryptoService.clearKeys(),
|
||||||
this.userService.clear(),
|
|
||||||
this.settingsService.clear(userId),
|
this.settingsService.clear(userId),
|
||||||
this.cipherService.clear(userId),
|
this.cipherService.clear(userId),
|
||||||
this.folderService.clear(userId),
|
this.folderService.clear(userId),
|
||||||
this.collectionService.clear(userId),
|
this.collectionService.clear(userId),
|
||||||
this.policyService.clear(userId),
|
this.policyService.clear(userId),
|
||||||
this.passwordGenerationService.clear(),
|
this.passwordGenerationService.clear(),
|
||||||
this.stateService.purge(),
|
|
||||||
this.keyConnectorService.clear(),
|
this.keyConnectorService.clear(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
@@ -218,6 +224,7 @@ export class AppComponent implements OnDestroy, OnInit {
|
|||||||
this.i18nService.t('loginExpired'));
|
this.i18nService.t('loginExpired'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await this.stateService.clean({ userId: userId });
|
||||||
Swal.close();
|
Swal.close();
|
||||||
this.router.navigate(['/']);
|
this.router.navigate(['/']);
|
||||||
});
|
});
|
||||||
@@ -230,8 +237,7 @@ export class AppComponent implements OnDestroy, OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.lastActivity = now;
|
this.lastActivity = now;
|
||||||
this.storageService.save(ConstantsService.lastActiveKey, now);
|
this.stateService.setLastActive(now);
|
||||||
|
|
||||||
// Idle states
|
// Idle states
|
||||||
if (this.isIdle) {
|
if (this.isIdle) {
|
||||||
this.isIdle = false;
|
this.isIdle = false;
|
||||||
@@ -284,7 +290,7 @@ export class AppComponent implements OnDestroy, OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async setFullWidth() {
|
private async setFullWidth() {
|
||||||
const enableFullWidth = await this.storageService.get<boolean>('enableFullWidth');
|
const enableFullWidth = await this.stateService.getEnableFullWidth();
|
||||||
if (enableFullWidth) {
|
if (enableFullWidth) {
|
||||||
document.body.classList.add('full-width');
|
document.body.classList.add('full-width');
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import { first } from 'rxjs/operators';
|
|||||||
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 { StateService } from 'jslib-common/abstractions/state.service';
|
import { StateService } from 'jslib-common/abstractions/state.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
|
||||||
|
|
||||||
@Directive()
|
@Directive()
|
||||||
export abstract class BaseAcceptComponent implements OnInit {
|
export abstract class BaseAcceptComponent implements OnInit {
|
||||||
@@ -27,19 +26,18 @@ export abstract class BaseAcceptComponent implements OnInit {
|
|||||||
|
|
||||||
constructor(protected router: Router, protected platformUtilService: PlatformUtilsService,
|
constructor(protected router: Router, protected platformUtilService: PlatformUtilsService,
|
||||||
protected i18nService: I18nService, protected route: ActivatedRoute,
|
protected i18nService: I18nService, protected route: ActivatedRoute,
|
||||||
protected userService: UserService, protected stateService: StateService) { }
|
protected stateService: StateService) { }
|
||||||
|
|
||||||
abstract authedHandler(qParams: any): Promise<void>;
|
abstract authedHandler(qParams: any): Promise<void>;
|
||||||
abstract unauthedHandler(qParams: any): Promise<void>;
|
abstract unauthedHandler(qParams: any): Promise<void>;
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.route.queryParams.pipe(first()).subscribe(async qParams => {
|
this.route.queryParams.pipe(first()).subscribe(async qParams => {
|
||||||
await this.stateService.remove('loginRedirect');
|
await this.stateService.setLoginRedirect(null);
|
||||||
|
|
||||||
let error = this.requiredParameters.some(e => qParams?.[e] == null || qParams[e] === '');
|
let error = this.requiredParameters.some(e => qParams?.[e] == null || qParams[e] === '');
|
||||||
let errorMessage: string = null;
|
let errorMessage: string = null;
|
||||||
if (!error) {
|
if (!error) {
|
||||||
this.authed = await this.userService.isAuthenticated();
|
this.authed = await this.stateService.getIsAuthenticated();
|
||||||
|
|
||||||
if (this.authed) {
|
if (this.authed) {
|
||||||
try {
|
try {
|
||||||
@@ -49,7 +47,7 @@ export abstract class BaseAcceptComponent implements OnInit {
|
|||||||
errorMessage = e.message;
|
errorMessage = e.message;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
await this.stateService.save('loginRedirect', {
|
await this.stateService.setLoginRedirect({
|
||||||
route: this.getRedirectRoute(),
|
route: this.getRedirectRoute(),
|
||||||
qParams: qParams,
|
qParams: qParams,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -4,18 +4,16 @@ import {
|
|||||||
ViewContainerRef
|
ViewContainerRef
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
|
|
||||||
import { ValidationService } from 'jslib-angular/services/validation.service';
|
|
||||||
import { ApiService } from 'jslib-common/abstractions/api.service';
|
import { ApiService } from 'jslib-common/abstractions/api.service';
|
||||||
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 { 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 { SearchService } from 'jslib-common/abstractions/search.service';
|
import { SearchService } from 'jslib-common/abstractions/search.service';
|
||||||
import { StorageService } from 'jslib-common/abstractions/storage.service';
|
import { StateService } from 'jslib-common/abstractions/state.service';
|
||||||
|
|
||||||
import { ConstantsService } from 'jslib-common/services/constants.service';
|
|
||||||
|
|
||||||
import { ModalService } from 'jslib-angular/services/modal.service';
|
import { ModalService } from 'jslib-angular/services/modal.service';
|
||||||
|
import { ValidationService } from 'jslib-angular/services/validation.service';
|
||||||
|
|
||||||
import { SearchPipe } from 'jslib-angular/pipes/search.pipe';
|
import { SearchPipe } from 'jslib-angular/pipes/search.pipe';
|
||||||
import { UserNamePipe } from 'jslib-angular/pipes/user-name.pipe';
|
import { UserNamePipe } from 'jslib-angular/pipes/user-name.pipe';
|
||||||
@@ -88,12 +86,19 @@ export abstract class BasePeopleComponent<UserType extends ProviderUserUserDetai
|
|||||||
|
|
||||||
private pagedUsersCount = 0;
|
private pagedUsersCount = 0;
|
||||||
|
|
||||||
constructor(protected apiService: ApiService, private searchService: SearchService,
|
constructor(
|
||||||
protected i18nService: I18nService, protected platformUtilsService: PlatformUtilsService,
|
protected apiService: ApiService,
|
||||||
|
private searchService: SearchService,
|
||||||
|
protected i18nService: I18nService,
|
||||||
|
protected platformUtilsService: PlatformUtilsService,
|
||||||
protected cryptoService: CryptoService,
|
protected cryptoService: CryptoService,
|
||||||
private storageService: StorageService, protected validationService: ValidationService,
|
protected validationService: ValidationService,
|
||||||
protected modalService: ModalService, private logService: LogService,
|
protected modalService: ModalService,
|
||||||
private searchPipe: SearchPipe, protected userNamePipe: UserNamePipe ) { }
|
private logService: LogService,
|
||||||
|
private searchPipe: SearchPipe,
|
||||||
|
protected userNamePipe: UserNamePipe,
|
||||||
|
protected stateService: StateService,
|
||||||
|
) { }
|
||||||
|
|
||||||
abstract edit(user: UserType): void;
|
abstract edit(user: UserType): void;
|
||||||
abstract getUsers(): Promise<ListResponse<UserType>>;
|
abstract getUsers(): Promise<ListResponse<UserType>>;
|
||||||
@@ -247,7 +252,7 @@ export abstract class BasePeopleComponent<UserType extends ProviderUserUserDetai
|
|||||||
const publicKeyResponse = await this.apiService.getUserPublicKey(user.userId);
|
const publicKeyResponse = await this.apiService.getUserPublicKey(user.userId);
|
||||||
const publicKey = Utils.fromB64ToArray(publicKeyResponse.publicKey);
|
const publicKey = Utils.fromB64ToArray(publicKeyResponse.publicKey);
|
||||||
|
|
||||||
const autoConfirm = await this.storageService.get<boolean>(ConstantsService.autoConfirmFingerprints);
|
const autoConfirm = await this.stateService.getAutoConfirmFingerPrints();
|
||||||
if (autoConfirm == null || !autoConfirm) {
|
if (autoConfirm == null || !autoConfirm) {
|
||||||
const [modal] = await this.modalService.openViewRef(UserConfirmComponent, this.confirmModalRef, comp => {
|
const [modal] = await this.modalService.openViewRef(UserConfirmComponent, this.confirmModalRef, comp => {
|
||||||
comp.name = this.userNamePipe.transform(user);
|
comp.name = this.userNamePipe.transform(user);
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ import {
|
|||||||
|
|
||||||
import { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
import { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
||||||
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
||||||
|
import { ProviderService } from 'jslib-common/abstractions/provider.service';
|
||||||
import { SyncService } from 'jslib-common/abstractions/sync.service';
|
import { SyncService } from 'jslib-common/abstractions/sync.service';
|
||||||
import { TokenService } from 'jslib-common/abstractions/token.service';
|
import { TokenService } from 'jslib-common/abstractions/token.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
|
||||||
|
|
||||||
import { Provider } from 'jslib-common/models/domain/provider';
|
import { Provider } from 'jslib-common/models/domain/provider';
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@ export class NavbarComponent implements OnInit {
|
|||||||
providers: Provider[] = [];
|
providers: Provider[] = [];
|
||||||
|
|
||||||
constructor(private messagingService: MessagingService, private platformUtilsService: PlatformUtilsService,
|
constructor(private messagingService: MessagingService, private platformUtilsService: PlatformUtilsService,
|
||||||
private tokenService: TokenService, private userService: UserService, private syncService: SyncService) {
|
private tokenService: TokenService, private providerService: ProviderService, private syncService: SyncService) {
|
||||||
this.selfHosted = this.platformUtilsService.isSelfHost();
|
this.selfHosted = this.platformUtilsService.isSelfHost();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,7 +37,7 @@ export class NavbarComponent implements OnInit {
|
|||||||
if (await this.syncService.getLastSync() == null) {
|
if (await this.syncService.getLastSync() == null) {
|
||||||
await this.syncService.fullSync(false);
|
await this.syncService.fullSync(false);
|
||||||
}
|
}
|
||||||
this.providers = await this.userService.getAllProviders();
|
this.providers = await this.providerService.getAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
lock() {
|
lock() {
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ import {
|
|||||||
|
|
||||||
import { ActivatedRoute } from '@angular/router';
|
import { ActivatedRoute } from '@angular/router';
|
||||||
|
|
||||||
import { BroadcasterService } from 'jslib-common/abstractions/broadcaster.service';
|
import { BroadcasterService } from 'jslib-angular/services/broadcaster.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
import { OrganizationService } from 'jslib-common/abstractions/organization.service';
|
||||||
|
|
||||||
import { Organization } from 'jslib-common/models/domain/organization';
|
import { Organization } from 'jslib-common/models/domain/organization';
|
||||||
|
|
||||||
@@ -23,7 +23,7 @@ export class OrganizationLayoutComponent implements OnInit, OnDestroy {
|
|||||||
businessTokenPromise: Promise<any>;
|
businessTokenPromise: Promise<any>;
|
||||||
private organizationId: string;
|
private organizationId: string;
|
||||||
|
|
||||||
constructor(private route: ActivatedRoute, private userService: UserService,
|
constructor(private route: ActivatedRoute, private organizationService: OrganizationService,
|
||||||
private broadcasterService: BroadcasterService, private ngZone: NgZone) { }
|
private broadcasterService: BroadcasterService, private ngZone: NgZone) { }
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
@@ -48,7 +48,7 @@ export class OrganizationLayoutComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async load() {
|
async load() {
|
||||||
this.organization = await this.userService.getOrganization(this.organizationId);
|
this.organization = await this.organizationService.get(this.organizationId);
|
||||||
}
|
}
|
||||||
|
|
||||||
get showMenuBar() {
|
get showMenuBar() {
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ import { ApiService } from 'jslib-common/abstractions/api.service';
|
|||||||
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 { LogService } from 'jslib-common/abstractions/log.service';
|
import { LogService } from 'jslib-common/abstractions/log.service';
|
||||||
|
import { OrganizationService } from 'jslib-common/abstractions/organization.service';
|
||||||
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
|
||||||
|
|
||||||
import { EncString } from 'jslib-common/models/domain/encString';
|
import { EncString } from 'jslib-common/models/domain/encString';
|
||||||
import { SymmetricCryptoKey } from 'jslib-common/models/domain/symmetricCryptoKey';
|
import { SymmetricCryptoKey } from 'jslib-common/models/domain/symmetricCryptoKey';
|
||||||
@@ -45,13 +45,17 @@ export class CollectionAddEditComponent implements OnInit {
|
|||||||
|
|
||||||
private orgKey: SymmetricCryptoKey;
|
private orgKey: SymmetricCryptoKey;
|
||||||
|
|
||||||
constructor(private apiService: ApiService, private i18nService: I18nService,
|
constructor(
|
||||||
|
private apiService: ApiService,
|
||||||
|
private i18nService: I18nService,
|
||||||
private platformUtilsService: PlatformUtilsService,
|
private platformUtilsService: PlatformUtilsService,
|
||||||
private cryptoService: CryptoService, private userService: UserService,
|
private cryptoService: CryptoService,
|
||||||
private logService: LogService) { }
|
private logService: LogService,
|
||||||
|
private organizationService: OrganizationService
|
||||||
|
) { }
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
const organization = await this.userService.getOrganization(this.organizationId);
|
const organization = await this.organizationService.get(this.organizationId);
|
||||||
this.accessGroups = organization.useGroups;
|
this.accessGroups = organization.useGroups;
|
||||||
this.editMode = this.loading = this.collectionId != null;
|
this.editMode = this.loading = this.collectionId != null;
|
||||||
if (this.accessGroups) {
|
if (this.accessGroups) {
|
||||||
|
|||||||
@@ -12,9 +12,9 @@ import { ApiService } from 'jslib-common/abstractions/api.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 { OrganizationService } from 'jslib-common/abstractions/organization.service';
|
||||||
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
||||||
import { SearchService } from 'jslib-common/abstractions/search.service';
|
import { SearchService } from 'jslib-common/abstractions/search.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
|
||||||
|
|
||||||
import { ModalService } from 'jslib-angular/services/modal.service';
|
import { ModalService } from 'jslib-angular/services/modal.service';
|
||||||
|
|
||||||
@@ -53,11 +53,17 @@ export class CollectionsComponent implements OnInit {
|
|||||||
|
|
||||||
private pagedCollectionsCount = 0;
|
private pagedCollectionsCount = 0;
|
||||||
|
|
||||||
constructor(private apiService: ApiService, private route: ActivatedRoute,
|
constructor(
|
||||||
private collectionService: CollectionService, private modalService: ModalService,
|
private apiService: ApiService,
|
||||||
|
private route: ActivatedRoute,
|
||||||
|
private collectionService: CollectionService,
|
||||||
|
private modalService: ModalService,
|
||||||
private i18nService: I18nService,
|
private i18nService: I18nService,
|
||||||
private platformUtilsService: PlatformUtilsService, private userService: UserService,
|
private platformUtilsService: PlatformUtilsService,
|
||||||
private searchService: SearchService, private logService: LogService) { }
|
private searchService: SearchService,
|
||||||
|
private logService: LogService,
|
||||||
|
private organizationService: OrganizationService,
|
||||||
|
) { }
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
this.route.parent.parent.params.subscribe(async params => {
|
this.route.parent.parent.params.subscribe(async params => {
|
||||||
@@ -70,7 +76,7 @@ export class CollectionsComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async load() {
|
async load() {
|
||||||
this.organization = await this.userService.getOrganization(this.organizationId);
|
this.organization = await this.organizationService.get(this.organizationId);
|
||||||
this.canCreate = this.organization.canCreateNewCollections;
|
this.canCreate = this.organization.canCreateNewCollections;
|
||||||
|
|
||||||
const decryptCollections = async (r: ListResponse<CollectionResponse>) => {
|
const decryptCollections = async (r: ListResponse<CollectionResponse>) => {
|
||||||
|
|||||||
@@ -10,8 +10,9 @@ import { ApiService } from 'jslib-common/abstractions/api.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 { OrganizationService } from 'jslib-common/abstractions/organization.service';
|
||||||
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
import { ProviderService } from 'jslib-common/abstractions/provider.service';
|
||||||
|
|
||||||
import { Organization } from 'jslib-common/models/domain/organization';
|
import { Organization } from 'jslib-common/models/domain/organization';
|
||||||
import { EventResponse } from 'jslib-common/models/response/eventResponse';
|
import { EventResponse } from 'jslib-common/models/response/eventResponse';
|
||||||
@@ -31,17 +32,32 @@ export class EventsComponent extends BaseEventsComponent implements OnInit {
|
|||||||
|
|
||||||
private orgUsersUserIdMap = new Map<string, any>();
|
private orgUsersUserIdMap = new Map<string, any>();
|
||||||
|
|
||||||
constructor(private apiService: ApiService, private route: ActivatedRoute, eventService: EventService,
|
constructor(
|
||||||
i18nService: I18nService, private userService: UserService,
|
private apiService: ApiService,
|
||||||
exportService: ExportService, platformUtilsService: PlatformUtilsService, private router: Router,
|
private route: ActivatedRoute,
|
||||||
logService: LogService, private userNamePipe: UserNamePipe) {
|
eventService: EventService,
|
||||||
super(eventService, i18nService, exportService, platformUtilsService, logService);
|
i18nService: I18nService,
|
||||||
|
exportService: ExportService,
|
||||||
|
platformUtilsService: PlatformUtilsService,
|
||||||
|
private router: Router,
|
||||||
|
logService: LogService,
|
||||||
|
private userNamePipe: UserNamePipe,
|
||||||
|
private organizationService: OrganizationService,
|
||||||
|
private providerService: ProviderService,
|
||||||
|
) {
|
||||||
|
super(
|
||||||
|
eventService,
|
||||||
|
i18nService,
|
||||||
|
exportService,
|
||||||
|
platformUtilsService,
|
||||||
|
logService
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
this.route.parent.parent.params.subscribe(async params => {
|
this.route.parent.parent.params.subscribe(async params => {
|
||||||
this.organizationId = params.organizationId;
|
this.organizationId = params.organizationId;
|
||||||
this.organization = await this.userService.getOrganization(this.organizationId);
|
this.organization = await this.organizationService.get(this.organizationId);
|
||||||
if (this.organization == null || !this.organization.useEvents) {
|
if (this.organization == null || !this.organization.useEvents) {
|
||||||
this.router.navigate(['/organizations', this.organizationId]);
|
this.router.navigate(['/organizations', this.organizationId]);
|
||||||
return;
|
return;
|
||||||
@@ -60,8 +76,8 @@ export class EventsComponent extends BaseEventsComponent implements OnInit {
|
|||||||
|
|
||||||
if (this.organization.providerId != null) {
|
if (this.organization.providerId != null) {
|
||||||
try {
|
try {
|
||||||
const provider = await this.userService.getProvider(this.organization.providerId);
|
const provider = await this.providerService.get(this.organization.providerId);
|
||||||
if (provider != null && (await this.userService.getProvider(this.organization.providerId)).canManageUsers) {
|
if (provider != null && (await this.providerService.get(this.organization.providerId)).canManageUsers) {
|
||||||
const providerUsersResponse = await this.apiService.getProviderUsers(this.organization.providerId);
|
const providerUsersResponse = await this.apiService.getProviderUsers(this.organization.providerId);
|
||||||
providerUsersResponse.data.forEach(u => {
|
providerUsersResponse.data.forEach(u => {
|
||||||
const name = this.userNamePipe.transform(u);
|
const name = this.userNamePipe.transform(u);
|
||||||
|
|||||||
@@ -14,9 +14,9 @@ import { first } from 'rxjs/operators';
|
|||||||
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 { OrganizationService } from 'jslib-common/abstractions/organization.service';
|
||||||
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
||||||
import { SearchService } from 'jslib-common/abstractions/search.service';
|
import { SearchService } from 'jslib-common/abstractions/search.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
|
||||||
|
|
||||||
import { ModalService } from 'jslib-angular/services/modal.service';
|
import { ModalService } from 'jslib-angular/services/modal.service';
|
||||||
|
|
||||||
@@ -46,16 +46,22 @@ export class GroupsComponent implements OnInit {
|
|||||||
|
|
||||||
private pagedGroupsCount = 0;
|
private pagedGroupsCount = 0;
|
||||||
|
|
||||||
constructor(private apiService: ApiService, private route: ActivatedRoute,
|
constructor(
|
||||||
private i18nService: I18nService, private modalService: ModalService,
|
private apiService: ApiService,
|
||||||
|
private route: ActivatedRoute,
|
||||||
|
private i18nService: I18nService,
|
||||||
|
private modalService: ModalService,
|
||||||
private platformUtilsService: PlatformUtilsService,
|
private platformUtilsService: PlatformUtilsService,
|
||||||
private userService: UserService, private router: Router,
|
private router: Router,
|
||||||
private searchService: SearchService, private logService: LogService) { }
|
private searchService: SearchService,
|
||||||
|
private logService: LogService,
|
||||||
|
private organizationService: OrganizationService,
|
||||||
|
) { }
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
this.route.parent.parent.params.subscribe(async params => {
|
this.route.parent.parent.params.subscribe(async params => {
|
||||||
this.organizationId = params.organizationId;
|
this.organizationId = params.organizationId;
|
||||||
const organization = await this.userService.getOrganization(this.organizationId);
|
const organization = await this.organizationService.get(this.organizationId);
|
||||||
if (organization == null || !organization.useGroups) {
|
if (organization == null || !organization.useGroups) {
|
||||||
this.router.navigate(['/organizations', this.organizationId]);
|
this.router.navigate(['/organizations', this.organizationId]);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import {
|
|||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
import { ActivatedRoute } from '@angular/router';
|
import { ActivatedRoute } from '@angular/router';
|
||||||
|
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
import { OrganizationService } from 'jslib-common/abstractions/organization.service';
|
||||||
|
|
||||||
import { Organization } from 'jslib-common/models/domain/organization';
|
import { Organization } from 'jslib-common/models/domain/organization';
|
||||||
|
|
||||||
@@ -19,11 +19,11 @@ export class ManageComponent implements OnInit {
|
|||||||
accessEvents: boolean = false;
|
accessEvents: boolean = false;
|
||||||
accessSso: boolean = false;
|
accessSso: boolean = false;
|
||||||
|
|
||||||
constructor(private route: ActivatedRoute, private userService: UserService) {}
|
constructor(private route: ActivatedRoute, private organizationService: OrganizationService) {}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.route.parent.params.subscribe(async params => {
|
this.route.parent.params.subscribe(async params => {
|
||||||
this.organization = await this.userService.getOrganization(params.organizationId);
|
this.organization = await this.organizationService.get(params.organizationId);
|
||||||
this.accessPolicies = this.organization.usePolicies;
|
this.accessPolicies = this.organization.usePolicies;
|
||||||
this.accessSso = this.organization.useSso;
|
this.accessSso = this.organization.useSso;
|
||||||
this.accessEvents = this.organization.useEvents;
|
this.accessEvents = this.organization.useEvents;
|
||||||
|
|||||||
@@ -18,12 +18,12 @@ import { ApiService } from 'jslib-common/abstractions/api.service';
|
|||||||
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 { LogService } from 'jslib-common/abstractions/log.service';
|
import { LogService } from 'jslib-common/abstractions/log.service';
|
||||||
|
import { OrganizationService } from 'jslib-common/abstractions/organization.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 { SearchService } from 'jslib-common/abstractions/search.service';
|
import { SearchService } from 'jslib-common/abstractions/search.service';
|
||||||
import { StorageService } from 'jslib-common/abstractions/storage.service';
|
import { StateService } from 'jslib-common/abstractions/state.service';
|
||||||
import { SyncService } from 'jslib-common/abstractions/sync.service';
|
import { SyncService } from 'jslib-common/abstractions/sync.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
|
||||||
|
|
||||||
import { ModalService } from 'jslib-angular/services/modal.service';
|
import { ModalService } from 'jslib-angular/services/modal.service';
|
||||||
|
|
||||||
@@ -78,21 +78,43 @@ export class PeopleComponent extends BasePeopleComponent<OrganizationUserUserDet
|
|||||||
orgResetPasswordPolicyEnabled = false;
|
orgResetPasswordPolicyEnabled = false;
|
||||||
callingUserType: OrganizationUserType = null;
|
callingUserType: OrganizationUserType = null;
|
||||||
|
|
||||||
constructor(apiService: ApiService, private route: ActivatedRoute,
|
constructor(
|
||||||
i18nService: I18nService, modalService: ModalService,
|
apiService: ApiService,
|
||||||
|
private route: ActivatedRoute,
|
||||||
|
i18nService: I18nService,
|
||||||
|
modalService: ModalService,
|
||||||
platformUtilsService: PlatformUtilsService,
|
platformUtilsService: PlatformUtilsService,
|
||||||
cryptoService: CryptoService, private userService: UserService, private router: Router,
|
cryptoService: CryptoService,
|
||||||
storageService: StorageService, searchService: SearchService,
|
private router: Router,
|
||||||
validationService: ValidationService, private policyService: PolicyService,
|
searchService: SearchService,
|
||||||
logService: LogService, searchPipe: SearchPipe, userNamePipe: UserNamePipe, private syncService: SyncService) {
|
validationService: ValidationService,
|
||||||
super(apiService, searchService, i18nService, platformUtilsService, cryptoService,
|
private policyService: PolicyService,
|
||||||
storageService, validationService, modalService, logService, searchPipe, userNamePipe);
|
logService: LogService,
|
||||||
|
searchPipe: SearchPipe,
|
||||||
|
userNamePipe: UserNamePipe,
|
||||||
|
private syncService: SyncService,
|
||||||
|
stateService: StateService,
|
||||||
|
private organizationService: OrganizationService,
|
||||||
|
) {
|
||||||
|
super(
|
||||||
|
apiService,
|
||||||
|
searchService,
|
||||||
|
i18nService,
|
||||||
|
platformUtilsService,
|
||||||
|
cryptoService,
|
||||||
|
validationService,
|
||||||
|
modalService,
|
||||||
|
logService,
|
||||||
|
searchPipe,
|
||||||
|
userNamePipe,
|
||||||
|
stateService,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
this.route.parent.parent.params.subscribe(async params => {
|
this.route.parent.parent.params.subscribe(async params => {
|
||||||
this.organizationId = params.organizationId;
|
this.organizationId = params.organizationId;
|
||||||
const organization = await this.userService.getOrganization(this.organizationId);
|
const organization = await this.organizationService.get(this.organizationId);
|
||||||
if (!organization.canManageUsers) {
|
if (!organization.canManageUsers) {
|
||||||
this.router.navigate(['../collections'], { relativeTo: this.route });
|
this.router.navigate(['../collections'], { relativeTo: this.route });
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import { first } from 'rxjs/operators';
|
|||||||
import { PolicyType } from 'jslib-common/enums/policyType';
|
import { PolicyType } from 'jslib-common/enums/policyType';
|
||||||
|
|
||||||
import { ApiService } from 'jslib-common/abstractions/api.service';
|
import { ApiService } from 'jslib-common/abstractions/api.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
import { OrganizationService } from 'jslib-common/abstractions/organization.service';
|
||||||
|
|
||||||
import { ModalService } from 'jslib-angular/services/modal.service';
|
import { ModalService } from 'jslib-angular/services/modal.service';
|
||||||
|
|
||||||
@@ -43,13 +43,13 @@ export class PoliciesComponent implements OnInit {
|
|||||||
private policiesEnabledMap: Map<PolicyType, boolean> = new Map<PolicyType, boolean>();
|
private policiesEnabledMap: Map<PolicyType, boolean> = new Map<PolicyType, boolean>();
|
||||||
|
|
||||||
constructor(private apiService: ApiService, private route: ActivatedRoute,
|
constructor(private apiService: ApiService, private route: ActivatedRoute,
|
||||||
private modalService: ModalService, private userService: UserService,
|
private modalService: ModalService, private organizationService: OrganizationService,
|
||||||
private policyListService: PolicyListService, private router: Router) { }
|
private policyListService: PolicyListService, private router: Router) { }
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
this.route.parent.parent.params.subscribe(async params => {
|
this.route.parent.parent.params.subscribe(async params => {
|
||||||
this.organizationId = params.organizationId;
|
this.organizationId = params.organizationId;
|
||||||
this.organization = await this.userService.getOrganization(this.organizationId);
|
this.organization = await this.organizationService.get(this.organizationId);
|
||||||
if (this.organization == null || !this.organization.usePolicies) {
|
if (this.organization == null || !this.organization.usePolicies) {
|
||||||
this.router.navigate(['/organizations', this.organizationId]);
|
this.router.navigate(['/organizations', this.organizationId]);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -6,11 +6,9 @@ import {
|
|||||||
Output,
|
Output,
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
|
|
||||||
import { ConstantsService } from 'jslib-common/services/constants.service';
|
|
||||||
|
|
||||||
import { CryptoService } from 'jslib-common/abstractions/crypto.service';
|
import { CryptoService } from 'jslib-common/abstractions/crypto.service';
|
||||||
import { LogService } from 'jslib-common/abstractions/log.service';
|
import { LogService } from 'jslib-common/abstractions/log.service';
|
||||||
import { StorageService } from 'jslib-common/abstractions/storage.service';
|
import { StateService } from 'jslib-common/abstractions/state.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-user-confirm',
|
selector: 'app-user-confirm',
|
||||||
@@ -27,8 +25,8 @@ export class UserConfirmComponent implements OnInit {
|
|||||||
fingerprint: string;
|
fingerprint: string;
|
||||||
formPromise: Promise<any>;
|
formPromise: Promise<any>;
|
||||||
|
|
||||||
constructor(private cryptoService: CryptoService, private storageService: StorageService,
|
constructor(private cryptoService: CryptoService, private logService: LogService,
|
||||||
private logService: LogService) { }
|
private stateService: StateService) { }
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
try {
|
try {
|
||||||
@@ -50,7 +48,7 @@ export class UserConfirmComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.dontAskAgain) {
|
if (this.dontAskAgain) {
|
||||||
await this.storageService.save(ConstantsService.autoConfirmFingerprints, true);
|
await this.stateService.setAutoConfirmFingerprints(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.onConfirmedUser.emit();
|
this.onConfirmedUser.emit();
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { Component } from '@angular/core';
|
|||||||
import { FormBuilder } from '@angular/forms';
|
import { FormBuilder } from '@angular/forms';
|
||||||
|
|
||||||
import { I18nService } from 'jslib-common/abstractions/i18n.service';
|
import { I18nService } from 'jslib-common/abstractions/i18n.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
import { OrganizationService } from 'jslib-common/abstractions/organization.service';
|
||||||
|
|
||||||
import { PolicyType } from 'jslib-common/enums/policyType';
|
import { PolicyType } from 'jslib-common/enums/policyType';
|
||||||
|
|
||||||
@@ -33,7 +33,7 @@ export class MasterPasswordPolicyComponent extends BasePolicyComponent {
|
|||||||
passwordScores: { name: string; value: number; }[];
|
passwordScores: { name: string; value: number; }[];
|
||||||
showKeyConnectorInfo: boolean = false;
|
showKeyConnectorInfo: boolean = false;
|
||||||
|
|
||||||
constructor(private fb: FormBuilder, i18nService: I18nService, private userService: UserService) {
|
constructor(private fb: FormBuilder, i18nService: I18nService, private organizationService: OrganizationService) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this.passwordScores = [
|
this.passwordScores = [
|
||||||
@@ -48,7 +48,7 @@ export class MasterPasswordPolicyComponent extends BasePolicyComponent {
|
|||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
super.ngOnInit();
|
super.ngOnInit();
|
||||||
const organization = await this.userService.getOrganization(this.policyResponse.organizationId);
|
const organization = await this.organizationService.get(this.policyResponse.organizationId);
|
||||||
this.showKeyConnectorInfo = organization.keyConnectorEnabled;
|
this.showKeyConnectorInfo = organization.keyConnectorEnabled;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { FormBuilder } from '@angular/forms';
|
import { FormBuilder } from '@angular/forms';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
import { OrganizationService } from 'jslib-common/abstractions/organization.service';
|
||||||
|
|
||||||
import { PolicyType } from 'jslib-common/enums/policyType';
|
import { PolicyType } from 'jslib-common/enums/policyType';
|
||||||
|
|
||||||
@@ -32,13 +32,13 @@ export class ResetPasswordPolicyComponent extends BasePolicyComponent {
|
|||||||
defaultTypes: { name: string; value: string; }[];
|
defaultTypes: { name: string; value: string; }[];
|
||||||
showKeyConnectorInfo: boolean = false;
|
showKeyConnectorInfo: boolean = false;
|
||||||
|
|
||||||
constructor(private fb: FormBuilder, private userService: UserService) {
|
constructor(private fb: FormBuilder, private organizationService: OrganizationService) {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
super.ngOnInit();
|
super.ngOnInit();
|
||||||
const organization = await this.userService.getOrganization(this.policyResponse.organizationId);
|
const organization = await this.organizationService.get(this.policyResponse.organizationId);
|
||||||
this.showKeyConnectorInfo = organization.keyConnectorEnabled;
|
this.showKeyConnectorInfo = organization.keyConnectorEnabled;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ 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 { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
import { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
||||||
|
import { OrganizationService } from 'jslib-common/abstractions/organization.service';
|
||||||
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
|
||||||
|
|
||||||
import { PlanType } from 'jslib-common/enums/planType';
|
import { PlanType } from 'jslib-common/enums/planType';
|
||||||
|
|
||||||
@@ -44,7 +44,7 @@ export class OrganizationSubscriptionComponent implements OnInit {
|
|||||||
constructor(private apiService: ApiService, private platformUtilsService: PlatformUtilsService,
|
constructor(private apiService: ApiService, private platformUtilsService: PlatformUtilsService,
|
||||||
private i18nService: I18nService,
|
private i18nService: I18nService,
|
||||||
private messagingService: MessagingService, private route: ActivatedRoute,
|
private messagingService: MessagingService, private route: ActivatedRoute,
|
||||||
private userService: UserService, private logService: LogService) {
|
private organizationService: OrganizationService, private logService: LogService) {
|
||||||
this.selfHosted = platformUtilsService.isSelfHost();
|
this.selfHosted = platformUtilsService.isSelfHost();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@ export class OrganizationSubscriptionComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
this.userOrg = await this.userService.getOrganization(this.organizationId);
|
this.userOrg = await this.organizationService.get(this.organizationId);
|
||||||
this.sub = await this.apiService.getOrganizationSubscription(this.organizationId);
|
this.sub = await this.apiService.getOrganizationSubscription(this.organizationId);
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { ActivatedRoute } from '@angular/router';
|
import { ActivatedRoute } from '@angular/router';
|
||||||
|
|
||||||
|
import { OrganizationService } from 'jslib-common/abstractions/organization.service';
|
||||||
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-org-settings',
|
selector: 'app-org-settings',
|
||||||
@@ -12,13 +12,13 @@ export class SettingsComponent {
|
|||||||
access2fa = false;
|
access2fa = false;
|
||||||
selfHosted: boolean;
|
selfHosted: boolean;
|
||||||
|
|
||||||
constructor(private route: ActivatedRoute, private userService: UserService,
|
constructor(private route: ActivatedRoute, private organizationService: OrganizationService,
|
||||||
private platformUtilsService: PlatformUtilsService) { }
|
private platformUtilsService: PlatformUtilsService) { }
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.route.parent.params.subscribe(async params => {
|
this.route.parent.params.subscribe(async params => {
|
||||||
this.selfHosted = await this.platformUtilsService.isSelfHost();
|
this.selfHosted = await this.platformUtilsService.isSelfHost();
|
||||||
const organization = await this.userService.getOrganization(params.organizationId);
|
const organization = await this.organizationService.get(params.organizationId);
|
||||||
this.access2fa = organization.use2fa;
|
this.access2fa = organization.use2fa;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { ActivatedRoute } from '@angular/router';
|
|||||||
import { ApiService } from 'jslib-common/abstractions/api.service';
|
import { ApiService } from 'jslib-common/abstractions/api.service';
|
||||||
import { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
import { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
||||||
import { PolicyService } from 'jslib-common/abstractions/policy.service';
|
import { PolicyService } from 'jslib-common/abstractions/policy.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
import { StateService } from 'jslib-common/abstractions/state.service';
|
||||||
|
|
||||||
import { ModalService } from 'jslib-angular/services/modal.service';
|
import { ModalService } from 'jslib-angular/services/modal.service';
|
||||||
|
|
||||||
@@ -18,10 +18,10 @@ import { TwoFactorSetupComponent as BaseTwoFactorSetupComponent } from '../../se
|
|||||||
templateUrl: '../../settings/two-factor-setup.component.html',
|
templateUrl: '../../settings/two-factor-setup.component.html',
|
||||||
})
|
})
|
||||||
export class TwoFactorSetupComponent extends BaseTwoFactorSetupComponent {
|
export class TwoFactorSetupComponent extends BaseTwoFactorSetupComponent {
|
||||||
constructor(apiService: ApiService, userService: UserService,
|
constructor(apiService: ApiService,
|
||||||
modalService: ModalService, messagingService: MessagingService,
|
modalService: ModalService, messagingService: MessagingService,
|
||||||
policyService: PolicyService, private route: ActivatedRoute) {
|
policyService: PolicyService, private route: ActivatedRoute, stateService: StateService) {
|
||||||
super(apiService, userService, modalService, messagingService, policyService);
|
super(apiService, modalService, messagingService, policyService, stateService);
|
||||||
}
|
}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ import { ValidationService } from 'jslib-angular/services/validation.service';
|
|||||||
|
|
||||||
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 { OrganizationService } from 'jslib-common/abstractions/organization.service';
|
||||||
import { SyncService } from 'jslib-common/abstractions/sync.service';
|
import { SyncService } from 'jslib-common/abstractions/sync.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
|
||||||
|
|
||||||
import { PlanSponsorshipType } from 'jslib-common/enums/planSponsorshipType';
|
import { PlanSponsorshipType } from 'jslib-common/enums/planSponsorshipType';
|
||||||
import { PlanType } from 'jslib-common/enums/planType';
|
import { PlanType } from 'jslib-common/enums/planType';
|
||||||
@@ -65,7 +65,7 @@ export class FamiliesForEnterpriseSetupComponent implements OnInit {
|
|||||||
constructor(private router: Router, private platformUtilsService: PlatformUtilsService,
|
constructor(private router: Router, private platformUtilsService: PlatformUtilsService,
|
||||||
private i18nService: I18nService, private route: ActivatedRoute,
|
private i18nService: I18nService, private route: ActivatedRoute,
|
||||||
private apiService: ApiService, private syncService: SyncService,
|
private apiService: ApiService, private syncService: SyncService,
|
||||||
private validationService: ValidationService, private userService: UserService,
|
private validationService: ValidationService, private organizationService: OrganizationService,
|
||||||
private modalService: ModalService) { }
|
private modalService: ModalService) { }
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
@@ -85,7 +85,7 @@ export class FamiliesForEnterpriseSetupComponent implements OnInit {
|
|||||||
this.badToken = !await this.apiService.postPreValidateSponsorshipToken(this.token);
|
this.badToken = !await this.apiService.postPreValidateSponsorshipToken(this.token);
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
|
|
||||||
this.existingFamilyOrganizations = (await this.userService.getAllOrganizations())
|
this.existingFamilyOrganizations = (await this.organizationService.getAll())
|
||||||
.filter(o => o.planProductType === ProductType.Families);
|
.filter(o => o.planProductType === ProductType.Families);
|
||||||
|
|
||||||
if (this.existingFamilyOrganizations.length === 0) {
|
if (this.existingFamilyOrganizations.length === 0) {
|
||||||
|
|||||||
@@ -4,8 +4,9 @@ import { ActivatedRoute } from '@angular/router';
|
|||||||
import { AuditService } from 'jslib-common/abstractions/audit.service';
|
import { AuditService } from 'jslib-common/abstractions/audit.service';
|
||||||
import { CipherService } from 'jslib-common/abstractions/cipher.service';
|
import { CipherService } from 'jslib-common/abstractions/cipher.service';
|
||||||
import { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
import { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
||||||
|
import { OrganizationService } from 'jslib-common/abstractions/organization.service';
|
||||||
import { PasswordRepromptService } from 'jslib-common/abstractions/passwordReprompt.service';
|
import { PasswordRepromptService } from 'jslib-common/abstractions/passwordReprompt.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
import { StateService } from 'jslib-common/abstractions/state.service';
|
||||||
|
|
||||||
import { ModalService } from 'jslib-angular/services/modal.service';
|
import { ModalService } from 'jslib-angular/services/modal.service';
|
||||||
|
|
||||||
@@ -16,6 +17,7 @@ import {
|
|||||||
import { Cipher } from 'jslib-common/models/domain/cipher';
|
import { Cipher } from 'jslib-common/models/domain/cipher';
|
||||||
import { CipherView } from 'jslib-common/models/view/cipherView';
|
import { CipherView } from 'jslib-common/models/view/cipherView';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-exposed-passwords-report',
|
selector: 'app-exposed-passwords-report',
|
||||||
templateUrl: '../../tools/exposed-passwords-report.component.html',
|
templateUrl: '../../tools/exposed-passwords-report.component.html',
|
||||||
@@ -24,15 +26,16 @@ export class ExposedPasswordsReportComponent extends BaseExposedPasswordsReportC
|
|||||||
manageableCiphers: Cipher[];
|
manageableCiphers: Cipher[];
|
||||||
|
|
||||||
constructor(cipherService: CipherService, auditService: AuditService,
|
constructor(cipherService: CipherService, auditService: AuditService,
|
||||||
modalService: ModalService, messagingService: MessagingService,
|
modalService: ModalService, messagingService: MessagingService, stateService: StateService,
|
||||||
userService: UserService, passwordRepromptService: PasswordRepromptService, private route: ActivatedRoute) {
|
private organizationService: OrganizationService, private route: ActivatedRoute,
|
||||||
super(cipherService, auditService, modalService, messagingService, userService, passwordRepromptService);
|
passwordRepromptService: PasswordRepromptService) {
|
||||||
|
super(cipherService, auditService, modalService, messagingService, stateService, passwordRepromptService);
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
const dynamicSuper = Object.getPrototypeOf(this.constructor.prototype);
|
const dynamicSuper = Object.getPrototypeOf(this.constructor.prototype);
|
||||||
this.route.parent.parent.params.subscribe(async params => {
|
this.route.parent.parent.params.subscribe(async params => {
|
||||||
this.organization = await this.userService.getOrganization(params.organizationId);
|
this.organization = await this.organizationService.get(params.organizationId);
|
||||||
this.manageableCiphers = await this.cipherService.getAll();
|
this.manageableCiphers = await this.cipherService.getAll();
|
||||||
// TODO: We should do something about this, calling super in an async function is bad
|
// TODO: We should do something about this, calling super in an async function is bad
|
||||||
dynamicSuper.ngOnInit();
|
dynamicSuper.ngOnInit();
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ import {
|
|||||||
import { I18nService } from 'jslib-common/abstractions/i18n.service';
|
import { I18nService } from 'jslib-common/abstractions/i18n.service';
|
||||||
import { ImportService } from 'jslib-common/abstractions/import.service';
|
import { ImportService } from 'jslib-common/abstractions/import.service';
|
||||||
import { LogService } from 'jslib-common/abstractions/log.service';
|
import { LogService } from 'jslib-common/abstractions/log.service';
|
||||||
|
import { OrganizationService } from 'jslib-common/abstractions/organization.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 { UserService } from 'jslib-common/abstractions/user.service';
|
|
||||||
|
|
||||||
import { ImportComponent as BaseImportComponent } from '../../tools/import.component';
|
import { ImportComponent as BaseImportComponent } from '../../tools/import.component';
|
||||||
|
|
||||||
@@ -20,11 +20,24 @@ import { ImportComponent as BaseImportComponent } from '../../tools/import.compo
|
|||||||
export class ImportComponent extends BaseImportComponent {
|
export class ImportComponent extends BaseImportComponent {
|
||||||
organizationName: string;
|
organizationName: string;
|
||||||
|
|
||||||
constructor(i18nService: I18nService,
|
constructor(
|
||||||
importService: ImportService, router: Router, private route: ActivatedRoute,
|
i18nService: I18nService,
|
||||||
platformUtilsService: PlatformUtilsService, policyService: PolicyService,
|
importService: ImportService,
|
||||||
private userService: UserService, logService: LogService) {
|
router: Router,
|
||||||
super(i18nService, importService, router, platformUtilsService, policyService, logService);
|
private route: ActivatedRoute,
|
||||||
|
platformUtilsService: PlatformUtilsService,
|
||||||
|
policyService: PolicyService,
|
||||||
|
private organizationService: OrganizationService,
|
||||||
|
logService: LogService
|
||||||
|
) {
|
||||||
|
super(
|
||||||
|
i18nService,
|
||||||
|
importService,
|
||||||
|
router,
|
||||||
|
platformUtilsService,
|
||||||
|
policyService,
|
||||||
|
logService
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
@@ -34,7 +47,7 @@ export class ImportComponent extends BaseImportComponent {
|
|||||||
await super.ngOnInit();
|
await super.ngOnInit();
|
||||||
this.importBlockedByPolicy = false;
|
this.importBlockedByPolicy = false;
|
||||||
});
|
});
|
||||||
const organization = await this.userService.getOrganization(this.organizationId);
|
const organization = await this.organizationService.get(this.organizationId);
|
||||||
this.organizationName = organization.name;
|
this.organizationName = organization.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,9 @@ import { ActivatedRoute } from '@angular/router';
|
|||||||
import { CipherService } from 'jslib-common/abstractions/cipher.service';
|
import { CipherService } from 'jslib-common/abstractions/cipher.service';
|
||||||
import { LogService } from 'jslib-common/abstractions/log.service';
|
import { LogService } from 'jslib-common/abstractions/log.service';
|
||||||
import { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
import { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
||||||
|
import { OrganizationService } from 'jslib-common/abstractions/organization.service';
|
||||||
import { PasswordRepromptService } from 'jslib-common/abstractions/passwordReprompt.service';
|
import { PasswordRepromptService } from 'jslib-common/abstractions/passwordReprompt.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
import { StateService } from 'jslib-common/abstractions/state.service';
|
||||||
|
|
||||||
import { ModalService } from 'jslib-angular/services/modal.service';
|
import { ModalService } from 'jslib-angular/services/modal.service';
|
||||||
|
|
||||||
@@ -15,20 +16,22 @@ import {
|
|||||||
|
|
||||||
import { CipherView } from 'jslib-common/models/view/cipherView';
|
import { CipherView } from 'jslib-common/models/view/cipherView';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-inactive-two-factor-report',
|
selector: 'app-inactive-two-factor-report',
|
||||||
templateUrl: '../../tools/inactive-two-factor-report.component.html',
|
templateUrl: '../../tools/inactive-two-factor-report.component.html',
|
||||||
})
|
})
|
||||||
export class InactiveTwoFactorReportComponent extends BaseInactiveTwoFactorReportComponent {
|
export class InactiveTwoFactorReportComponent extends BaseInactiveTwoFactorReportComponent {
|
||||||
constructor(cipherService: CipherService, modalService: ModalService,
|
constructor(cipherService: CipherService, modalService: ModalService,
|
||||||
messagingService: MessagingService, userService: UserService,
|
messagingService: MessagingService, stateService: StateService,
|
||||||
private route: ActivatedRoute, logService: LogService, passwordRepromptService: PasswordRepromptService) {
|
private route: ActivatedRoute, logService: LogService, passwordRepromptService: PasswordRepromptService,
|
||||||
super(cipherService, modalService, messagingService, userService, logService, passwordRepromptService);
|
private organizationService: OrganizationService) {
|
||||||
|
super(cipherService, modalService, messagingService, stateService, logService, passwordRepromptService);
|
||||||
}
|
}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
this.route.parent.parent.params.subscribe(async params => {
|
this.route.parent.parent.params.subscribe(async params => {
|
||||||
this.organization = await this.userService.getOrganization(params.organizationId);
|
this.organization = await this.organizationService.get(params.organizationId);
|
||||||
await super.ngOnInit();
|
await super.ngOnInit();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,8 +3,9 @@ import { ActivatedRoute } from '@angular/router';
|
|||||||
|
|
||||||
import { CipherService } from 'jslib-common/abstractions/cipher.service';
|
import { CipherService } from 'jslib-common/abstractions/cipher.service';
|
||||||
import { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
import { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
||||||
|
import { OrganizationService } from 'jslib-common/abstractions/organization.service';
|
||||||
import { PasswordRepromptService } from 'jslib-common/abstractions/passwordReprompt.service';
|
import { PasswordRepromptService } from 'jslib-common/abstractions/passwordReprompt.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
import { StateService } from 'jslib-common/abstractions/state.service';
|
||||||
|
|
||||||
import { ModalService } from 'jslib-angular/services/modal.service';
|
import { ModalService } from 'jslib-angular/services/modal.service';
|
||||||
|
|
||||||
@@ -24,14 +25,15 @@ export class ReusedPasswordsReportComponent extends BaseReusedPasswordsReportCom
|
|||||||
manageableCiphers: Cipher[];
|
manageableCiphers: Cipher[];
|
||||||
|
|
||||||
constructor(cipherService: CipherService, modalService: ModalService,
|
constructor(cipherService: CipherService, modalService: ModalService,
|
||||||
messagingService: MessagingService, userService: UserService, passwordRepromptService: PasswordRepromptService,
|
messagingService: MessagingService, stateService: StateService,
|
||||||
private route: ActivatedRoute) {
|
private route: ActivatedRoute, private organizationService: OrganizationService,
|
||||||
super(cipherService, modalService, messagingService, userService, passwordRepromptService);
|
passwordRepromptService: PasswordRepromptService) {
|
||||||
|
super(cipherService, modalService, messagingService, stateService, passwordRepromptService);
|
||||||
}
|
}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
this.route.parent.parent.params.subscribe(async params => {
|
this.route.parent.parent.params.subscribe(async params => {
|
||||||
this.organization = await this.userService.getOrganization(params.organizationId);
|
this.organization = await this.organizationService.get(params.organizationId);
|
||||||
this.manageableCiphers = await this.cipherService.getAll();
|
this.manageableCiphers = await this.cipherService.getAll();
|
||||||
await super.ngOnInit();
|
await super.ngOnInit();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { ActivatedRoute } from '@angular/router';
|
|||||||
import { Organization } from 'jslib-common/models/domain/organization';
|
import { Organization } from 'jslib-common/models/domain/organization';
|
||||||
|
|
||||||
import { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
import { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
import { OrganizationService } from 'jslib-common/abstractions/organization.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-org-tools',
|
selector: 'app-org-tools',
|
||||||
@@ -15,12 +15,12 @@ export class ToolsComponent {
|
|||||||
accessReports = false;
|
accessReports = false;
|
||||||
loading = true;
|
loading = true;
|
||||||
|
|
||||||
constructor(private route: ActivatedRoute, private userService: UserService,
|
constructor(private route: ActivatedRoute, private organizationService: OrganizationService,
|
||||||
private messagingService: MessagingService) { }
|
private messagingService: MessagingService) { }
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.route.parent.params.subscribe(async params => {
|
this.route.parent.params.subscribe(async params => {
|
||||||
this.organization = await this.userService.getOrganization(params.organizationId);
|
this.organization = await this.organizationService.get(params.organizationId);
|
||||||
// TODO: Maybe we want to just make sure they are not on a free plan? Just compare useTotp for now
|
// TODO: Maybe we want to just make sure they are not on a free plan? Just compare useTotp for now
|
||||||
// since all paid plans include useTotp
|
// since all paid plans include useTotp
|
||||||
this.accessReports = this.organization.useTotp;
|
this.accessReports = this.organization.useTotp;
|
||||||
|
|||||||
@@ -3,8 +3,9 @@ import { ActivatedRoute } from '@angular/router';
|
|||||||
|
|
||||||
import { CipherService } from 'jslib-common/abstractions/cipher.service';
|
import { CipherService } from 'jslib-common/abstractions/cipher.service';
|
||||||
import { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
import { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
||||||
|
import { OrganizationService } from 'jslib-common/abstractions/organization.service';
|
||||||
import { PasswordRepromptService } from 'jslib-common/abstractions/passwordReprompt.service';
|
import { PasswordRepromptService } from 'jslib-common/abstractions/passwordReprompt.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
import { StateService } from 'jslib-common/abstractions/state.service';
|
||||||
|
|
||||||
import { ModalService } from 'jslib-angular/services/modal.service';
|
import { ModalService } from 'jslib-angular/services/modal.service';
|
||||||
|
|
||||||
@@ -20,14 +21,15 @@ import { CipherView } from 'jslib-common/models/view/cipherView';
|
|||||||
})
|
})
|
||||||
export class UnsecuredWebsitesReportComponent extends BaseUnsecuredWebsitesReportComponent {
|
export class UnsecuredWebsitesReportComponent extends BaseUnsecuredWebsitesReportComponent {
|
||||||
constructor(cipherService: CipherService, modalService: ModalService,
|
constructor(cipherService: CipherService, modalService: ModalService,
|
||||||
messagingService: MessagingService, userService: UserService, passwordRepromptService: PasswordRepromptService,
|
messagingService: MessagingService, stateService: StateService,
|
||||||
private route: ActivatedRoute) {
|
private route: ActivatedRoute, private organizationService: OrganizationService,
|
||||||
super(cipherService, modalService, messagingService, userService, passwordRepromptService);
|
passwordRepromptService: PasswordRepromptService) {
|
||||||
|
super(cipherService, modalService, messagingService, stateService, passwordRepromptService);
|
||||||
}
|
}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
this.route.parent.parent.params.subscribe(async params => {
|
this.route.parent.parent.params.subscribe(async params => {
|
||||||
this.organization = await this.userService.getOrganization(params.organizationId);
|
this.organization = await this.organizationService.get(params.organizationId);
|
||||||
await super.ngOnInit();
|
await super.ngOnInit();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,9 +3,10 @@ import { ActivatedRoute } from '@angular/router';
|
|||||||
|
|
||||||
import { CipherService } from 'jslib-common/abstractions/cipher.service';
|
import { CipherService } from 'jslib-common/abstractions/cipher.service';
|
||||||
import { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
import { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
||||||
|
import { OrganizationService } from 'jslib-common/abstractions/organization.service';
|
||||||
import { PasswordGenerationService } from 'jslib-common/abstractions/passwordGeneration.service';
|
import { PasswordGenerationService } from 'jslib-common/abstractions/passwordGeneration.service';
|
||||||
import { PasswordRepromptService } from 'jslib-common/abstractions/passwordReprompt.service';
|
import { PasswordRepromptService } from 'jslib-common/abstractions/passwordReprompt.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
import { StateService } from 'jslib-common/abstractions/state.service';
|
||||||
|
|
||||||
import { ModalService } from 'jslib-angular/services/modal.service';
|
import { ModalService } from 'jslib-angular/services/modal.service';
|
||||||
|
|
||||||
@@ -26,14 +27,14 @@ export class WeakPasswordsReportComponent extends BaseWeakPasswordsReportCompone
|
|||||||
|
|
||||||
constructor(cipherService: CipherService, passwordGenerationService: PasswordGenerationService,
|
constructor(cipherService: CipherService, passwordGenerationService: PasswordGenerationService,
|
||||||
modalService: ModalService, messagingService: MessagingService,
|
modalService: ModalService, messagingService: MessagingService,
|
||||||
userService: UserService, passwordRepromptService: PasswordRepromptService, private route: ActivatedRoute) {
|
stateService: StateService, private route: ActivatedRoute,
|
||||||
super(cipherService, passwordGenerationService, modalService, messagingService, userService,
|
private organizationService: OrganizationService, passwordRepromptService: PasswordRepromptService) {
|
||||||
passwordRepromptService);
|
super(cipherService, passwordGenerationService, modalService, messagingService, stateService, passwordRepromptService);
|
||||||
}
|
}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
this.route.parent.parent.params.subscribe(async params => {
|
this.route.parent.parent.params.subscribe(async params => {
|
||||||
this.organization = await this.userService.getOrganization(params.organizationId);
|
this.organization = await this.organizationService.get(params.organizationId);
|
||||||
this.manageableCiphers = await this.cipherService.getAll();
|
this.manageableCiphers = await this.cipherService.getAll();
|
||||||
await super.ngOnInit();
|
await super.ngOnInit();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -9,13 +9,13 @@ 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 { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
import { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
||||||
|
import { OrganizationService } from 'jslib-common/abstractions/organization.service';
|
||||||
import { PasswordGenerationService } from 'jslib-common/abstractions/passwordGeneration.service';
|
import { PasswordGenerationService } from 'jslib-common/abstractions/passwordGeneration.service';
|
||||||
import { PasswordRepromptService } from 'jslib-common/abstractions/passwordReprompt.service';
|
import { PasswordRepromptService } from 'jslib-common/abstractions/passwordReprompt.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 { StateService } from 'jslib-common/abstractions/state.service';
|
import { StateService } from 'jslib-common/abstractions/state.service';
|
||||||
import { TotpService } from 'jslib-common/abstractions/totp.service';
|
import { TotpService } from 'jslib-common/abstractions/totp.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
|
||||||
|
|
||||||
import { CipherData } from 'jslib-common/models/data/cipherData';
|
import { CipherData } from 'jslib-common/models/data/cipherData';
|
||||||
import { Cipher } from 'jslib-common/models/domain/cipher';
|
import { Cipher } from 'jslib-common/models/domain/cipher';
|
||||||
@@ -36,14 +36,14 @@ export class AddEditComponent extends BaseAddEditComponent {
|
|||||||
constructor(cipherService: CipherService, folderService: FolderService,
|
constructor(cipherService: CipherService, folderService: FolderService,
|
||||||
i18nService: I18nService, platformUtilsService: PlatformUtilsService,
|
i18nService: I18nService, platformUtilsService: PlatformUtilsService,
|
||||||
auditService: AuditService, stateService: StateService,
|
auditService: AuditService, stateService: StateService,
|
||||||
userService: UserService, collectionService: CollectionService,
|
collectionService: CollectionService, totpService: TotpService,
|
||||||
totpService: TotpService, passwordGenerationService: PasswordGenerationService,
|
passwordGenerationService: PasswordGenerationService, private apiService: ApiService,
|
||||||
private apiService: ApiService, messagingService: MessagingService,
|
messagingService: MessagingService, eventService: EventService,
|
||||||
eventService: EventService, policyService: PolicyService, logService: LogService,
|
policyService: PolicyService, logService: LogService,
|
||||||
passwordRepromptService: PasswordRepromptService) {
|
passwordRepromptService: PasswordRepromptService, organizationService: OrganizationService) {
|
||||||
super(cipherService, folderService, i18nService, platformUtilsService, auditService, stateService,
|
super(cipherService, folderService, i18nService, platformUtilsService, auditService, stateService,
|
||||||
userService, collectionService, totpService, passwordGenerationService, messagingService,
|
collectionService, totpService, passwordGenerationService, messagingService,
|
||||||
eventService, policyService, passwordRepromptService, logService);
|
eventService, policyService, organizationService, logService, passwordRepromptService);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected allowOwnershipAssignment() {
|
protected allowOwnershipAssignment() {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ 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 { 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 { UserService } from 'jslib-common/abstractions/user.service';
|
import { StateService } from 'jslib-common/abstractions/state.service';
|
||||||
|
|
||||||
import { CipherData } from 'jslib-common/models/data/cipherData';
|
import { CipherData } from 'jslib-common/models/data/cipherData';
|
||||||
import { Cipher } from 'jslib-common/models/domain/cipher';
|
import { Cipher } from 'jslib-common/models/domain/cipher';
|
||||||
@@ -25,11 +25,9 @@ export class AttachmentsComponent extends BaseAttachmentsComponent {
|
|||||||
organization: Organization;
|
organization: Organization;
|
||||||
|
|
||||||
constructor(cipherService: CipherService, i18nService: I18nService,
|
constructor(cipherService: CipherService, i18nService: I18nService,
|
||||||
cryptoService: CryptoService, userService: UserService,
|
cryptoService: CryptoService, stateService: StateService,
|
||||||
platformUtilsService: PlatformUtilsService, apiService: ApiService,
|
platformUtilsService: PlatformUtilsService, apiService: ApiService, logService: LogService) {
|
||||||
logService: LogService) {
|
super(cipherService, i18nService, cryptoService, stateService, platformUtilsService, apiService, logService);
|
||||||
super(cipherService, i18nService, cryptoService, userService, platformUtilsService, apiService,
|
|
||||||
logService);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async reupload(attachment: AttachmentView) {
|
protected async reupload(attachment: AttachmentView) {
|
||||||
|
|||||||
@@ -12,10 +12,11 @@ import { LogService } from 'jslib-common/abstractions/log.service';
|
|||||||
import { PasswordRepromptService } from 'jslib-common/abstractions/passwordReprompt.service';
|
import { PasswordRepromptService } from 'jslib-common/abstractions/passwordReprompt.service';
|
||||||
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
||||||
import { SearchService } from 'jslib-common/abstractions/search.service';
|
import { SearchService } from 'jslib-common/abstractions/search.service';
|
||||||
|
import { StateService } from 'jslib-common/abstractions/state.service';
|
||||||
import { TotpService } from 'jslib-common/abstractions/totp.service';
|
import { TotpService } from 'jslib-common/abstractions/totp.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
|
||||||
|
|
||||||
import { Organization } from 'jslib-common/models/domain/organization';
|
import { Organization } from 'jslib-common/models/domain/organization';
|
||||||
|
|
||||||
import { CipherView } from 'jslib-common/models/view/cipherView';
|
import { CipherView } from 'jslib-common/models/view/cipherView';
|
||||||
|
|
||||||
import { CiphersComponent as BaseCiphersComponent } from '../../vault/ciphers.component';
|
import { CiphersComponent as BaseCiphersComponent } from '../../vault/ciphers.component';
|
||||||
@@ -32,13 +33,29 @@ export class CiphersComponent extends BaseCiphersComponent {
|
|||||||
|
|
||||||
protected allCiphers: CipherView[] = [];
|
protected allCiphers: CipherView[] = [];
|
||||||
|
|
||||||
constructor(searchService: SearchService, i18nService: I18nService,
|
constructor(
|
||||||
platformUtilsService: PlatformUtilsService, cipherService: CipherService,
|
searchService: SearchService,
|
||||||
private apiService: ApiService, eventService: EventService, totpService: TotpService,
|
i18nService: I18nService,
|
||||||
userService: UserService, passwordRepromptService: PasswordRepromptService,
|
platformUtilsService: PlatformUtilsService,
|
||||||
logService: LogService) {
|
cipherService: CipherService,
|
||||||
super(searchService, i18nService, platformUtilsService, cipherService,
|
private apiService: ApiService,
|
||||||
eventService, totpService, userService, passwordRepromptService, logService);
|
eventService: EventService,
|
||||||
|
totpService: TotpService,
|
||||||
|
passwordRepromptService: PasswordRepromptService,
|
||||||
|
logService: LogService,
|
||||||
|
stateService: StateService,
|
||||||
|
) {
|
||||||
|
super(
|
||||||
|
searchService,
|
||||||
|
i18nService,
|
||||||
|
platformUtilsService,
|
||||||
|
cipherService,
|
||||||
|
eventService,
|
||||||
|
totpService,
|
||||||
|
stateService,
|
||||||
|
passwordRepromptService,
|
||||||
|
logService
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async load(filter: (cipher: CipherView) => boolean = null) {
|
async load(filter: (cipher: CipherView) => boolean = null) {
|
||||||
|
|||||||
@@ -4,8 +4,7 @@ import { ApiService } from 'jslib-common/abstractions/api.service';
|
|||||||
import { CollectionService } from 'jslib-common/abstractions/collection.service';
|
import { CollectionService } from 'jslib-common/abstractions/collection.service';
|
||||||
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 { StorageService } from 'jslib-common/abstractions/storage.service';
|
import { StateService } from 'jslib-common/abstractions/state.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
|
||||||
|
|
||||||
import { CollectionData } from 'jslib-common/models/data/collectionData';
|
import { CollectionData } from 'jslib-common/models/data/collectionData';
|
||||||
import { Collection } from 'jslib-common/models/domain/collection';
|
import { Collection } from 'jslib-common/models/domain/collection';
|
||||||
@@ -23,9 +22,9 @@ export class GroupingsComponent extends BaseGroupingsComponent {
|
|||||||
organization: Organization;
|
organization: Organization;
|
||||||
|
|
||||||
constructor(collectionService: CollectionService, folderService: FolderService,
|
constructor(collectionService: CollectionService, folderService: FolderService,
|
||||||
storageService: StorageService, userService: UserService,
|
stateService: StateService, private apiService: ApiService,
|
||||||
private apiService: ApiService, private i18nService: I18nService) {
|
private i18nService: I18nService) {
|
||||||
super(collectionService, folderService, storageService, userService);
|
super(collectionService, folderService, stateService);
|
||||||
}
|
}
|
||||||
|
|
||||||
async loadCollections() {
|
async loadCollections() {
|
||||||
@@ -52,8 +51,8 @@ export class GroupingsComponent extends BaseGroupingsComponent {
|
|||||||
this.nestedCollections = await this.collectionService.getAllNested(this.collections);
|
this.nestedCollections = await this.collectionService.getAllNested(this.collections);
|
||||||
}
|
}
|
||||||
|
|
||||||
collapse(grouping: CollectionView) {
|
async collapse(grouping: CollectionView) {
|
||||||
super.collapse(grouping, 'org_');
|
await super.collapse(grouping, 'org_');
|
||||||
}
|
}
|
||||||
|
|
||||||
isCollapsed(grouping: CollectionView) {
|
isCollapsed(grouping: CollectionView) {
|
||||||
|
|||||||
@@ -17,9 +17,9 @@ import { first } from 'rxjs/operators';
|
|||||||
import { BroadcasterService } from 'jslib-common/abstractions/broadcaster.service';
|
import { BroadcasterService } from 'jslib-common/abstractions/broadcaster.service';
|
||||||
import { I18nService } from 'jslib-common/abstractions/i18n.service';
|
import { I18nService } from 'jslib-common/abstractions/i18n.service';
|
||||||
import { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
import { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
||||||
|
import { OrganizationService } from 'jslib-common/abstractions/organization.service';
|
||||||
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
||||||
import { SyncService } from 'jslib-common/abstractions/sync.service';
|
import { SyncService } from 'jslib-common/abstractions/sync.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
|
||||||
|
|
||||||
import { ModalService } from 'jslib-angular/services/modal.service';
|
import { ModalService } from 'jslib-angular/services/modal.service';
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ export class VaultComponent implements OnInit, OnDestroy {
|
|||||||
deleted: boolean = false;
|
deleted: boolean = false;
|
||||||
trashCleanupWarning: string = null;
|
trashCleanupWarning: string = null;
|
||||||
|
|
||||||
constructor(private route: ActivatedRoute, private userService: UserService,
|
constructor(private route: ActivatedRoute, private organizationService: OrganizationService,
|
||||||
private router: Router, private changeDetectorRef: ChangeDetectorRef,
|
private router: Router, private changeDetectorRef: ChangeDetectorRef,
|
||||||
private syncService: SyncService, private i18nService: I18nService,
|
private syncService: SyncService, private i18nService: I18nService,
|
||||||
private modalService: ModalService, private messagingService: MessagingService,
|
private modalService: ModalService, private messagingService: MessagingService,
|
||||||
@@ -66,9 +66,8 @@ export class VaultComponent implements OnInit, OnDestroy {
|
|||||||
this.trashCleanupWarning = this.i18nService.t(
|
this.trashCleanupWarning = this.i18nService.t(
|
||||||
this.platformUtilsService.isSelfHost() ? 'trashCleanupWarningSelfHosted' : 'trashCleanupWarning'
|
this.platformUtilsService.isSelfHost() ? 'trashCleanupWarningSelfHosted' : 'trashCleanupWarning'
|
||||||
);
|
);
|
||||||
|
|
||||||
this.route.parent.params.pipe(first()).subscribe(async params => {
|
this.route.parent.params.pipe(first()).subscribe(async params => {
|
||||||
this.organization = await this.userService.getOrganization(params.organizationId);
|
this.organization = await this.organizationService.get(params.organizationId);
|
||||||
this.groupingsComponent.organization = this.organization;
|
this.groupingsComponent.organization = this.organization;
|
||||||
this.ciphersComponent.organization = this.organization;
|
this.ciphersComponent.organization = this.organization;
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import {
|
|||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
|
|
||||||
import { I18nService } from 'jslib-common/abstractions/i18n.service';
|
import { I18nService } from 'jslib-common/abstractions/i18n.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
import { ProviderService } from 'jslib-common/abstractions/provider.service';
|
||||||
|
|
||||||
import { Provider } from 'jslib-common/models/domain/provider';
|
import { Provider } from 'jslib-common/models/domain/provider';
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@ export class ProvidersComponent implements OnInit {
|
|||||||
loaded: boolean = false;
|
loaded: boolean = false;
|
||||||
actionPromise: Promise<any>;
|
actionPromise: Promise<any>;
|
||||||
|
|
||||||
constructor(private userService: UserService, private i18nService: I18nService) { }
|
constructor(private providerService: ProviderService, private i18nService: I18nService) { }
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
document.body.classList.remove('layout_frontend');
|
document.body.classList.remove('layout_frontend');
|
||||||
@@ -30,7 +30,7 @@ export class ProvidersComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async load() {
|
async load() {
|
||||||
const providers = await this.userService.getAllProviders();
|
const providers = await this.providerService.getAll();
|
||||||
providers.sort(Utils.getSortFunction(this.i18nService, 'name'));
|
providers.sort(Utils.getSortFunction(this.i18nService, 'name'));
|
||||||
this.providers = providers;
|
this.providers = providers;
|
||||||
this.loaded = true;
|
this.loaded = true;
|
||||||
|
|||||||
@@ -4,14 +4,14 @@ import { Component } 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 { LogService } from 'jslib-common/abstractions/log.service';
|
||||||
import { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
import { MessagingService } from 'jslib-common/abstractions/messaging.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 { SendService } from 'jslib-common/abstractions/send.service';
|
import { SendService } from 'jslib-common/abstractions/send.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
import { StateService } from 'jslib-common/abstractions/state.service';
|
||||||
|
|
||||||
import { AddEditComponent as BaseAddEditComponent } from 'jslib-angular/components/send/add-edit.component';
|
import { AddEditComponent as BaseAddEditComponent } from 'jslib-angular/components/send/add-edit.component';
|
||||||
import { LogService } from 'jslib-common/abstractions/log.service';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-send-add-edit',
|
selector: 'app-send-add-edit',
|
||||||
@@ -20,11 +20,11 @@ import { LogService } from 'jslib-common/abstractions/log.service';
|
|||||||
export class AddEditComponent extends BaseAddEditComponent {
|
export class AddEditComponent extends BaseAddEditComponent {
|
||||||
constructor(i18nService: I18nService, platformUtilsService: PlatformUtilsService,
|
constructor(i18nService: I18nService, platformUtilsService: PlatformUtilsService,
|
||||||
environmentService: EnvironmentService, datePipe: DatePipe,
|
environmentService: EnvironmentService, datePipe: DatePipe,
|
||||||
sendService: SendService, userService: UserService,
|
sendService: SendService, stateService: StateService,
|
||||||
messagingService: MessagingService, policyService: PolicyService,
|
messagingService: MessagingService, policyService: PolicyService,
|
||||||
logService: LogService) {
|
logService: LogService) {
|
||||||
super(i18nService, platformUtilsService, environmentService, datePipe, sendService, userService,
|
super(i18nService, platformUtilsService, environmentService, datePipe, sendService,
|
||||||
messagingService, policyService, logService);
|
messagingService, policyService, logService, stateService);
|
||||||
}
|
}
|
||||||
|
|
||||||
async copyLinkToClipboard(link: string): Promise<void | boolean> {
|
async copyLinkToClipboard(link: string): Promise<void | boolean> {
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.se
|
|||||||
import { PolicyService } from 'jslib-common/abstractions/policy.service';
|
import { PolicyService } from 'jslib-common/abstractions/policy.service';
|
||||||
import { SearchService } from 'jslib-common/abstractions/search.service';
|
import { SearchService } from 'jslib-common/abstractions/search.service';
|
||||||
import { SendService } from 'jslib-common/abstractions/send.service';
|
import { SendService } from 'jslib-common/abstractions/send.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
|
||||||
|
|
||||||
import { ModalService } from 'jslib-angular/services/modal.service';
|
import { ModalService } from 'jslib-angular/services/modal.service';
|
||||||
|
|
||||||
@@ -34,11 +33,11 @@ export class SendComponent extends BaseSendComponent {
|
|||||||
|
|
||||||
constructor(sendService: SendService, i18nService: I18nService,
|
constructor(sendService: SendService, i18nService: I18nService,
|
||||||
platformUtilsService: PlatformUtilsService, environmentService: EnvironmentService,
|
platformUtilsService: PlatformUtilsService, environmentService: EnvironmentService,
|
||||||
ngZone: NgZone, searchService: SearchService, policyService: PolicyService, userService: UserService,
|
ngZone: NgZone, searchService: SearchService,
|
||||||
private modalService: ModalService, private broadcasterService: BroadcasterService,
|
policyService: PolicyService, private modalService: ModalService,
|
||||||
logService: LogService) {
|
private broadcasterService: BroadcasterService, logService: LogService) {
|
||||||
super(sendService, i18nService, platformUtilsService, environmentService, ngZone, searchService,
|
super(sendService, i18nService, platformUtilsService, environmentService, ngZone, searchService,
|
||||||
policyService, userService, logService);
|
policyService, logService);
|
||||||
}
|
}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
|
|||||||
@@ -6,16 +6,20 @@ import {
|
|||||||
} from '@angular/router';
|
} from '@angular/router';
|
||||||
|
|
||||||
import { I18nService } from 'jslib-common/abstractions/i18n.service';
|
import { I18nService } from 'jslib-common/abstractions/i18n.service';
|
||||||
|
import { OrganizationService } from 'jslib-common/abstractions/organization.service';
|
||||||
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class OrganizationGuardService implements CanActivate {
|
export class OrganizationGuardService implements CanActivate {
|
||||||
constructor(private userService: UserService, private router: Router,
|
constructor(
|
||||||
private platformUtilsService: PlatformUtilsService, private i18nService: I18nService) { }
|
private router: Router,
|
||||||
|
private platformUtilsService: PlatformUtilsService,
|
||||||
|
private i18nService: I18nService,
|
||||||
|
private organizationService: OrganizationService,
|
||||||
|
) { }
|
||||||
|
|
||||||
async canActivate(route: ActivatedRouteSnapshot) {
|
async canActivate(route: ActivatedRouteSnapshot) {
|
||||||
const org = await this.userService.getOrganization(route.params.organizationId);
|
const org = await this.organizationService.get(route.params.organizationId);
|
||||||
if (org == null) {
|
if (org == null) {
|
||||||
this.router.navigate(['/']);
|
this.router.navigate(['/']);
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -5,16 +5,16 @@ import {
|
|||||||
Router,
|
Router,
|
||||||
} from '@angular/router';
|
} from '@angular/router';
|
||||||
|
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
import { OrganizationService } from 'jslib-common/abstractions/organization.service';
|
||||||
|
|
||||||
import { Permissions } from 'jslib-common/enums/permissions';
|
import { Permissions } from 'jslib-common/enums/permissions';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class OrganizationTypeGuardService implements CanActivate {
|
export class OrganizationTypeGuardService implements CanActivate {
|
||||||
constructor(private userService: UserService, private router: Router) { }
|
constructor(private organizationService: OrganizationService, private router: Router) { }
|
||||||
|
|
||||||
async canActivate(route: ActivatedRouteSnapshot) {
|
async canActivate(route: ActivatedRouteSnapshot) {
|
||||||
const org = await this.userService.getOrganization(route.params.organizationId);
|
const org = await this.organizationService.get(route.params.organizationId);
|
||||||
const permissions = route.data == null ? null : route.data.permissions as Permissions[];
|
const permissions = route.data == null ? null : route.data.permissions as Permissions[];
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ import { JslibServicesModule } from 'jslib-angular/services/jslib-services.modul
|
|||||||
import { ModalService as ModalServiceAbstraction } from 'jslib-angular/services/modal.service';
|
import { ModalService as ModalServiceAbstraction } from 'jslib-angular/services/modal.service';
|
||||||
|
|
||||||
import { AuthService } from 'jslib-common/services/auth.service';
|
import { AuthService } from 'jslib-common/services/auth.service';
|
||||||
import { ConstantsService } from 'jslib-common/services/constants.service';
|
|
||||||
import { ContainerService } from 'jslib-common/services/container.service';
|
import { ContainerService } from 'jslib-common/services/container.service';
|
||||||
import { CryptoService } from 'jslib-common/services/crypto.service';
|
import { CryptoService } from 'jslib-common/services/crypto.service';
|
||||||
import { EventService as EventLoggingService } from 'jslib-common/services/event.service';
|
import { EventService as EventLoggingService } from 'jslib-common/services/event.service';
|
||||||
@@ -57,6 +56,7 @@ export function initFactory(window: Window, storageService: StorageServiceAbstra
|
|||||||
platformUtilsService: PlatformUtilsServiceAbstraction, cryptoService: CryptoServiceAbstraction): Function {
|
platformUtilsService: PlatformUtilsServiceAbstraction, cryptoService: CryptoServiceAbstraction): Function {
|
||||||
return async () => {
|
return async () => {
|
||||||
await (storageService as HtmlStorageService).init();
|
await (storageService as HtmlStorageService).init();
|
||||||
|
await stateService.init();
|
||||||
|
|
||||||
const urls = process.env.URLS as Urls;
|
const urls = process.env.URLS as Urls;
|
||||||
urls.base ??= window.location.origin;
|
urls.base ??= window.location.origin;
|
||||||
@@ -65,7 +65,7 @@ export function initFactory(window: Window, storageService: StorageServiceAbstra
|
|||||||
setTimeout(() => notificationsService.init(), 3000);
|
setTimeout(() => notificationsService.init(), 3000);
|
||||||
|
|
||||||
vaultTimeoutService.init(true);
|
vaultTimeoutService.init(true);
|
||||||
const locale = await storageService.get<string>(ConstantsService.localeKey);
|
const locale = await stateService.getLocale();
|
||||||
await i18nService.init(locale);
|
await i18nService.init(locale);
|
||||||
eventLoggingService.init(true);
|
eventLoggingService.init(true);
|
||||||
authService.init();
|
authService.init();
|
||||||
@@ -74,17 +74,13 @@ export function initFactory(window: Window, storageService: StorageServiceAbstra
|
|||||||
|
|
||||||
// Initial theme is set in index.html which must be updated if there are any changes to theming logic
|
// Initial theme is set in index.html which must be updated if there are any changes to theming logic
|
||||||
platformUtilsService.onDefaultSystemThemeChange(async sysTheme => {
|
platformUtilsService.onDefaultSystemThemeChange(async sysTheme => {
|
||||||
const bwTheme = await storageService.get<ThemeType>(ConstantsService.themeKey);
|
const bwTheme = await stateService.getTheme();
|
||||||
if (bwTheme === ThemeType.System) {
|
if (bwTheme === ThemeType.System) {
|
||||||
htmlEl.classList.remove('theme_' + ThemeType.Light, 'theme_' + ThemeType.Dark);
|
htmlEl.classList.remove('theme_' + ThemeType.Light, 'theme_' + ThemeType.Dark);
|
||||||
htmlEl.classList.add('theme_' + sysTheme);
|
htmlEl.classList.add('theme_' + sysTheme);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
stateService.save(ConstantsService.disableFaviconKey,
|
|
||||||
await storageService.get<boolean>(ConstantsService.disableFaviconKey));
|
|
||||||
stateService.save('enableGravatars', await storageService.get<boolean>('enableGravatars'));
|
|
||||||
|
|
||||||
const containerService = new ContainerService(cryptoService);
|
const containerService = new ContainerService(cryptoService);
|
||||||
containerService.attachToWindow(window);
|
containerService.attachToWindow(window);
|
||||||
};
|
};
|
||||||
@@ -130,13 +126,13 @@ export function initFactory(window: Window, storageService: StorageServiceAbstra
|
|||||||
{
|
{
|
||||||
provide: PlatformUtilsServiceAbstraction,
|
provide: PlatformUtilsServiceAbstraction,
|
||||||
useFactory: (i18nService: I18nServiceAbstraction, messagingService: MessagingServiceAbstraction,
|
useFactory: (i18nService: I18nServiceAbstraction, messagingService: MessagingServiceAbstraction,
|
||||||
logService: LogService, injector: Injector) => new WebPlatformUtilsService(i18nService,
|
logService: LogService, stateService: StateServiceAbstraction) => new WebPlatformUtilsService(i18nService,
|
||||||
messagingService, logService, () => injector.get(StorageServiceAbstraction)),
|
messagingService, logService, stateService),
|
||||||
deps: [
|
deps: [
|
||||||
I18nServiceAbstraction,
|
I18nServiceAbstraction,
|
||||||
MessagingServiceAbstraction,
|
MessagingServiceAbstraction,
|
||||||
LogService,
|
LogService,
|
||||||
Injector, // TODO: Get rid of circular dependency!
|
StateServiceAbstraction,
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{ provide: MessagingServiceAbstraction, useClass: BroadcasterMessagingService },
|
{ provide: MessagingServiceAbstraction, useClass: BroadcasterMessagingService },
|
||||||
@@ -156,19 +152,12 @@ export function initFactory(window: Window, storageService: StorageServiceAbstra
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
provide: CryptoServiceAbstraction,
|
provide: CryptoServiceAbstraction,
|
||||||
useFactory: (storageService: StorageServiceAbstraction, secureStorageService: StorageServiceAbstraction,
|
useClass: CryptoService,
|
||||||
cryptoFunctionService: CryptoFunctionServiceAbstraction,
|
|
||||||
platformUtilsService: PlatformUtilsServiceAbstraction, logService: LogService) => {
|
|
||||||
const storageImplementation = platformUtilsService.isDev() ? storageService : secureStorageService;
|
|
||||||
return new CryptoService(storageService, storageImplementation, cryptoFunctionService,
|
|
||||||
platformUtilsService, logService);
|
|
||||||
},
|
|
||||||
deps: [
|
deps: [
|
||||||
StorageServiceAbstraction,
|
|
||||||
'SECURE_STORAGE',
|
|
||||||
CryptoFunctionServiceAbstraction,
|
CryptoFunctionServiceAbstraction,
|
||||||
PlatformUtilsServiceAbstraction,
|
PlatformUtilsServiceAbstraction,
|
||||||
LogService,
|
LogService,
|
||||||
|
StateServiceAbstraction,
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import { PurgeVaultComponent } from './purge-vault.component';
|
|||||||
|
|
||||||
import { ApiService } from 'jslib-common/abstractions/api.service';
|
import { ApiService } from 'jslib-common/abstractions/api.service';
|
||||||
import { KeyConnectorService } from 'jslib-common/abstractions/keyConnector.service';
|
import { KeyConnectorService } from 'jslib-common/abstractions/keyConnector.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
import { StateService } from 'jslib-common/abstractions/state.service';
|
||||||
|
|
||||||
import { ModalService } from 'jslib-angular/services/modal.service';
|
import { ModalService } from 'jslib-angular/services/modal.service';
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@ export class AccountComponent {
|
|||||||
showChangeEmail = true;
|
showChangeEmail = true;
|
||||||
|
|
||||||
constructor(private modalService: ModalService, private apiService: ApiService,
|
constructor(private modalService: ModalService, private apiService: ApiService,
|
||||||
private userService: UserService, private keyConnectorService: KeyConnectorService) { }
|
private keyConnectorService: KeyConnectorService, private stateService: StateService) { }
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
this.showChangeEmail = this.showChangeKdf = this.showChangePassword =
|
this.showChangeEmail = this.showChangeKdf = this.showChangePassword =
|
||||||
@@ -51,7 +51,7 @@ export class AccountComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async viewUserApiKey() {
|
async viewUserApiKey() {
|
||||||
const entityId = await this.userService.getUserId();
|
const entityId = await this.stateService.getUserId();
|
||||||
await this.modalService.openViewRef(ApiKeyComponent, this.viewUserApiKeyModalRef, comp => {
|
await this.modalService.openViewRef(ApiKeyComponent, this.viewUserApiKeyModalRef, comp => {
|
||||||
comp.keyType = 'user';
|
comp.keyType = 'user';
|
||||||
comp.entityId = entityId;
|
comp.entityId = entityId;
|
||||||
@@ -65,7 +65,7 @@ export class AccountComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async rotateUserApiKey() {
|
async rotateUserApiKey() {
|
||||||
const entityId = await this.userService.getUserId();
|
const entityId = await this.stateService.getUserId();
|
||||||
await this.modalService.openViewRef(ApiKeyComponent, this.rotateUserApiKeyModalRef, comp => {
|
await this.modalService.openViewRef(ApiKeyComponent, this.rotateUserApiKeyModalRef, comp => {
|
||||||
comp.keyType = 'user';
|
comp.keyType = 'user';
|
||||||
comp.isRotation = true;
|
comp.isRotation = true;
|
||||||
|
|||||||
@@ -11,8 +11,9 @@ import {
|
|||||||
import { ApiService } from 'jslib-common/abstractions/api.service';
|
import { ApiService } from 'jslib-common/abstractions/api.service';
|
||||||
import { PayPalConfig } from 'jslib-common/abstractions/environment.service';
|
import { PayPalConfig } from 'jslib-common/abstractions/environment.service';
|
||||||
import { LogService } from 'jslib-common/abstractions/log.service';
|
import { LogService } from 'jslib-common/abstractions/log.service';
|
||||||
|
import { OrganizationService } from 'jslib-common/abstractions/organization.service';
|
||||||
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
import { StateService } from 'jslib-common/abstractions/state.service';
|
||||||
|
|
||||||
import { PaymentMethodType } from 'jslib-common/enums/paymentMethodType';
|
import { PaymentMethodType } from 'jslib-common/enums/paymentMethodType';
|
||||||
|
|
||||||
@@ -45,8 +46,9 @@ export class AddCreditComponent implements OnInit {
|
|||||||
private name: string;
|
private name: string;
|
||||||
private email: string;
|
private email: string;
|
||||||
|
|
||||||
constructor(private userService: UserService, private apiService: ApiService,
|
constructor(private stateService: StateService, private apiService: ApiService,
|
||||||
private platformUtilsService: PlatformUtilsService, private logService: LogService) {
|
private platformUtilsService: PlatformUtilsService, private organizationService: OrganizationService,
|
||||||
|
private logService: LogService) {
|
||||||
const payPalConfig = process.env.PAYPAL_CONFIG as PayPalConfig;
|
const payPalConfig = process.env.PAYPAL_CONFIG as PayPalConfig;
|
||||||
this.ppButtonFormAction = payPalConfig.buttonAction;
|
this.ppButtonFormAction = payPalConfig.buttonAction;
|
||||||
this.ppButtonBusinessId = payPalConfig.businessId;
|
this.ppButtonBusinessId = payPalConfig.businessId;
|
||||||
@@ -58,7 +60,7 @@ export class AddCreditComponent implements OnInit {
|
|||||||
this.creditAmount = '20.00';
|
this.creditAmount = '20.00';
|
||||||
}
|
}
|
||||||
this.ppButtonCustomField = 'organization_id:' + this.organizationId;
|
this.ppButtonCustomField = 'organization_id:' + this.organizationId;
|
||||||
const org = await this.userService.getOrganization(this.organizationId);
|
const org = await this.organizationService.get(this.organizationId);
|
||||||
if (org != null) {
|
if (org != null) {
|
||||||
this.subject = org.name;
|
this.subject = org.name;
|
||||||
this.name = org.name;
|
this.name = org.name;
|
||||||
@@ -67,8 +69,8 @@ export class AddCreditComponent implements OnInit {
|
|||||||
if (this.creditAmount == null) {
|
if (this.creditAmount == null) {
|
||||||
this.creditAmount = '10.00';
|
this.creditAmount = '10.00';
|
||||||
}
|
}
|
||||||
this.userId = await this.userService.getUserId();
|
this.userId = await this.stateService.getUserId();
|
||||||
this.subject = await this.userService.getEmail();
|
this.subject = await this.stateService.getEmail();
|
||||||
this.email = this.subject;
|
this.email = this.subject;
|
||||||
this.ppButtonCustomField = 'user_id:' + this.userId;
|
this.ppButtonCustomField = 'user_id:' + this.userId;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ 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 { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
import { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
||||||
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
import { StateService } from 'jslib-common/abstractions/state.service';
|
||||||
|
|
||||||
import { EmailRequest } from 'jslib-common/models/request/emailRequest';
|
import { EmailRequest } from 'jslib-common/models/request/emailRequest';
|
||||||
import { EmailTokenRequest } from 'jslib-common/models/request/emailTokenRequest';
|
import { EmailTokenRequest } from 'jslib-common/models/request/emailTokenRequest';
|
||||||
@@ -29,10 +29,15 @@ export class ChangeEmailComponent implements OnInit {
|
|||||||
|
|
||||||
formPromise: Promise<any>;
|
formPromise: Promise<any>;
|
||||||
|
|
||||||
constructor(private apiService: ApiService, private i18nService: I18nService,
|
constructor(
|
||||||
private platformUtilsService: PlatformUtilsService, private cryptoService: CryptoService,
|
private apiService: ApiService,
|
||||||
private messagingService: MessagingService, private userService: UserService,
|
private i18nService: I18nService,
|
||||||
private logService: LogService) { }
|
private platformUtilsService: PlatformUtilsService,
|
||||||
|
private cryptoService: CryptoService,
|
||||||
|
private messagingService: MessagingService,
|
||||||
|
private logService: LogService,
|
||||||
|
private stateService: StateService,
|
||||||
|
) { }
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
const twoFactorProviders = await this.apiService.getTwoFactorProviders();
|
const twoFactorProviders = await this.apiService.getTwoFactorProviders();
|
||||||
@@ -64,8 +69,8 @@ export class ChangeEmailComponent implements OnInit {
|
|||||||
request.token = this.token;
|
request.token = this.token;
|
||||||
request.newEmail = this.newEmail;
|
request.newEmail = this.newEmail;
|
||||||
request.masterPasswordHash = await this.cryptoService.hashPassword(this.masterPassword, null);
|
request.masterPasswordHash = await this.cryptoService.hashPassword(this.masterPassword, null);
|
||||||
const kdf = await this.userService.getKdf();
|
const kdf = await this.stateService.getKdfType();
|
||||||
const kdfIterations = await this.userService.getKdfIterations();
|
const kdfIterations = await this.stateService.getKdfIterations();
|
||||||
const newKey = await this.cryptoService.makeKey(this.masterPassword, this.newEmail, kdf, kdfIterations);
|
const newKey = await this.cryptoService.makeKey(this.masterPassword, this.newEmail, kdf, kdfIterations);
|
||||||
request.newMasterPasswordHash = await this.cryptoService.hashPassword(this.masterPassword, newKey);
|
request.newMasterPasswordHash = await this.cryptoService.hashPassword(this.masterPassword, newKey);
|
||||||
const newEncKey = await this.cryptoService.remakeEncKey(newKey);
|
const newEncKey = await this.cryptoService.remakeEncKey(newKey);
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ 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 { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
import { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
||||||
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
import { StateService } from 'jslib-common/abstractions/state.service';
|
||||||
|
|
||||||
import { KdfRequest } from 'jslib-common/models/request/kdfRequest';
|
import { KdfRequest } from 'jslib-common/models/request/kdfRequest';
|
||||||
|
|
||||||
@@ -26,18 +26,23 @@ export class ChangeKdfComponent implements OnInit {
|
|||||||
kdfOptions: any[] = [];
|
kdfOptions: any[] = [];
|
||||||
formPromise: Promise<any>;
|
formPromise: Promise<any>;
|
||||||
|
|
||||||
constructor(private apiService: ApiService, private i18nService: I18nService,
|
constructor(
|
||||||
private platformUtilsService: PlatformUtilsService, private cryptoService: CryptoService,
|
private apiService: ApiService,
|
||||||
private messagingService: MessagingService, private userService: UserService,
|
private i18nService: I18nService,
|
||||||
private logService: LogService) {
|
private platformUtilsService: PlatformUtilsService,
|
||||||
|
private cryptoService: CryptoService,
|
||||||
|
private messagingService: MessagingService,
|
||||||
|
private logService: LogService,
|
||||||
|
private stateService: StateService,
|
||||||
|
) {
|
||||||
this.kdfOptions = [
|
this.kdfOptions = [
|
||||||
{ name: 'PBKDF2 SHA-256', value: KdfType.PBKDF2_SHA256 },
|
{ name: 'PBKDF2 SHA-256', value: KdfType.PBKDF2_SHA256 },
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
this.kdf = await this.userService.getKdf();
|
this.kdf = await this.stateService.getKdfType();
|
||||||
this.kdfIterations = await this.userService.getKdfIterations();
|
this.kdfIterations = await this.stateService.getKdfIterations();
|
||||||
}
|
}
|
||||||
|
|
||||||
async submit() {
|
async submit() {
|
||||||
@@ -51,7 +56,7 @@ export class ChangeKdfComponent implements OnInit {
|
|||||||
request.kdf = this.kdf;
|
request.kdf = this.kdf;
|
||||||
request.kdfIterations = this.kdfIterations;
|
request.kdfIterations = this.kdfIterations;
|
||||||
request.masterPasswordHash = await this.cryptoService.hashPassword(this.masterPassword, null);
|
request.masterPasswordHash = await this.cryptoService.hashPassword(this.masterPassword, null);
|
||||||
const email = await this.userService.getEmail();
|
const email = await this.stateService.getEmail();
|
||||||
const newKey = await this.cryptoService.makeKey(this.masterPassword, email, this.kdf, this.kdfIterations);
|
const newKey = await this.cryptoService.makeKey(this.masterPassword, email, this.kdf, this.kdfIterations);
|
||||||
request.newMasterPasswordHash = await this.cryptoService.hashPassword(this.masterPassword, newKey);
|
request.newMasterPasswordHash = await this.cryptoService.hashPassword(this.masterPassword, newKey);
|
||||||
const newEncKey = await this.cryptoService.remakeEncKey(newKey);
|
const newEncKey = await this.cryptoService.remakeEncKey(newKey);
|
||||||
|
|||||||
@@ -6,12 +6,13 @@ import { CryptoService } from 'jslib-common/abstractions/crypto.service';
|
|||||||
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 { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
import { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
||||||
|
import { OrganizationService } from 'jslib-common/abstractions/organization.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 { PolicyService } from 'jslib-common/abstractions/policy.service';
|
import { PolicyService } from 'jslib-common/abstractions/policy.service';
|
||||||
import { SendService } from 'jslib-common/abstractions/send.service';
|
import { SendService } from 'jslib-common/abstractions/send.service';
|
||||||
|
import { StateService } from 'jslib-common/abstractions/state.service';
|
||||||
import { SyncService } from 'jslib-common/abstractions/sync.service';
|
import { SyncService } from 'jslib-common/abstractions/sync.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
ChangePasswordComponent as BaseChangePasswordComponent,
|
ChangePasswordComponent as BaseChangePasswordComponent,
|
||||||
@@ -41,12 +42,13 @@ export class ChangePasswordComponent extends BaseChangePasswordComponent {
|
|||||||
|
|
||||||
constructor(i18nService: I18nService,
|
constructor(i18nService: I18nService,
|
||||||
cryptoService: CryptoService, messagingService: MessagingService,
|
cryptoService: CryptoService, messagingService: MessagingService,
|
||||||
userService: UserService, passwordGenerationService: PasswordGenerationService,
|
stateService: StateService, passwordGenerationService: PasswordGenerationService,
|
||||||
platformUtilsService: PlatformUtilsService, policyService: PolicyService,
|
platformUtilsService: PlatformUtilsService, policyService: PolicyService,
|
||||||
private folderService: FolderService, private cipherService: CipherService,
|
private folderService: FolderService, private cipherService: CipherService,
|
||||||
private syncService: SyncService, private apiService: ApiService, private sendService: SendService) {
|
private syncService: SyncService, private apiService: ApiService,
|
||||||
super(i18nService, cryptoService, messagingService, userService, passwordGenerationService,
|
private sendService: SendService, private organizationService: OrganizationService) {
|
||||||
platformUtilsService, policyService);
|
super(i18nService, cryptoService, messagingService, passwordGenerationService,
|
||||||
|
platformUtilsService, policyService, stateService);
|
||||||
}
|
}
|
||||||
|
|
||||||
async rotateEncKeyClicked() {
|
async rotateEncKeyClicked() {
|
||||||
@@ -206,7 +208,7 @@ export class ChangePasswordComponent extends BaseChangePasswordComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async updateAllResetPasswordKeys(encKey: SymmetricCryptoKey) {
|
private async updateAllResetPasswordKeys(encKey: SymmetricCryptoKey) {
|
||||||
const orgs = await this.userService.getAllOrganizations();
|
const orgs = await this.organizationService.getAll();
|
||||||
|
|
||||||
for (const org of orgs) {
|
for (const org of orgs) {
|
||||||
// If not already enrolled, skip
|
// If not already enrolled, skip
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ 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 { 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 { UserService } from 'jslib-common/abstractions/user.service';
|
import { StateService } from 'jslib-common/abstractions/state.service';
|
||||||
|
|
||||||
import { AttachmentView } from 'jslib-common/models/view/attachmentView';
|
import { AttachmentView } from 'jslib-common/models/view/attachmentView';
|
||||||
|
|
||||||
@@ -21,11 +21,9 @@ export class EmergencyAccessAttachmentsComponent extends BaseAttachmentsComponen
|
|||||||
canAccessAttachments = true;
|
canAccessAttachments = true;
|
||||||
|
|
||||||
constructor(cipherService: CipherService, i18nService: I18nService,
|
constructor(cipherService: CipherService, i18nService: I18nService,
|
||||||
cryptoService: CryptoService, userService: UserService,
|
cryptoService: CryptoService, stateService: StateService,
|
||||||
platformUtilsService: PlatformUtilsService, apiService: ApiService,
|
platformUtilsService: PlatformUtilsService, apiService: ApiService, logService: LogService) {
|
||||||
logService: LogService) {
|
super(cipherService, i18nService, cryptoService, platformUtilsService, apiService, window, logService, stateService);
|
||||||
super(cipherService, i18nService, cryptoService, userService, platformUtilsService, apiService, window,
|
|
||||||
logService);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async init() {
|
protected async init() {
|
||||||
|
|||||||
@@ -6,12 +6,10 @@ import {
|
|||||||
Output,
|
Output,
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
|
|
||||||
import { ConstantsService } from 'jslib-common/services/constants.service';
|
|
||||||
|
|
||||||
import { ApiService } from 'jslib-common/abstractions/api.service';
|
import { ApiService } from 'jslib-common/abstractions/api.service';
|
||||||
import { CryptoService } from 'jslib-common/abstractions/crypto.service';
|
import { CryptoService } from 'jslib-common/abstractions/crypto.service';
|
||||||
import { LogService } from 'jslib-common/abstractions/log.service';
|
import { LogService } from 'jslib-common/abstractions/log.service';
|
||||||
import { StorageService } from 'jslib-common/abstractions/storage.service';
|
import { StateService } from 'jslib-common/abstractions/state.service';
|
||||||
|
|
||||||
import { Utils } from 'jslib-common/misc/utils';
|
import { Utils } from 'jslib-common/misc/utils';
|
||||||
|
|
||||||
@@ -31,7 +29,7 @@ export class EmergencyAccessConfirmComponent implements OnInit {
|
|||||||
fingerprint: string;
|
fingerprint: string;
|
||||||
|
|
||||||
constructor(private apiService: ApiService, private cryptoService: CryptoService,
|
constructor(private apiService: ApiService, private cryptoService: CryptoService,
|
||||||
private storageService: StorageService, private logService: LogService) { }
|
private stateService: StateService, private logService: LogService) { }
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
try {
|
try {
|
||||||
@@ -55,7 +53,7 @@ export class EmergencyAccessConfirmComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.dontAskAgain) {
|
if (this.dontAskAgain) {
|
||||||
await this.storageService.save(ConstantsService.autoConfirmFingerprints, true);
|
await this.stateService.setAutoConfirmFingerprints(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import { MessagingService } from 'jslib-common/abstractions/messaging.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 { PolicyService } from 'jslib-common/abstractions/policy.service';
|
import { PolicyService } from 'jslib-common/abstractions/policy.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
import { StateService } from 'jslib-common/abstractions/state.service';
|
||||||
|
|
||||||
import { KdfType } from 'jslib-common/enums/kdfType';
|
import { KdfType } from 'jslib-common/enums/kdfType';
|
||||||
import { PolicyData } from 'jslib-common/models/data/policyData';
|
import { PolicyData } from 'jslib-common/models/data/policyData';
|
||||||
@@ -39,13 +39,26 @@ export class EmergencyAccessTakeoverComponent extends ChangePasswordComponent im
|
|||||||
|
|
||||||
formPromise: Promise<any>;
|
formPromise: Promise<any>;
|
||||||
|
|
||||||
constructor(i18nService: I18nService, cryptoService: CryptoService,
|
constructor(
|
||||||
messagingService: MessagingService, userService: UserService,
|
i18nService: I18nService,
|
||||||
|
cryptoService: CryptoService,
|
||||||
|
messagingService: MessagingService,
|
||||||
|
stateService: StateService,
|
||||||
passwordGenerationService: PasswordGenerationService,
|
passwordGenerationService: PasswordGenerationService,
|
||||||
platformUtilsService: PlatformUtilsService, policyService: PolicyService,
|
platformUtilsService: PlatformUtilsService,
|
||||||
private apiService: ApiService, private logService: LogService) {
|
policyService: PolicyService,
|
||||||
super(i18nService, cryptoService, messagingService, userService, passwordGenerationService,
|
private apiService: ApiService,
|
||||||
platformUtilsService, policyService);
|
private logService: LogService
|
||||||
|
) {
|
||||||
|
super(
|
||||||
|
i18nService,
|
||||||
|
cryptoService,
|
||||||
|
messagingService,
|
||||||
|
passwordGenerationService,
|
||||||
|
platformUtilsService,
|
||||||
|
policyService,
|
||||||
|
stateService,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
@@ -54,7 +67,7 @@ export class EmergencyAccessTakeoverComponent extends ChangePasswordComponent im
|
|||||||
const policies = response.data.map((policyResponse: PolicyResponse) => new Policy(new PolicyData(policyResponse)));
|
const policies = response.data.map((policyResponse: PolicyResponse) => new Policy(new PolicyData(policyResponse)));
|
||||||
this.enforcedPolicyOptions = await this.policyService.getMasterPasswordPolicyOptions(policies);
|
this.enforcedPolicyOptions = await this.policyService.getMasterPasswordPolicyOptions(policies);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async submit() {
|
async submit() {
|
||||||
if (!await this.strongPassword()) {
|
if (!await this.strongPassword()) {
|
||||||
|
|||||||
@@ -10,16 +10,17 @@ 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 { LogService } from 'jslib-common/abstractions/log.service';
|
import { LogService } from 'jslib-common/abstractions/log.service';
|
||||||
import { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
import { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
||||||
|
import { OrganizationService } from 'jslib-common/abstractions/organization.service';
|
||||||
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
||||||
import { StorageService } from 'jslib-common/abstractions/storage.service';
|
import { StateService } from 'jslib-common/abstractions/state.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
|
||||||
|
import { EmergencyAccessConfirmRequest } from 'jslib-common/models/request/emergencyAccessConfirmRequest';
|
||||||
|
|
||||||
|
import { EmergencyAccessGranteeDetailsResponse, EmergencyAccessGrantorDetailsResponse } from 'jslib-common/models/response/emergencyAccessResponse';
|
||||||
|
|
||||||
import { EmergencyAccessStatusType } from 'jslib-common/enums/emergencyAccessStatusType';
|
import { EmergencyAccessStatusType } from 'jslib-common/enums/emergencyAccessStatusType';
|
||||||
import { EmergencyAccessType } from 'jslib-common/enums/emergencyAccessType';
|
import { EmergencyAccessType } from 'jslib-common/enums/emergencyAccessType';
|
||||||
import { Utils } from 'jslib-common/misc/utils';
|
import { Utils } from 'jslib-common/misc/utils';
|
||||||
import { EmergencyAccessConfirmRequest } from 'jslib-common/models/request/emergencyAccessConfirmRequest';
|
|
||||||
import { EmergencyAccessGranteeDetailsResponse, EmergencyAccessGrantorDetailsResponse } from 'jslib-common/models/response/emergencyAccessResponse';
|
|
||||||
import { ConstantsService } from 'jslib-common/services/constants.service';
|
|
||||||
|
|
||||||
import { UserNamePipe } from 'jslib-angular/pipes/user-name.pipe';
|
import { UserNamePipe } from 'jslib-angular/pipes/user-name.pipe';
|
||||||
|
|
||||||
@@ -35,7 +36,7 @@ import { ModalService } from 'jslib-angular/services/modal.service';
|
|||||||
})
|
})
|
||||||
export class EmergencyAccessComponent implements OnInit {
|
export class EmergencyAccessComponent implements OnInit {
|
||||||
@ViewChild('addEdit', { read: ViewContainerRef, static: true }) addEditModalRef: ViewContainerRef;
|
@ViewChild('addEdit', { read: ViewContainerRef, static: true }) addEditModalRef: ViewContainerRef;
|
||||||
@ViewChild('takeoverTemplate', { read: ViewContainerRef, static: true}) takeoverModalRef: ViewContainerRef;
|
@ViewChild('takeoverTemplate', { read: ViewContainerRef, static: true }) takeoverModalRef: ViewContainerRef;
|
||||||
@ViewChild('confirmTemplate', { read: ViewContainerRef, static: true }) confirmModalRef: ViewContainerRef;
|
@ViewChild('confirmTemplate', { read: ViewContainerRef, static: true }) confirmModalRef: ViewContainerRef;
|
||||||
|
|
||||||
canAccessPremium: boolean;
|
canAccessPremium: boolean;
|
||||||
@@ -46,16 +47,22 @@ export class EmergencyAccessComponent implements OnInit {
|
|||||||
actionPromise: Promise<any>;
|
actionPromise: Promise<any>;
|
||||||
isOrganizationOwner: boolean;
|
isOrganizationOwner: boolean;
|
||||||
|
|
||||||
constructor(private apiService: ApiService, private i18nService: I18nService,
|
constructor(
|
||||||
private modalService: ModalService, private platformUtilsService: PlatformUtilsService,
|
private apiService: ApiService,
|
||||||
|
private i18nService: I18nService,
|
||||||
|
private modalService: ModalService,
|
||||||
|
private platformUtilsService: PlatformUtilsService,
|
||||||
private cryptoService: CryptoService,
|
private cryptoService: CryptoService,
|
||||||
private storageService: StorageService, private userService: UserService,
|
private messagingService: MessagingService,
|
||||||
private messagingService: MessagingService, private userNamePipe: UserNamePipe,
|
private userNamePipe: UserNamePipe,
|
||||||
private logService: LogService) { }
|
private logService: LogService,
|
||||||
|
private stateService: StateService,
|
||||||
|
private organizationService: OrganizationService,
|
||||||
|
) { }
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
this.canAccessPremium = await this.userService.canAccessPremium();
|
this.canAccessPremium = await this.stateService.getCanAccessPremium();
|
||||||
const orgs = await this.userService.getAllOrganizations();
|
const orgs = await this.organizationService.getAll();
|
||||||
this.isOrganizationOwner = orgs.some(o => o.isOwner);
|
this.isOrganizationOwner = orgs.some(o => o.isOwner);
|
||||||
this.load();
|
this.load();
|
||||||
}
|
}
|
||||||
@@ -111,7 +118,7 @@ export class EmergencyAccessComponent implements OnInit {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const autoConfirm = await this.storageService.get<boolean>(ConstantsService.autoConfirmFingerprints);
|
const autoConfirm = await this.stateService.getAutoConfirmFingerPrints();
|
||||||
if (autoConfirm == null || !autoConfirm) {
|
if (autoConfirm == null || !autoConfirm) {
|
||||||
const [modal] = await this.modalService.openViewRef(EmergencyAccessConfirmComponent, this.confirmModalRef, comp => {
|
const [modal] = await this.modalService.openViewRef(EmergencyAccessConfirmComponent, this.confirmModalRef, comp => {
|
||||||
comp.name = this.userNamePipe.transform(contact);
|
comp.name = this.userNamePipe.transform(contact);
|
||||||
|
|||||||
@@ -8,13 +8,13 @@ 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 { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
import { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
||||||
|
import { OrganizationService } from 'jslib-common/abstractions/organization.service';
|
||||||
import { PasswordGenerationService } from 'jslib-common/abstractions/passwordGeneration.service';
|
import { PasswordGenerationService } from 'jslib-common/abstractions/passwordGeneration.service';
|
||||||
import { PasswordRepromptService } from 'jslib-common/abstractions/passwordReprompt.service';
|
import { PasswordRepromptService } from 'jslib-common/abstractions/passwordReprompt.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 { StateService } from 'jslib-common/abstractions/state.service';
|
import { StateService } from 'jslib-common/abstractions/state.service';
|
||||||
import { TotpService } from 'jslib-common/abstractions/totp.service';
|
import { TotpService } from 'jslib-common/abstractions/totp.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
|
||||||
|
|
||||||
import { Cipher } from 'jslib-common/models/domain/cipher';
|
import { Cipher } from 'jslib-common/models/domain/cipher';
|
||||||
|
|
||||||
@@ -30,14 +30,14 @@ export class EmergencyAddEditComponent extends BaseAddEditComponent {
|
|||||||
|
|
||||||
constructor(cipherService: CipherService, folderService: FolderService,
|
constructor(cipherService: CipherService, folderService: FolderService,
|
||||||
i18nService: I18nService, platformUtilsService: PlatformUtilsService,
|
i18nService: I18nService, platformUtilsService: PlatformUtilsService,
|
||||||
auditService: AuditService, stateService: StateService,
|
auditService: AuditService, stateService: StateService, collectionService: CollectionService,
|
||||||
userService: UserService, collectionService: CollectionService,
|
|
||||||
totpService: TotpService, passwordGenerationService: PasswordGenerationService,
|
totpService: TotpService, passwordGenerationService: PasswordGenerationService,
|
||||||
messagingService: MessagingService, eventService: EventService, policyService: PolicyService,
|
messagingService: MessagingService, eventService: EventService,
|
||||||
logService: LogService, passwordRepromptService: PasswordRepromptService) {
|
policyService: PolicyService, passwordRepromptService: PasswordRepromptService,
|
||||||
|
organizationService: OrganizationService, logService: LogService) {
|
||||||
super(cipherService, folderService, i18nService, platformUtilsService, auditService, stateService,
|
super(cipherService, folderService, i18nService, platformUtilsService, auditService, stateService,
|
||||||
userService, collectionService, totpService, passwordGenerationService, messagingService,
|
collectionService, totpService, passwordGenerationService, messagingService,
|
||||||
eventService, policyService, passwordRepromptService, logService);
|
eventService, policyService, organizationService, logService, passwordRepromptService);
|
||||||
}
|
}
|
||||||
|
|
||||||
async load() {
|
async load() {
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ import { LogService } from 'jslib-common/abstractions/log.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 { StateService } from 'jslib-common/abstractions/state.service';
|
import { StateService } from 'jslib-common/abstractions/state.service';
|
||||||
import { StorageService } from 'jslib-common/abstractions/storage.service';
|
|
||||||
|
|
||||||
import { SsoComponent } from 'jslib-angular/components/sso.component';
|
import { SsoComponent } from 'jslib-angular/components/sso.component';
|
||||||
|
|
||||||
@@ -32,11 +31,9 @@ export class LinkSsoComponent extends SsoComponent implements AfterContentInit {
|
|||||||
apiService: ApiService, authService: AuthService,
|
apiService: ApiService, authService: AuthService,
|
||||||
router: Router, route: ActivatedRoute,
|
router: Router, route: ActivatedRoute,
|
||||||
cryptoFunctionService: CryptoFunctionService, passwordGenerationService: PasswordGenerationService,
|
cryptoFunctionService: CryptoFunctionService, passwordGenerationService: PasswordGenerationService,
|
||||||
storageService: StorageService, stateService: StateService, environmentService: EnvironmentService,
|
stateService: StateService, environmentService: EnvironmentService, logService: LogService) {
|
||||||
logService: LogService) {
|
|
||||||
super(authService, router,
|
super(authService, router,
|
||||||
i18nService, route,
|
i18nService, route, stateService,
|
||||||
storageService, stateService,
|
|
||||||
platformUtilsService, apiService,
|
platformUtilsService, apiService,
|
||||||
cryptoFunctionService, environmentService, passwordGenerationService, logService);
|
cryptoFunctionService, environmentService, passwordGenerationService, logService);
|
||||||
|
|
||||||
|
|||||||
@@ -8,11 +8,8 @@ import { I18nService } from 'jslib-common/abstractions/i18n.service';
|
|||||||
import { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
import { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
||||||
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
||||||
import { StateService } from 'jslib-common/abstractions/state.service';
|
import { StateService } from 'jslib-common/abstractions/state.service';
|
||||||
import { StorageService } from 'jslib-common/abstractions/storage.service';
|
|
||||||
import { VaultTimeoutService } from 'jslib-common/abstractions/vaultTimeout.service';
|
import { VaultTimeoutService } from 'jslib-common/abstractions/vaultTimeout.service';
|
||||||
|
|
||||||
import { ConstantsService } from 'jslib-common/services/constants.service';
|
|
||||||
|
|
||||||
import { ThemeType } from 'jslib-common/enums/themeType';
|
import { ThemeType } from 'jslib-common/enums/themeType';
|
||||||
import { Utils } from 'jslib-common/misc/utils';
|
import { Utils } from 'jslib-common/misc/utils';
|
||||||
|
|
||||||
@@ -36,10 +33,13 @@ export class OptionsComponent implements OnInit {
|
|||||||
private startingLocale: string;
|
private startingLocale: string;
|
||||||
private startingTheme: string;
|
private startingTheme: string;
|
||||||
|
|
||||||
constructor(private storageService: StorageService, private stateService: StateService,
|
constructor(
|
||||||
|
private stateService: StateService,
|
||||||
private i18nService: I18nService,
|
private i18nService: I18nService,
|
||||||
private vaultTimeoutService: VaultTimeoutService, private platformUtilsService: PlatformUtilsService,
|
private vaultTimeoutService: VaultTimeoutService,
|
||||||
private messagingService: MessagingService) {
|
private platformUtilsService: PlatformUtilsService,
|
||||||
|
private messagingService: MessagingService
|
||||||
|
) {
|
||||||
this.vaultTimeouts = [
|
this.vaultTimeouts = [
|
||||||
{ name: i18nService.t('oneMinute'), value: 1 },
|
{ name: i18nService.t('oneMinute'), value: 1 },
|
||||||
{ name: i18nService.t('fiveMinutes'), value: 5 },
|
{ name: i18nService.t('fiveMinutes'), value: 5 },
|
||||||
@@ -65,7 +65,7 @@ export class OptionsComponent implements OnInit {
|
|||||||
localeOptions.splice(0, 0, { name: i18nService.t('default'), value: null });
|
localeOptions.splice(0, 0, { name: i18nService.t('default'), value: null });
|
||||||
this.localeOptions = localeOptions;
|
this.localeOptions = localeOptions;
|
||||||
this.themeOptions = [
|
this.themeOptions = [
|
||||||
{ name: i18nService.t('themeLight'), value: null },
|
{ name: i18nService.t('themeLight'), value: ThemeType.Light },
|
||||||
{ name: i18nService.t('themeDark'), value: ThemeType.Dark },
|
{ name: i18nService.t('themeDark'), value: ThemeType.Dark },
|
||||||
{ name: i18nService.t('themeSystem'), value: ThemeType.System },
|
{ name: i18nService.t('themeSystem'), value: ThemeType.System },
|
||||||
];
|
];
|
||||||
@@ -73,12 +73,12 @@ export class OptionsComponent implements OnInit {
|
|||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
this.vaultTimeout.setValue(await this.vaultTimeoutService.getVaultTimeout());
|
this.vaultTimeout.setValue(await this.vaultTimeoutService.getVaultTimeout());
|
||||||
this.vaultTimeoutAction = await this.storageService.get<string>(ConstantsService.vaultTimeoutActionKey);
|
this.vaultTimeoutAction = await this.stateService.getVaultTimeoutAction();
|
||||||
this.disableIcons = await this.storageService.get<boolean>(ConstantsService.disableFaviconKey);
|
this.disableIcons = await this.stateService.getDisableFavicon();
|
||||||
this.enableGravatars = await this.storageService.get<boolean>('enableGravatars');
|
this.enableGravatars = await this.stateService.getEnableGravitars();
|
||||||
this.enableFullWidth = await this.storageService.get<boolean>('enableFullWidth');
|
this.enableFullWidth = await this.stateService.getEnableFullWidth();
|
||||||
this.locale = this.startingLocale = await this.storageService.get<string>(ConstantsService.localeKey);
|
this.locale = await this.stateService.getLocale() ?? this.startingLocale;
|
||||||
this.theme = this.startingTheme = await this.storageService.get<ThemeType>(ConstantsService.themeKey);
|
this.theme = await this.stateService.getTheme() ?? this.startingTheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
async submit() {
|
async submit() {
|
||||||
@@ -88,21 +88,19 @@ export class OptionsComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
await this.vaultTimeoutService.setVaultTimeoutOptions(this.vaultTimeout.value, this.vaultTimeoutAction);
|
await this.vaultTimeoutService.setVaultTimeoutOptions(this.vaultTimeout.value, this.vaultTimeoutAction);
|
||||||
await this.storageService.save(ConstantsService.disableFaviconKey, this.disableIcons);
|
await this.stateService.setDisableFavicon(this.disableIcons);
|
||||||
await this.stateService.save(ConstantsService.disableFaviconKey, this.disableIcons);
|
await this.stateService.setEnableGravitars(this.enableGravatars);
|
||||||
await this.storageService.save('enableGravatars', this.enableGravatars);
|
await this.stateService.setEnableFullWidth(this.enableFullWidth);
|
||||||
await this.stateService.save('enableGravatars', this.enableGravatars);
|
|
||||||
await this.storageService.save('enableFullWidth', this.enableFullWidth);
|
|
||||||
this.messagingService.send('setFullWidth');
|
this.messagingService.send('setFullWidth');
|
||||||
if (this.theme !== this.startingTheme) {
|
if (this.theme !== this.startingTheme) {
|
||||||
await this.storageService.save(ConstantsService.themeKey, this.theme);
|
await this.stateService.setTheme(this.theme);
|
||||||
this.startingTheme = this.theme;
|
this.startingTheme = this.theme;
|
||||||
const effectiveTheme = await this.platformUtilsService.getEffectiveTheme();
|
const effectiveTheme = await this.platformUtilsService.getEffectiveTheme();
|
||||||
const htmlEl = window.document.documentElement;
|
const htmlEl = window.document.documentElement;
|
||||||
htmlEl.classList.remove('theme_' + ThemeType.Light, 'theme_' + ThemeType.Dark);
|
htmlEl.classList.remove('theme_' + ThemeType.Light, 'theme_' + ThemeType.Dark);
|
||||||
htmlEl.classList.add('theme_' + effectiveTheme);
|
htmlEl.classList.add('theme_' + effectiveTheme);
|
||||||
}
|
}
|
||||||
await this.storageService.save(ConstantsService.localeKey, this.locale);
|
await this.stateService.setLocale(this.locale);
|
||||||
if (this.locale !== this.startingLocale) {
|
if (this.locale !== this.startingLocale) {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -12,10 +12,10 @@ import { ApiService } from 'jslib-common/abstractions/api.service';
|
|||||||
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 { LogService } from 'jslib-common/abstractions/log.service';
|
import { LogService } from 'jslib-common/abstractions/log.service';
|
||||||
|
import { OrganizationService } from 'jslib-common/abstractions/organization.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 { SyncService } from 'jslib-common/abstractions/sync.service';
|
import { SyncService } from 'jslib-common/abstractions/sync.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
|
||||||
|
|
||||||
import { PaymentComponent } from './payment.component';
|
import { PaymentComponent } from './payment.component';
|
||||||
import { TaxInfoComponent } from './tax-info.component';
|
import { TaxInfoComponent } from './tax-info.component';
|
||||||
@@ -73,7 +73,7 @@ export class OrganizationPlansComponent implements OnInit {
|
|||||||
constructor(private apiService: ApiService, private i18nService: I18nService,
|
constructor(private apiService: ApiService, private i18nService: I18nService,
|
||||||
private platformUtilsService: PlatformUtilsService,
|
private platformUtilsService: PlatformUtilsService,
|
||||||
private cryptoService: CryptoService, private router: Router, private syncService: SyncService,
|
private cryptoService: CryptoService, private router: Router, private syncService: SyncService,
|
||||||
private policyService: PolicyService, private userService: UserService, private logService: LogService) {
|
private policyService: PolicyService, private organizationService: OrganizationService, private logService: LogService) {
|
||||||
this.selfHosted = platformUtilsService.isSelfHost();
|
this.selfHosted = platformUtilsService.isSelfHost();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -307,7 +307,7 @@ export class OrganizationPlansComponent implements OnInit {
|
|||||||
request.billingAddressPostalCode = this.taxComponent.taxInfo.postalCode;
|
request.billingAddressPostalCode = this.taxComponent.taxInfo.postalCode;
|
||||||
|
|
||||||
// Retrieve org info to backfill pub/priv key if necessary
|
// Retrieve org info to backfill pub/priv key if necessary
|
||||||
const org = await this.userService.getOrganization(this.organizationId);
|
const org = await this.organizationService.get(this.organizationId);
|
||||||
if (!org.hasPublicAndPrivateKeys) {
|
if (!org.hasPublicAndPrivateKeys) {
|
||||||
const orgShareKey = await this.cryptoService.getOrgKey(this.organizationId);
|
const orgShareKey = await this.cryptoService.getOrgKey(this.organizationId);
|
||||||
const orgKeys = await this.cryptoService.makeKeyPair(orgShareKey);
|
const orgKeys = await this.cryptoService.makeKeyPair(orgShareKey);
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ import { ApiService } from 'jslib-common/abstractions/api.service';
|
|||||||
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 { LogService } from 'jslib-common/abstractions/log.service';
|
import { LogService } from 'jslib-common/abstractions/log.service';
|
||||||
|
import { OrganizationService } from 'jslib-common/abstractions/organization.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 { SyncService } from 'jslib-common/abstractions/sync.service';
|
import { SyncService } from 'jslib-common/abstractions/sync.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
|
||||||
|
|
||||||
import { Organization } from 'jslib-common/models/domain/organization';
|
import { Organization } from 'jslib-common/models/domain/organization';
|
||||||
import { Policy } from 'jslib-common/models/domain/policy';
|
import { Policy } from 'jslib-common/models/domain/policy';
|
||||||
@@ -34,7 +34,7 @@ export class OrganizationsComponent implements OnInit {
|
|||||||
loaded: boolean = false;
|
loaded: boolean = false;
|
||||||
actionPromise: Promise<any>;
|
actionPromise: Promise<any>;
|
||||||
|
|
||||||
constructor(private userService: UserService, private platformUtilsService: PlatformUtilsService,
|
constructor(private organizationService: OrganizationService, private platformUtilsService: PlatformUtilsService,
|
||||||
private i18nService: I18nService, private apiService: ApiService,
|
private i18nService: I18nService, private apiService: ApiService,
|
||||||
private syncService: SyncService,
|
private syncService: SyncService,
|
||||||
private cryptoService: CryptoService, private policyService: PolicyService,
|
private cryptoService: CryptoService, private policyService: PolicyService,
|
||||||
@@ -48,7 +48,7 @@ export class OrganizationsComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async load() {
|
async load() {
|
||||||
const orgs = await this.userService.getAllOrganizations();
|
const orgs = await this.organizationService.getAll();
|
||||||
orgs.sort(Utils.getSortFunction(this.i18nService, 'name'));
|
orgs.sort(Utils.getSortFunction(this.i18nService, 'name'));
|
||||||
this.organizations = orgs;
|
this.organizations = orgs;
|
||||||
this.policies = await this.policyService.getAll(PolicyType.ResetPassword);
|
this.policies = await this.policyService.getAll(PolicyType.ResetPassword);
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ 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 { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
import { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
||||||
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
||||||
|
import { StateService } from 'jslib-common/abstractions/state.service';
|
||||||
import { SyncService } from 'jslib-common/abstractions/sync.service';
|
import { SyncService } from 'jslib-common/abstractions/sync.service';
|
||||||
import { TokenService } from 'jslib-common/abstractions/token.service';
|
import { TokenService } from 'jslib-common/abstractions/token.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
|
||||||
|
|
||||||
import { PaymentComponent } from './payment.component';
|
import { PaymentComponent } from './payment.component';
|
||||||
import { TaxInfoComponent } from './tax-info.component';
|
import { TaxInfoComponent } from './tax-info.component';
|
||||||
@@ -37,12 +37,12 @@ export class PremiumComponent implements OnInit {
|
|||||||
private platformUtilsService: PlatformUtilsService,
|
private platformUtilsService: PlatformUtilsService,
|
||||||
private tokenService: TokenService, private router: Router,
|
private tokenService: TokenService, private router: Router,
|
||||||
private messagingService: MessagingService, private syncService: SyncService,
|
private messagingService: MessagingService, private syncService: SyncService,
|
||||||
private userService: UserService, private logService: LogService) {
|
private logService: LogService, private stateService: StateService) {
|
||||||
this.selfHosted = platformUtilsService.isSelfHost();
|
this.selfHosted = platformUtilsService.isSelfHost();
|
||||||
}
|
}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
this.canAccessPremium = await this.userService.canAccessPremium();
|
this.canAccessPremium = await this.stateService.getCanAccessPremium();
|
||||||
const premium = await this.tokenService.getPremium();
|
const premium = await this.tokenService.getPremium();
|
||||||
if (premium) {
|
if (premium) {
|
||||||
this.router.navigate(['/settings/subscription']);
|
this.router.navigate(['/settings/subscription']);
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import { I18nService } from 'jslib-common/abstractions/i18n.service';
|
|||||||
import { KeyConnectorService } from 'jslib-common/abstractions/keyConnector.service';
|
import { KeyConnectorService } from 'jslib-common/abstractions/keyConnector.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 { UserService } from 'jslib-common/abstractions/user.service';
|
import { StateService } from 'jslib-common/abstractions/state.service';
|
||||||
|
|
||||||
import { UpdateProfileRequest } from 'jslib-common/models/request/updateProfileRequest';
|
import { UpdateProfileRequest } from 'jslib-common/models/request/updateProfileRequest';
|
||||||
|
|
||||||
@@ -27,15 +27,20 @@ export class ProfileComponent implements OnInit {
|
|||||||
|
|
||||||
formPromise: Promise<any>;
|
formPromise: Promise<any>;
|
||||||
|
|
||||||
constructor(private apiService: ApiService, private i18nService: I18nService,
|
constructor(
|
||||||
private platformUtilsService: PlatformUtilsService, private userService: UserService,
|
private apiService: ApiService,
|
||||||
private cryptoService: CryptoService, private logService: LogService,
|
private i18nService: I18nService,
|
||||||
private keyConnectorService: KeyConnectorService) { }
|
private platformUtilsService: PlatformUtilsService,
|
||||||
|
private cryptoService: CryptoService,
|
||||||
|
private logService: LogService,
|
||||||
|
private keyConnectorService: KeyConnectorService,
|
||||||
|
private stateService: StateService,
|
||||||
|
) { }
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
this.profile = await this.apiService.getProfile();
|
this.profile = await this.apiService.getProfile();
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
const fingerprint = await this.cryptoService.getFingerprint(await this.userService.getUserId());
|
const fingerprint = await this.cryptoService.getFingerprint(await this.stateService.getUserId());
|
||||||
if (fingerprint != null) {
|
if (fingerprint != null) {
|
||||||
this.fingerprint = fingerprint.join('-');
|
this.fingerprint = fingerprint.join('-');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ import {
|
|||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
|
|
||||||
import { BroadcasterService } from 'jslib-common/abstractions/broadcaster.service';
|
import { BroadcasterService } from 'jslib-common/abstractions/broadcaster.service';
|
||||||
|
import { OrganizationService } from 'jslib-common/abstractions/organization.service';
|
||||||
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
||||||
import { TokenService } from 'jslib-common/abstractions/token.service';
|
import { TokenService } from 'jslib-common/abstractions/token.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
|
||||||
|
|
||||||
const BroadcasterSubscriptionId = 'SettingsComponent';
|
const BroadcasterSubscriptionId = 'SettingsComponent';
|
||||||
|
|
||||||
@@ -23,7 +23,7 @@ export class SettingsComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
constructor(private tokenService: TokenService, private broadcasterService: BroadcasterService,
|
constructor(private tokenService: TokenService, private broadcasterService: BroadcasterService,
|
||||||
private ngZone: NgZone, private platformUtilsService: PlatformUtilsService,
|
private ngZone: NgZone, private platformUtilsService: PlatformUtilsService,
|
||||||
private userService: UserService) { }
|
private organizationService: OrganizationService) { }
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
this.broadcasterService.subscribe(BroadcasterSubscriptionId, async (message: any) => {
|
this.broadcasterService.subscribe(BroadcasterSubscriptionId, async (message: any) => {
|
||||||
@@ -47,6 +47,6 @@ export class SettingsComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
async load() {
|
async load() {
|
||||||
this.premium = await this.tokenService.getPremium();
|
this.premium = await this.tokenService.getPremium();
|
||||||
this.hasFamilySponsorshipAvailable = await this.userService.canManageSponsorships();
|
this.hasFamilySponsorshipAvailable = await this.organizationService.canManageSponsorships();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ import {
|
|||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
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 { OrganizationService } from 'jslib-common/abstractions/organization.service';
|
||||||
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
||||||
import { SyncService } from 'jslib-common/abstractions/sync.service';
|
import { SyncService } from 'jslib-common/abstractions/sync.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
|
||||||
|
|
||||||
import { PlanSponsorshipType } from 'jslib-common/enums/planSponsorshipType';
|
import { PlanSponsorshipType } from 'jslib-common/enums/planSponsorshipType';
|
||||||
import { Organization } from 'jslib-common/models/domain/organization';
|
import { Organization } from 'jslib-common/models/domain/organization';
|
||||||
@@ -26,9 +26,13 @@ export class SponsoredFamiliesComponent implements OnInit {
|
|||||||
// Conditional display properties
|
// Conditional display properties
|
||||||
formPromise: Promise<any>;
|
formPromise: Promise<any>;
|
||||||
|
|
||||||
constructor(private userService: UserService, private apiService: ApiService,
|
constructor(
|
||||||
private i18nService: I18nService, private platformUtilsService: PlatformUtilsService,
|
private apiService: ApiService,
|
||||||
private syncService: SyncService) { }
|
private i18nService: I18nService,
|
||||||
|
private platformUtilsService: PlatformUtilsService,
|
||||||
|
private syncService: SyncService,
|
||||||
|
private organizationService: OrganizationService,
|
||||||
|
) { }
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
await this.load();
|
await this.load();
|
||||||
@@ -58,7 +62,7 @@ export class SponsoredFamiliesComponent implements OnInit {
|
|||||||
await this.syncService.fullSync(true);
|
await this.syncService.fullSync(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
const allOrgs = await this.userService.getAllOrganizations();
|
const allOrgs = await this.organizationService.getAll();
|
||||||
this.availableSponsorshipOrgs = allOrgs.filter(org => org.familySponsorshipAvailable);
|
this.availableSponsorshipOrgs = allOrgs.filter(org => org.familySponsorshipAvailable);
|
||||||
|
|
||||||
this.activeSponsorshipOrgs = allOrgs.filter(org => org.familySponsorshipFriendlyName !== null);
|
this.activeSponsorshipOrgs = allOrgs.filter(org => org.familySponsorshipFriendlyName !== null);
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ 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';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
import { StateService } from 'jslib-common/abstractions/state.service';
|
||||||
import { UserVerificationService } from 'jslib-common/abstractions/userVerification.service';
|
import { UserVerificationService } from 'jslib-common/abstractions/userVerification.service';
|
||||||
|
|
||||||
import { UpdateTwoFactorAuthenticatorRequest } from 'jslib-common/models/request/updateTwoFactorAuthenticatorRequest';
|
import { UpdateTwoFactorAuthenticatorRequest } from 'jslib-common/models/request/updateTwoFactorAuthenticatorRequest';
|
||||||
@@ -30,11 +30,21 @@ export class TwoFactorAuthenticatorComponent extends TwoFactorBaseComponent impl
|
|||||||
|
|
||||||
private qrScript: HTMLScriptElement;
|
private qrScript: HTMLScriptElement;
|
||||||
|
|
||||||
constructor(apiService: ApiService, i18nService: I18nService,
|
constructor(
|
||||||
|
apiService: ApiService,
|
||||||
|
i18nService: I18nService,
|
||||||
userVerificationService: UserVerificationService,
|
userVerificationService: UserVerificationService,
|
||||||
platformUtilsService: PlatformUtilsService, logService: LogService,
|
platformUtilsService: PlatformUtilsService,
|
||||||
private userService: UserService) {
|
logService: LogService,
|
||||||
super(apiService, i18nService, platformUtilsService, logService, userVerificationService);
|
private stateService: StateService
|
||||||
|
) {
|
||||||
|
super(
|
||||||
|
apiService,
|
||||||
|
i18nService,
|
||||||
|
platformUtilsService,
|
||||||
|
logService,
|
||||||
|
userVerificationService
|
||||||
|
);
|
||||||
this.qrScript = window.document.createElement('script');
|
this.qrScript = window.document.createElement('script');
|
||||||
this.qrScript.src = 'scripts/qrious.min.js';
|
this.qrScript.src = 'scripts/qrious.min.js';
|
||||||
this.qrScript.async = true;
|
this.qrScript.async = true;
|
||||||
@@ -77,7 +87,7 @@ export class TwoFactorAuthenticatorComponent extends TwoFactorBaseComponent impl
|
|||||||
this.token = null;
|
this.token = null;
|
||||||
this.enabled = response.enabled;
|
this.enabled = response.enabled;
|
||||||
this.key = response.key;
|
this.key = response.key;
|
||||||
const email = await this.userService.getEmail();
|
const email = await this.stateService.getEmail();
|
||||||
window.setTimeout(() => {
|
window.setTimeout(() => {
|
||||||
const qr = new (window as any).QRious({
|
const qr = new (window as any).QRious({
|
||||||
element: document.getElementById('qr'),
|
element: document.getElementById('qr'),
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ 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';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
import { StateService } from 'jslib-common/abstractions/state.service';
|
||||||
import { UserVerificationService } from 'jslib-common/abstractions/userVerification.service';
|
import { UserVerificationService } from 'jslib-common/abstractions/userVerification.service';
|
||||||
|
|
||||||
import { TwoFactorEmailRequest } from 'jslib-common/models/request/twoFactorEmailRequest';
|
import { TwoFactorEmailRequest } from 'jslib-common/models/request/twoFactorEmailRequest';
|
||||||
@@ -27,11 +27,21 @@ export class TwoFactorEmailComponent extends TwoFactorBaseComponent {
|
|||||||
formPromise: Promise<any>;
|
formPromise: Promise<any>;
|
||||||
emailPromise: Promise<any>;
|
emailPromise: Promise<any>;
|
||||||
|
|
||||||
constructor(apiService: ApiService, i18nService: I18nService,
|
constructor(
|
||||||
|
apiService: ApiService,
|
||||||
|
i18nService: I18nService,
|
||||||
platformUtilsService: PlatformUtilsService,
|
platformUtilsService: PlatformUtilsService,
|
||||||
logService: LogService, userVerificationService: UserVerificationService,
|
logService: LogService,
|
||||||
private userService: UserService) {
|
userVerificationService: UserVerificationService,
|
||||||
super(apiService, i18nService, platformUtilsService, logService, userVerificationService);
|
private stateService: StateService,
|
||||||
|
) {
|
||||||
|
super(
|
||||||
|
apiService,
|
||||||
|
i18nService,
|
||||||
|
platformUtilsService,
|
||||||
|
logService,
|
||||||
|
userVerificationService
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
auth(authResponse: any) {
|
auth(authResponse: any) {
|
||||||
@@ -76,7 +86,7 @@ export class TwoFactorEmailComponent extends TwoFactorBaseComponent {
|
|||||||
this.email = response.email;
|
this.email = response.email;
|
||||||
this.enabled = response.enabled;
|
this.enabled = response.enabled;
|
||||||
if (!this.enabled && (this.email == null || this.email === '')) {
|
if (!this.enabled && (this.email == null || this.email === '')) {
|
||||||
this.email = await this.userService.getEmail();
|
this.email = await this.stateService.getEmail();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import {
|
|||||||
import { ApiService } from 'jslib-common/abstractions/api.service';
|
import { ApiService } from 'jslib-common/abstractions/api.service';
|
||||||
import { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
import { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
||||||
import { PolicyService } from 'jslib-common/abstractions/policy.service';
|
import { PolicyService } from 'jslib-common/abstractions/policy.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
import { StateService } from 'jslib-common/abstractions/state.service';
|
||||||
|
|
||||||
import { TwoFactorProviders } from 'jslib-common/services/auth.service';
|
import { TwoFactorProviders } from 'jslib-common/services/auth.service';
|
||||||
|
|
||||||
@@ -46,12 +46,12 @@ export class TwoFactorSetupComponent implements OnInit {
|
|||||||
loading = true;
|
loading = true;
|
||||||
modal: ModalRef;
|
modal: ModalRef;
|
||||||
|
|
||||||
constructor(protected apiService: ApiService, protected userService: UserService,
|
constructor(protected apiService: ApiService, protected modalService: ModalService,
|
||||||
protected modalService: ModalService, protected messagingService: MessagingService,
|
protected messagingService: MessagingService, protected policyService: PolicyService,
|
||||||
protected policyService: PolicyService) { }
|
private stateService: StateService) { }
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
this.canAccessPremium = await this.userService.canAccessPremium();
|
this.canAccessPremium = await this.stateService.getCanAccessPremium();
|
||||||
|
|
||||||
for (const key in TwoFactorProviders) {
|
for (const key in TwoFactorProviders) {
|
||||||
if (!TwoFactorProviders.hasOwnProperty(key)) {
|
if (!TwoFactorProviders.hasOwnProperty(key)) {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import {
|
|||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
|
|
||||||
import { AuditService } from 'jslib-common/abstractions/audit.service';
|
import { AuditService } from 'jslib-common/abstractions/audit.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
import { StateService } from 'jslib-common/abstractions/state.service';
|
||||||
import { BreachAccountResponse } from 'jslib-common/models/response/breachAccountResponse';
|
import { BreachAccountResponse } from 'jslib-common/models/response/breachAccountResponse';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -18,10 +18,10 @@ export class BreachReportComponent implements OnInit {
|
|||||||
breachedAccounts: BreachAccountResponse[] = [];
|
breachedAccounts: BreachAccountResponse[] = [];
|
||||||
formPromise: Promise<BreachAccountResponse[]>;
|
formPromise: Promise<BreachAccountResponse[]>;
|
||||||
|
|
||||||
constructor(private auditService: AuditService, private userService: UserService) { }
|
constructor(private auditService: AuditService, private stateService: StateService) { }
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
this.username = await this.userService.getEmail();
|
this.username = await this.stateService.getEmail();
|
||||||
}
|
}
|
||||||
|
|
||||||
async submit() {
|
async submit() {
|
||||||
|
|||||||
@@ -11,11 +11,11 @@ import { Organization } from 'jslib-common/models/domain/organization';
|
|||||||
import { AddEditComponent as OrgAddEditComponent } from '../organizations/vault/add-edit.component';
|
import { AddEditComponent as OrgAddEditComponent } from '../organizations/vault/add-edit.component';
|
||||||
import { AddEditComponent } from '../vault/add-edit.component';
|
import { AddEditComponent } from '../vault/add-edit.component';
|
||||||
|
|
||||||
import { CipherRepromptType } from 'jslib-common/enums/cipherRepromptType';
|
|
||||||
|
|
||||||
import { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
import { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
||||||
import { PasswordRepromptService } from 'jslib-common/abstractions/passwordReprompt.service';
|
import { PasswordRepromptService } from 'jslib-common/abstractions/passwordReprompt.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
import { StateService } from 'jslib-common/abstractions/state.service';
|
||||||
|
|
||||||
|
import { CipherRepromptType } from 'jslib-common/enums/cipherRepromptType';
|
||||||
|
|
||||||
import { ModalService } from 'jslib-angular/services/modal.service';
|
import { ModalService } from 'jslib-angular/services/modal.service';
|
||||||
|
|
||||||
@@ -28,9 +28,9 @@ export class CipherReportComponent {
|
|||||||
ciphers: CipherView[] = [];
|
ciphers: CipherView[] = [];
|
||||||
organization: Organization;
|
organization: Organization;
|
||||||
|
|
||||||
constructor(private modalService: ModalService, protected userService: UserService,
|
constructor(private modalService: ModalService, protected messagingService: MessagingService,
|
||||||
protected messagingService: MessagingService, protected passwordRepromptService: PasswordRepromptService,
|
public requiresPaid: boolean, private stateService: StateService,
|
||||||
public requiresPaid: boolean) { }
|
protected passwordRepromptService: PasswordRepromptService) { }
|
||||||
|
|
||||||
async load() {
|
async load() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
@@ -80,7 +80,7 @@ export class CipherReportComponent {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const accessPremium = await this.userService.canAccessPremium();
|
const accessPremium = await this.stateService.getCanAccessPremium();
|
||||||
if (this.requiresPaid && !accessPremium) {
|
if (this.requiresPaid && !accessPremium) {
|
||||||
this.messagingService.send('premiumRequired');
|
this.messagingService.send('premiumRequired');
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { AuditService } from 'jslib-common/abstractions/audit.service';
|
|||||||
import { CipherService } from 'jslib-common/abstractions/cipher.service';
|
import { CipherService } from 'jslib-common/abstractions/cipher.service';
|
||||||
import { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
import { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
||||||
import { PasswordRepromptService } from 'jslib-common/abstractions/passwordReprompt.service';
|
import { PasswordRepromptService } from 'jslib-common/abstractions/passwordReprompt.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
import { StateService } from 'jslib-common/abstractions/state.service';
|
||||||
|
|
||||||
import { ModalService } from 'jslib-angular/services/modal.service';
|
import { ModalService } from 'jslib-angular/services/modal.service';
|
||||||
|
|
||||||
@@ -26,8 +26,8 @@ export class ExposedPasswordsReportComponent extends CipherReportComponent imple
|
|||||||
|
|
||||||
constructor(protected cipherService: CipherService, protected auditService: AuditService,
|
constructor(protected cipherService: CipherService, protected auditService: AuditService,
|
||||||
modalService: ModalService, messagingService: MessagingService,
|
modalService: ModalService, messagingService: MessagingService,
|
||||||
userService: UserService, passwordRepromptService: PasswordRepromptService) {
|
stateService: StateService, passwordRepromptService: PasswordRepromptService) {
|
||||||
super(modalService, userService, messagingService, passwordRepromptService, true);
|
super(modalService, messagingService, true, stateService, passwordRepromptService);
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { CipherService } from 'jslib-common/abstractions/cipher.service';
|
|||||||
import { LogService } from 'jslib-common/abstractions/log.service';
|
import { LogService } from 'jslib-common/abstractions/log.service';
|
||||||
import { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
import { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
||||||
import { PasswordRepromptService } from 'jslib-common/abstractions/passwordReprompt.service';
|
import { PasswordRepromptService } from 'jslib-common/abstractions/passwordReprompt.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
import { StateService } from 'jslib-common/abstractions/state.service';
|
||||||
|
|
||||||
import { ModalService } from 'jslib-angular/services/modal.service';
|
import { ModalService } from 'jslib-angular/services/modal.service';
|
||||||
|
|
||||||
@@ -28,9 +28,9 @@ export class InactiveTwoFactorReportComponent extends CipherReportComponent impl
|
|||||||
cipherDocs = new Map<string, string>();
|
cipherDocs = new Map<string, string>();
|
||||||
|
|
||||||
constructor(protected cipherService: CipherService, modalService: ModalService,
|
constructor(protected cipherService: CipherService, modalService: ModalService,
|
||||||
messagingService: MessagingService, userService: UserService, private logService: LogService,
|
messagingService: MessagingService, stateService: StateService, private logService: LogService,
|
||||||
passwordRepromptService: PasswordRepromptService) {
|
passwordRepromptService: PasswordRepromptService) {
|
||||||
super(modalService, userService, messagingService, passwordRepromptService, true);
|
super(modalService, messagingService, true, stateService, passwordRepromptService);
|
||||||
}
|
}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import {
|
|||||||
import { CipherService } from 'jslib-common/abstractions/cipher.service';
|
import { CipherService } from 'jslib-common/abstractions/cipher.service';
|
||||||
import { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
import { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
||||||
import { PasswordRepromptService } from 'jslib-common/abstractions/passwordReprompt.service';
|
import { PasswordRepromptService } from 'jslib-common/abstractions/passwordReprompt.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
import { StateService } from 'jslib-common/abstractions/state.service';
|
||||||
|
|
||||||
import { ModalService } from 'jslib-angular/services/modal.service';
|
import { ModalService } from 'jslib-angular/services/modal.service';
|
||||||
|
|
||||||
@@ -24,9 +24,9 @@ export class ReusedPasswordsReportComponent extends CipherReportComponent implem
|
|||||||
passwordUseMap: Map<string, number>;
|
passwordUseMap: Map<string, number>;
|
||||||
|
|
||||||
constructor(protected cipherService: CipherService, modalService: ModalService,
|
constructor(protected cipherService: CipherService, modalService: ModalService,
|
||||||
messagingService: MessagingService, userService: UserService,
|
messagingService: MessagingService, stateService: StateService,
|
||||||
passwordRepromptService: PasswordRepromptService) {
|
passwordRepromptService: PasswordRepromptService) {
|
||||||
super(modalService, userService, messagingService, passwordRepromptService, true);
|
super(modalService, messagingService, true, stateService, passwordRepromptService);
|
||||||
}
|
}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import {
|
|||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
|
|
||||||
import { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
import { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
import { StateService } from 'jslib-common/abstractions/state.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-tools',
|
selector: 'app-tools',
|
||||||
@@ -13,10 +13,10 @@ import { UserService } from 'jslib-common/abstractions/user.service';
|
|||||||
export class ToolsComponent implements OnInit {
|
export class ToolsComponent implements OnInit {
|
||||||
canAccessPremium = false;
|
canAccessPremium = false;
|
||||||
|
|
||||||
constructor(private userService: UserService, private messagingService: MessagingService) { }
|
constructor(private stateService: StateService, private messagingService: MessagingService) { }
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
this.canAccessPremium = await this.userService.canAccessPremium();
|
this.canAccessPremium = await this.stateService.getCanAccessPremium();
|
||||||
}
|
}
|
||||||
|
|
||||||
premiumRequired() {
|
premiumRequired() {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import {
|
|||||||
import { CipherService } from 'jslib-common/abstractions/cipher.service';
|
import { CipherService } from 'jslib-common/abstractions/cipher.service';
|
||||||
import { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
import { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
||||||
import { PasswordRepromptService } from 'jslib-common/abstractions/passwordReprompt.service';
|
import { PasswordRepromptService } from 'jslib-common/abstractions/passwordReprompt.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
import { StateService } from 'jslib-common/abstractions/state.service';
|
||||||
|
|
||||||
import { ModalService } from 'jslib-angular/services/modal.service';
|
import { ModalService } from 'jslib-angular/services/modal.service';
|
||||||
|
|
||||||
@@ -22,8 +22,9 @@ import { CipherReportComponent } from './cipher-report.component';
|
|||||||
})
|
})
|
||||||
export class UnsecuredWebsitesReportComponent extends CipherReportComponent implements OnInit {
|
export class UnsecuredWebsitesReportComponent extends CipherReportComponent implements OnInit {
|
||||||
constructor(protected cipherService: CipherService, modalService: ModalService,
|
constructor(protected cipherService: CipherService, modalService: ModalService,
|
||||||
messagingService: MessagingService, userService: UserService, passwordRepromptService: PasswordRepromptService) {
|
messagingService: MessagingService, stateService: StateService,
|
||||||
super(modalService, userService, messagingService, passwordRepromptService, true);
|
passwordRepromptService: PasswordRepromptService) {
|
||||||
|
super(modalService, messagingService, true, stateService, passwordRepromptService);
|
||||||
}
|
}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { CipherService } from 'jslib-common/abstractions/cipher.service';
|
|||||||
import { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
import { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
||||||
import { PasswordGenerationService } from 'jslib-common/abstractions/passwordGeneration.service';
|
import { PasswordGenerationService } from 'jslib-common/abstractions/passwordGeneration.service';
|
||||||
import { PasswordRepromptService } from 'jslib-common/abstractions/passwordReprompt.service';
|
import { PasswordRepromptService } from 'jslib-common/abstractions/passwordReprompt.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
import { StateService } from 'jslib-common/abstractions/state.service';
|
||||||
|
|
||||||
import { ModalService } from 'jslib-angular/services/modal.service';
|
import { ModalService } from 'jslib-angular/services/modal.service';
|
||||||
|
|
||||||
@@ -28,9 +28,9 @@ export class WeakPasswordsReportComponent extends CipherReportComponent implemen
|
|||||||
private passwordStrengthCache = new Map<string, number>();
|
private passwordStrengthCache = new Map<string, number>();
|
||||||
|
|
||||||
constructor(protected cipherService: CipherService, protected passwordGenerationService: PasswordGenerationService,
|
constructor(protected cipherService: CipherService, protected passwordGenerationService: PasswordGenerationService,
|
||||||
modalService: ModalService, messagingService: MessagingService, userService: UserService,
|
modalService: ModalService, messagingService: MessagingService,
|
||||||
passwordRepromptService: PasswordRepromptService) {
|
stateService: StateService, passwordRepromptService: PasswordRepromptService) {
|
||||||
super(modalService, userService, messagingService, passwordRepromptService, true);
|
super(modalService, messagingService, true, stateService, passwordRepromptService);
|
||||||
}
|
}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
|
|||||||
@@ -11,13 +11,13 @@ 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 { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
import { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
||||||
|
import { OrganizationService } from 'jslib-common/abstractions/organization.service';
|
||||||
import { PasswordGenerationService } from 'jslib-common/abstractions/passwordGeneration.service';
|
import { PasswordGenerationService } from 'jslib-common/abstractions/passwordGeneration.service';
|
||||||
import { PasswordRepromptService } from 'jslib-common/abstractions/passwordReprompt.service';
|
import { PasswordRepromptService } from 'jslib-common/abstractions/passwordReprompt.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 { StateService } from 'jslib-common/abstractions/state.service';
|
import { StateService } from 'jslib-common/abstractions/state.service';
|
||||||
import { TotpService } from 'jslib-common/abstractions/totp.service';
|
import { TotpService } from 'jslib-common/abstractions/totp.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
|
||||||
|
|
||||||
import { AddEditComponent as BaseAddEditComponent } from 'jslib-angular/components/add-edit.component';
|
import { AddEditComponent as BaseAddEditComponent } from 'jslib-angular/components/add-edit.component';
|
||||||
import { LoginUriView } from 'jslib-common/models/view/loginUriView';
|
import { LoginUriView } from 'jslib-common/models/view/loginUriView';
|
||||||
@@ -43,14 +43,12 @@ export class AddEditComponent extends BaseAddEditComponent {
|
|||||||
constructor(cipherService: CipherService, folderService: FolderService,
|
constructor(cipherService: CipherService, folderService: FolderService,
|
||||||
i18nService: I18nService, platformUtilsService: PlatformUtilsService,
|
i18nService: I18nService, platformUtilsService: PlatformUtilsService,
|
||||||
auditService: AuditService, stateService: StateService,
|
auditService: AuditService, stateService: StateService,
|
||||||
userService: UserService, collectionService: CollectionService,
|
collectionService: CollectionService, protected totpService: TotpService,
|
||||||
protected totpService: TotpService, protected passwordGenerationService: PasswordGenerationService,
|
protected passwordGenerationService: PasswordGenerationService, protected messagingService: MessagingService,
|
||||||
protected messagingService: MessagingService, eventService: EventService,
|
eventService: EventService, protected policyService: PolicyService, organizationService: OrganizationService, logService: LogService,
|
||||||
protected policyService: PolicyService, passwordRepromptService: PasswordRepromptService,
|
passwordRepromptService: PasswordRepromptService) {
|
||||||
logService: LogService) {
|
|
||||||
super(cipherService, folderService, i18nService, platformUtilsService, auditService, stateService,
|
super(cipherService, folderService, i18nService, platformUtilsService, auditService, stateService,
|
||||||
userService, collectionService, messagingService, eventService, policyService, passwordRepromptService,
|
collectionService, messagingService, eventService, policyService, logService, passwordRepromptService, organizationService);
|
||||||
logService);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
@@ -60,7 +58,7 @@ export class AddEditComponent extends BaseAddEditComponent {
|
|||||||
this.hasPasswordHistory = this.cipher.hasPasswordHistory;
|
this.hasPasswordHistory = this.cipher.hasPasswordHistory;
|
||||||
this.cleanUp();
|
this.cleanUp();
|
||||||
|
|
||||||
this.canAccessPremium = await this.userService.canAccessPremium();
|
this.canAccessPremium = await this.stateService.getCanAccessPremium();
|
||||||
if (this.cipher.type === CipherType.Login && this.cipher.login.totp &&
|
if (this.cipher.type === CipherType.Login && this.cipher.login.totp &&
|
||||||
(this.cipher.organizationUseTotp || this.canAccessPremium)) {
|
(this.cipher.organizationUseTotp || this.canAccessPremium)) {
|
||||||
await this.totpUpdateCode();
|
await this.totpUpdateCode();
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ 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 { 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 { UserService } from 'jslib-common/abstractions/user.service';
|
import { StateService } from 'jslib-common/abstractions/state.service';
|
||||||
|
|
||||||
import { AttachmentView } from 'jslib-common/models/view/attachmentView';
|
import { AttachmentView } from 'jslib-common/models/view/attachmentView';
|
||||||
|
|
||||||
@@ -20,11 +20,10 @@ export class AttachmentsComponent extends BaseAttachmentsComponent {
|
|||||||
viewOnly = false;
|
viewOnly = false;
|
||||||
|
|
||||||
constructor(cipherService: CipherService, i18nService: I18nService,
|
constructor(cipherService: CipherService, i18nService: I18nService,
|
||||||
cryptoService: CryptoService, userService: UserService,
|
cryptoService: CryptoService, stateService: StateService,
|
||||||
platformUtilsService: PlatformUtilsService, apiService: ApiService,
|
platformUtilsService: PlatformUtilsService, apiService: ApiService, logService: LogService) {
|
||||||
logService: LogService) {
|
super(cipherService, i18nService, cryptoService, platformUtilsService, apiService, window, logService,
|
||||||
super(cipherService, i18nService, cryptoService, userService, platformUtilsService, apiService, window,
|
stateService);
|
||||||
logService);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async reupload(attachment: AttachmentView) {
|
protected async reupload(attachment: AttachmentView) {
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ 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 { OrganizationService } from 'jslib-common/abstractions/organization.service';
|
||||||
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.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';
|
||||||
@@ -37,14 +37,14 @@ export class BulkShareComponent implements OnInit {
|
|||||||
|
|
||||||
constructor(private cipherService: CipherService, private platformUtilsService: PlatformUtilsService,
|
constructor(private cipherService: CipherService, private platformUtilsService: PlatformUtilsService,
|
||||||
private i18nService: I18nService, private collectionService: CollectionService,
|
private i18nService: I18nService, private collectionService: CollectionService,
|
||||||
private userService: UserService, private logService: LogService) { }
|
private organizationService: OrganizationService, private logService: LogService) { }
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
this.shareableCiphers = this.ciphers.filter(c => !c.hasOldAttachments && c.organizationId == null);
|
this.shareableCiphers = this.ciphers.filter(c => !c.hasOldAttachments && c.organizationId == null);
|
||||||
this.nonShareableCount = this.ciphers.length - this.shareableCiphers.length;
|
this.nonShareableCount = this.ciphers.length - this.shareableCiphers.length;
|
||||||
const allCollections = await this.collectionService.getAllDecrypted();
|
const allCollections = await this.collectionService.getAllDecrypted();
|
||||||
this.writeableCollections = allCollections.filter(c => !c.readOnly);
|
this.writeableCollections = allCollections.filter(c => !c.readOnly);
|
||||||
this.organizations = await this.userService.getAllOrganizations();
|
this.organizations = await this.organizationService.getAll();
|
||||||
if (this.organizationId == null && this.organizations.length > 0) {
|
if (this.organizationId == null && this.organizations.length > 0) {
|
||||||
this.organizationId = this.organizations[0].id;
|
this.organizationId = this.organizations[0].id;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ import { LogService } from 'jslib-common/abstractions/log.service';
|
|||||||
import { PasswordRepromptService } from 'jslib-common/abstractions/passwordReprompt.service';
|
import { PasswordRepromptService } from 'jslib-common/abstractions/passwordReprompt.service';
|
||||||
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
||||||
import { SearchService } from 'jslib-common/abstractions/search.service';
|
import { SearchService } from 'jslib-common/abstractions/search.service';
|
||||||
|
import { StateService } from 'jslib-common/abstractions/state.service';
|
||||||
import { TotpService } from 'jslib-common/abstractions/totp.service';
|
import { TotpService } from 'jslib-common/abstractions/totp.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
|
||||||
|
|
||||||
import { CiphersComponent as BaseCiphersComponent } from 'jslib-angular/components/ciphers.component';
|
import { CiphersComponent as BaseCiphersComponent } from 'jslib-angular/components/ciphers.component';
|
||||||
|
|
||||||
@@ -50,13 +50,13 @@ export class CiphersComponent extends BaseCiphersComponent implements OnDestroy
|
|||||||
constructor(searchService: SearchService,
|
constructor(searchService: SearchService,
|
||||||
protected i18nService: I18nService, protected platformUtilsService: PlatformUtilsService,
|
protected i18nService: I18nService, protected platformUtilsService: PlatformUtilsService,
|
||||||
protected cipherService: CipherService, protected eventService: EventService,
|
protected cipherService: CipherService, protected eventService: EventService,
|
||||||
protected totpService: TotpService, protected userService: UserService,
|
protected totpService: TotpService, protected stateService: StateService,
|
||||||
protected passwordRepromptService: PasswordRepromptService, private logService: LogService) {
|
protected passwordRepromptService: PasswordRepromptService, private logService: LogService) {
|
||||||
super(searchService);
|
super(searchService);
|
||||||
}
|
}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
this.userHasPremiumAccess = await this.userService.canAccessPremium();
|
this.userHasPremiumAccess = await this.stateService.getCanAccessPremium();
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
ngOnDestroy() {
|
||||||
|
|||||||
@@ -6,8 +6,7 @@ import {
|
|||||||
|
|
||||||
import { CollectionService } from 'jslib-common/abstractions/collection.service';
|
import { CollectionService } from 'jslib-common/abstractions/collection.service';
|
||||||
import { FolderService } from 'jslib-common/abstractions/folder.service';
|
import { FolderService } from 'jslib-common/abstractions/folder.service';
|
||||||
import { StorageService } from 'jslib-common/abstractions/storage.service';
|
import { StateService } from 'jslib-common/abstractions/state.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
|
||||||
|
|
||||||
import { GroupingsComponent as BaseGroupingsComponent } from 'jslib-angular/components/groupings.component';
|
import { GroupingsComponent as BaseGroupingsComponent } from 'jslib-angular/components/groupings.component';
|
||||||
|
|
||||||
@@ -22,8 +21,8 @@ export class GroupingsComponent extends BaseGroupingsComponent {
|
|||||||
searchPlaceholder: string = null;
|
searchPlaceholder: string = null;
|
||||||
|
|
||||||
constructor(collectionService: CollectionService, folderService: FolderService,
|
constructor(collectionService: CollectionService, folderService: FolderService,
|
||||||
storageService: StorageService, userService: UserService) {
|
stateService: StateService) {
|
||||||
super(collectionService, folderService, storageService, userService);
|
super(collectionService, folderService, stateService);
|
||||||
}
|
}
|
||||||
|
|
||||||
searchTextChanged() {
|
searchTextChanged() {
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ import {
|
|||||||
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 { OrganizationService } from 'jslib-common/abstractions/organization.service';
|
||||||
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
|
||||||
|
|
||||||
import { CollectionView } from 'jslib-common/models/view/collectionView';
|
import { CollectionView } from 'jslib-common/models/view/collectionView';
|
||||||
|
|
||||||
@@ -20,10 +20,10 @@ import { LogService } from 'jslib-common/abstractions/log.service';
|
|||||||
})
|
})
|
||||||
export class ShareComponent extends BaseShareComponent implements OnDestroy {
|
export class ShareComponent extends BaseShareComponent implements OnDestroy {
|
||||||
constructor(collectionService: CollectionService, platformUtilsService: PlatformUtilsService,
|
constructor(collectionService: CollectionService, platformUtilsService: PlatformUtilsService,
|
||||||
i18nService: I18nService, userService: UserService,
|
i18nService: I18nService, cipherService: CipherService,
|
||||||
cipherService: CipherService, logService: LogService) {
|
organizationService: OrganizationService, logService: LogService) {
|
||||||
super(collectionService, platformUtilsService, i18nService, userService, cipherService,
|
super(collectionService, platformUtilsService, i18nService, cipherService,
|
||||||
logService);
|
logService, organizationService);
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
ngOnDestroy() {
|
||||||
|
|||||||
@@ -32,10 +32,12 @@ import { BroadcasterService } from 'jslib-common/abstractions/broadcaster.servic
|
|||||||
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 { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
import { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
||||||
|
import { OrganizationService } from 'jslib-common/abstractions/organization.service';
|
||||||
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
||||||
|
import { ProviderService } from 'jslib-common/abstractions/provider.service';
|
||||||
|
import { StateService } from 'jslib-common/abstractions/state.service';
|
||||||
import { SyncService } from 'jslib-common/abstractions/sync.service';
|
import { SyncService } from 'jslib-common/abstractions/sync.service';
|
||||||
import { TokenService } from 'jslib-common/abstractions/token.service';
|
import { TokenService } from 'jslib-common/abstractions/token.service';
|
||||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
|
||||||
|
|
||||||
import { ModalService } from 'jslib-angular/services/modal.service';
|
import { ModalService } from 'jslib-angular/services/modal.service';
|
||||||
|
|
||||||
@@ -74,9 +76,10 @@ export class VaultComponent implements OnInit, OnDestroy {
|
|||||||
private router: Router, private changeDetectorRef: ChangeDetectorRef,
|
private router: Router, private changeDetectorRef: ChangeDetectorRef,
|
||||||
private i18nService: I18nService, private modalService: ModalService,
|
private i18nService: I18nService, private modalService: ModalService,
|
||||||
private tokenService: TokenService, private cryptoService: CryptoService,
|
private tokenService: TokenService, private cryptoService: CryptoService,
|
||||||
private messagingService: MessagingService, private userService: UserService,
|
private messagingService: MessagingService, private platformUtilsService: PlatformUtilsService,
|
||||||
private platformUtilsService: PlatformUtilsService, private broadcasterService: BroadcasterService,
|
private broadcasterService: BroadcasterService, private ngZone: NgZone,
|
||||||
private ngZone: NgZone) { }
|
private stateService: StateService, private organizationService: OrganizationService,
|
||||||
|
private providerService: ProviderService) { }
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
this.showVerifyEmail = !(await this.tokenService.getEmailVerified());
|
this.showVerifyEmail = !(await this.tokenService.getEmailVerified());
|
||||||
@@ -88,20 +91,20 @@ export class VaultComponent implements OnInit, OnDestroy {
|
|||||||
this.route.queryParams.pipe(first()).subscribe(async params => {
|
this.route.queryParams.pipe(first()).subscribe(async params => {
|
||||||
await this.syncService.fullSync(false);
|
await this.syncService.fullSync(false);
|
||||||
|
|
||||||
this.showUpdateKey = !(await this.cryptoService.hasEncKey());
|
const canAccessPremium = await this.stateService.getCanAccessPremium();
|
||||||
const canAccessPremium = await this.userService.canAccessPremium();
|
|
||||||
this.showPremiumCallout = !this.showVerifyEmail && !canAccessPremium &&
|
this.showPremiumCallout = !this.showVerifyEmail && !canAccessPremium &&
|
||||||
!this.platformUtilsService.isSelfHost();
|
!this.platformUtilsService.isSelfHost();
|
||||||
|
|
||||||
this.showProviders = (await this.userService.getAllProviders()).length > 0;
|
this.showProviders = (await this.providerService.getAll()).length > 0;
|
||||||
|
|
||||||
const allOrgs = await this.userService.getAllOrganizations();
|
const allOrgs = await this.organizationService.getAll();
|
||||||
this.showRedeemSponsorship = allOrgs.some(o => o.familySponsorshipAvailable) && !allOrgs.some(o => o.familySponsorshipFriendlyName != null);
|
this.showRedeemSponsorship = allOrgs.some(o => o.familySponsorshipAvailable) && !allOrgs.some(o => o.familySponsorshipFriendlyName != null);
|
||||||
|
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
this.groupingsComponent.load(),
|
this.groupingsComponent.load(),
|
||||||
this.organizationsComponent.load(),
|
this.organizationsComponent.load(),
|
||||||
]);
|
]);
|
||||||
|
this.showUpdateKey = !(await this.cryptoService.hasEncKey());
|
||||||
|
|
||||||
if (params == null) {
|
if (params == null) {
|
||||||
this.groupingsComponent.selectedAll = true;
|
this.groupingsComponent.selectedAll = true;
|
||||||
@@ -215,12 +218,12 @@ export class VaultComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async editCipherAttachments(cipher: CipherView) {
|
async editCipherAttachments(cipher: CipherView) {
|
||||||
const canAccessPremium = await this.userService.canAccessPremium();
|
const canAccessPremium = await this.stateService.getCanAccessPremium();
|
||||||
if (cipher.organizationId == null && !canAccessPremium) {
|
if (cipher.organizationId == null && !canAccessPremium) {
|
||||||
this.messagingService.send('premiumRequired');
|
this.messagingService.send('premiumRequired');
|
||||||
return;
|
return;
|
||||||
} else if (cipher.organizationId != null) {
|
} else if (cipher.organizationId != null) {
|
||||||
const org = await this.userService.getOrganization(cipher.organizationId);
|
const org = await this.organizationService.get(cipher.organizationId);
|
||||||
if (org != null && (org.maxStorageGb == null || org.maxStorageGb === 0)) {
|
if (org != null && (org.maxStorageGb == null || org.maxStorageGb === 0)) {
|
||||||
this.messagingService.send('upgradeOrganization', { organizationId: cipher.organizationId });
|
this.messagingService.send('upgradeOrganization', { organizationId: cipher.organizationId });
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ function parseParametersV2() {
|
|||||||
btnText: string;
|
btnText: string;
|
||||||
btnReturnText: string;
|
btnReturnText: string;
|
||||||
callbackUri?: string;
|
callbackUri?: string;
|
||||||
mobile?: boolean
|
mobile?: boolean;
|
||||||
} = null;
|
} = null;
|
||||||
try {
|
try {
|
||||||
dataObj = JSON.parse(b64Decode(getQsParam('data')));
|
dataObj = JSON.parse(b64Decode(getQsParam('data')));
|
||||||
|
|||||||
@@ -1,45 +1,40 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
|
|
||||||
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
|
||||||
import { StorageService } from 'jslib-common/abstractions/storage.service';
|
import { StorageService } from 'jslib-common/abstractions/storage.service';
|
||||||
import { ConstantsService } from 'jslib-common/services/constants.service';
|
|
||||||
|
import { HtmlStorageLocation } from 'jslib-common/enums/htmlStorageLocation';
|
||||||
|
|
||||||
|
import { GlobalState } from 'jslib-common/models/domain/globalState';
|
||||||
|
import { State } from 'jslib-common/models/domain/state';
|
||||||
|
import { StorageOptions } from 'jslib-common/models/domain/storageOptions';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class HtmlStorageService implements StorageService {
|
export class HtmlStorageService implements StorageService {
|
||||||
private localStorageKeys = new Set(['appId', 'anonymousAppId', 'rememberedEmail', 'passwordGenerationOptions',
|
|
||||||
ConstantsService.disableFaviconKey, 'rememberEmail', 'enableGravatars', 'enableFullWidth',
|
|
||||||
ConstantsService.localeKey, ConstantsService.autoConfirmFingerprints,
|
|
||||||
ConstantsService.vaultTimeoutKey, ConstantsService.vaultTimeoutActionKey, ConstantsService.ssoCodeVerifierKey,
|
|
||||||
ConstantsService.ssoStateKey, 'ssoOrgIdentifier', ConstantsService.themeKey]);
|
|
||||||
private localStorageStartsWithKeys = ['twoFactorToken_', ConstantsService.collapsedGroupingsKey + '_'];
|
|
||||||
private memoryStorageStartsWithKeys = ['ciphers_', 'folders_', 'collections_', 'settings_', 'lastSync_'];
|
|
||||||
private memoryStorage = new Map<string, string>();
|
|
||||||
|
|
||||||
constructor(private platformUtilsService: PlatformUtilsService) { }
|
get defaultOptions(): StorageOptions {
|
||||||
|
return { htmlStorageLocation: HtmlStorageLocation.Session };
|
||||||
async init() {
|
|
||||||
// LockOption -> VaultTimeout (uses the same legacy string value for backwards compat)
|
|
||||||
const vaultTimeout = await this.get<number>(ConstantsService.vaultTimeoutKey);
|
|
||||||
if (vaultTimeout == null && !this.platformUtilsService.isDev()) {
|
|
||||||
await this.save(ConstantsService.vaultTimeoutKey, 15);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Default Action to lock
|
|
||||||
const vaultTimeoutAction = await this.get<string>(ConstantsService.vaultTimeoutActionKey);
|
|
||||||
if (vaultTimeoutAction == null) {
|
|
||||||
await this.save(ConstantsService.vaultTimeoutActionKey, 'lock');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get<T>(key: string): Promise<T> {
|
async init() {
|
||||||
|
const state = await this.get<State>('state', { htmlStorageLocation: HtmlStorageLocation.Local }) ?? new State();
|
||||||
|
state.globals = state.globals ?? new GlobalState();
|
||||||
|
state.globals.vaultTimeout = state.globals.vaultTimeout ?? 15;
|
||||||
|
state.globals.vaultTimeoutAction = state.globals.vaultTimeoutAction ?? 'lock';
|
||||||
|
await this.save('state', state, { htmlStorageLocation: HtmlStorageLocation.Local });
|
||||||
|
}
|
||||||
|
|
||||||
|
get<T>(key: string, options: StorageOptions = this.defaultOptions): Promise<T> {
|
||||||
let json: string = null;
|
let json: string = null;
|
||||||
if (this.isLocalStorage(key)) {
|
switch (options.htmlStorageLocation) {
|
||||||
json = window.localStorage.getItem(key);
|
case HtmlStorageLocation.Local:
|
||||||
} else if (this.isMemoryStorage(key)) {
|
json = window.localStorage.getItem(key);
|
||||||
json = this.memoryStorage.get(key);
|
break;
|
||||||
} else {
|
case HtmlStorageLocation.Session:
|
||||||
json = window.sessionStorage.getItem(key);
|
default:
|
||||||
|
json = window.sessionStorage.getItem(key);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (json != null) {
|
if (json != null) {
|
||||||
const obj = JSON.parse(json);
|
const obj = JSON.parse(json);
|
||||||
return Promise.resolve(obj as T);
|
return Promise.resolve(obj as T);
|
||||||
@@ -47,13 +42,13 @@ export class HtmlStorageService implements StorageService {
|
|||||||
return Promise.resolve(null);
|
return Promise.resolve(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
async has(key: string): Promise<boolean> {
|
async has(key: string, options: StorageOptions = this.defaultOptions): Promise<boolean> {
|
||||||
return await this.get(key) != null;
|
return await this.get(key, options) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
save(key: string, obj: any): Promise<any> {
|
save(key: string, obj: any, options: StorageOptions = this.defaultOptions): Promise<any> {
|
||||||
if (obj == null) {
|
if (obj == null) {
|
||||||
return this.remove(key);
|
return this.remove(key, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj instanceof Set) {
|
if (obj instanceof Set) {
|
||||||
@@ -61,45 +56,28 @@ export class HtmlStorageService implements StorageService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const json = JSON.stringify(obj);
|
const json = JSON.stringify(obj);
|
||||||
if (this.isLocalStorage(key)) {
|
switch (options.htmlStorageLocation) {
|
||||||
window.localStorage.setItem(key, json);
|
case HtmlStorageLocation.Local:
|
||||||
} else if (this.isMemoryStorage(key)) {
|
window.localStorage.setItem(key, json);
|
||||||
this.memoryStorage.set(key, json);
|
break;
|
||||||
} else {
|
case HtmlStorageLocation.Session:
|
||||||
window.sessionStorage.setItem(key, json);
|
default:
|
||||||
|
window.sessionStorage.setItem(key, json);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
remove(key: string): Promise<any> {
|
remove(key: string, options: StorageOptions = this.defaultOptions): Promise<any> {
|
||||||
if (this.isLocalStorage(key)) {
|
switch (options.htmlStorageLocation) {
|
||||||
window.localStorage.removeItem(key);
|
case HtmlStorageLocation.Local:
|
||||||
} else if (this.isMemoryStorage(key)) {
|
window.localStorage.removeItem(key);
|
||||||
this.memoryStorage.delete(key);
|
break;
|
||||||
} else {
|
case HtmlStorageLocation.Session:
|
||||||
window.sessionStorage.removeItem(key);
|
default:
|
||||||
|
window.sessionStorage.removeItem(key);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
private isLocalStorage(key: string): boolean {
|
|
||||||
if (this.localStorageKeys.has(key)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
for (const swKey of this.localStorageStartsWithKeys) {
|
|
||||||
if (key.startsWith(swKey)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private isMemoryStorage(key: string): boolean {
|
|
||||||
for (const swKey of this.memoryStorageStartsWithKeys) {
|
|
||||||
if (key.startsWith(swKey)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,9 +7,7 @@ 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 { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
import { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
||||||
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
||||||
import { StorageService } from 'jslib-common/abstractions/storage.service';
|
import { StateService } from 'jslib-common/abstractions/state.service';
|
||||||
|
|
||||||
import { ConstantsService } from 'jslib-common/services/constants.service';
|
|
||||||
|
|
||||||
export class WebPlatformUtilsService implements PlatformUtilsService {
|
export class WebPlatformUtilsService implements PlatformUtilsService {
|
||||||
identityClientId: string = 'web';
|
identityClientId: string = 'web';
|
||||||
@@ -18,7 +16,7 @@ export class WebPlatformUtilsService implements PlatformUtilsService {
|
|||||||
private prefersColorSchemeDark = window.matchMedia('(prefers-color-scheme: dark)');
|
private prefersColorSchemeDark = window.matchMedia('(prefers-color-scheme: dark)');
|
||||||
|
|
||||||
constructor(private i18nService: I18nService, private messagingService: MessagingService,
|
constructor(private i18nService: I18nService, private messagingService: MessagingService,
|
||||||
private logService: LogService, private storageService: () => StorageService) { }
|
private logService: LogService, private stateService: StateService) { }
|
||||||
|
|
||||||
getDevice(): DeviceType {
|
getDevice(): DeviceType {
|
||||||
if (this.browserCache != null) {
|
if (this.browserCache != null) {
|
||||||
@@ -293,7 +291,7 @@ export class WebPlatformUtilsService implements PlatformUtilsService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getEffectiveTheme(): Promise<ThemeType.Light | ThemeType.Dark> {
|
async getEffectiveTheme(): Promise<ThemeType.Light | ThemeType.Dark> {
|
||||||
const theme = await this.storageService().get<ThemeType>(ConstantsService.themeKey);
|
const theme = await this.stateService.getTheme();
|
||||||
if (theme === ThemeType.Dark) {
|
if (theme === ThemeType.Dark) {
|
||||||
return ThemeType.Dark;
|
return ThemeType.Dark;
|
||||||
} else if (theme === ThemeType.System) {
|
} else if (theme === ThemeType.System) {
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user