mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 16:23:44 +00:00
Removing register component changes.
This commit is contained in:
@@ -23,16 +23,13 @@ import {
|
|||||||
LoginComponentService,
|
LoginComponentService,
|
||||||
LockComponentService,
|
LockComponentService,
|
||||||
} from "@bitwarden/auth/angular";
|
} from "@bitwarden/auth/angular";
|
||||||
import { LockService, LoginEmailService, PinServiceAbstraction } from "@bitwarden/auth/common";
|
import { LockService, PinServiceAbstraction } from "@bitwarden/auth/common";
|
||||||
import { EventCollectionService as EventCollectionServiceAbstraction } from "@bitwarden/common/abstractions/event/event-collection.service";
|
import { EventCollectionService as EventCollectionServiceAbstraction } from "@bitwarden/common/abstractions/event/event-collection.service";
|
||||||
import { NotificationsService } from "@bitwarden/common/abstractions/notifications.service";
|
import { NotificationsService } from "@bitwarden/common/abstractions/notifications.service";
|
||||||
import { VaultTimeoutService } from "@bitwarden/common/abstractions/vault-timeout/vault-timeout.service";
|
import { VaultTimeoutService } from "@bitwarden/common/abstractions/vault-timeout/vault-timeout.service";
|
||||||
import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction";
|
import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction";
|
||||||
import { PolicyService } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction";
|
import { PolicyService } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction";
|
||||||
import {
|
import { AccountService as AccountServiceAbstraction } from "@bitwarden/common/auth/abstractions/account.service";
|
||||||
AccountService,
|
|
||||||
AccountService as AccountServiceAbstraction,
|
|
||||||
} from "@bitwarden/common/auth/abstractions/account.service";
|
|
||||||
import { AuthService } from "@bitwarden/common/auth/abstractions/auth.service";
|
import { AuthService } from "@bitwarden/common/auth/abstractions/auth.service";
|
||||||
import { KdfConfigService } from "@bitwarden/common/auth/abstractions/kdf-config.service";
|
import { KdfConfigService } from "@bitwarden/common/auth/abstractions/kdf-config.service";
|
||||||
import { InternalMasterPasswordServiceAbstraction } from "@bitwarden/common/auth/abstractions/master-password.service.abstraction";
|
import { InternalMasterPasswordServiceAbstraction } from "@bitwarden/common/auth/abstractions/master-password.service.abstraction";
|
||||||
@@ -603,11 +600,6 @@ const safeProviders: SafeProvider[] = [
|
|||||||
useClass: ForegroundLockService,
|
useClass: ForegroundLockService,
|
||||||
deps: [MessageSender, MessageListener],
|
deps: [MessageSender, MessageListener],
|
||||||
}),
|
}),
|
||||||
safeProvider({
|
|
||||||
provide: LoginEmailService,
|
|
||||||
useClass: LoginEmailService,
|
|
||||||
deps: [AccountService, AuthService, StateProvider],
|
|
||||||
}),
|
|
||||||
safeProvider({
|
safeProvider({
|
||||||
provide: SdkClientFactory,
|
provide: SdkClientFactory,
|
||||||
useClass: flagEnabled("sdk") ? BrowserSdkClientFactory : NoopSdkClientFactory,
|
useClass: flagEnabled("sdk") ? BrowserSdkClientFactory : NoopSdkClientFactory,
|
||||||
|
|||||||
@@ -26,21 +26,14 @@ import {
|
|||||||
} from "@bitwarden/auth/angular";
|
} from "@bitwarden/auth/angular";
|
||||||
import {
|
import {
|
||||||
InternalUserDecryptionOptionsServiceAbstraction,
|
InternalUserDecryptionOptionsServiceAbstraction,
|
||||||
LoginEmailService,
|
|
||||||
PinServiceAbstraction,
|
PinServiceAbstraction,
|
||||||
} from "@bitwarden/auth/common";
|
} from "@bitwarden/auth/common";
|
||||||
import { ApiService } from "@bitwarden/common/abstractions/api.service";
|
import { ApiService } from "@bitwarden/common/abstractions/api.service";
|
||||||
import { VaultTimeoutSettingsService } from "@bitwarden/common/abstractions/vault-timeout/vault-timeout-settings.service";
|
import { VaultTimeoutSettingsService } from "@bitwarden/common/abstractions/vault-timeout/vault-timeout-settings.service";
|
||||||
import { OrganizationApiServiceAbstraction } from "@bitwarden/common/admin-console/abstractions/organization/organization-api.service.abstraction";
|
import { OrganizationApiServiceAbstraction } from "@bitwarden/common/admin-console/abstractions/organization/organization-api.service.abstraction";
|
||||||
import { PolicyService as PolicyServiceAbstraction } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction";
|
import { PolicyService as PolicyServiceAbstraction } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction";
|
||||||
import {
|
import { AccountService as AccountServiceAbstraction } from "@bitwarden/common/auth/abstractions/account.service";
|
||||||
AccountService,
|
import { AuthService as AuthServiceAbstraction } from "@bitwarden/common/auth/abstractions/auth.service";
|
||||||
AccountService as AccountServiceAbstraction,
|
|
||||||
} from "@bitwarden/common/auth/abstractions/account.service";
|
|
||||||
import {
|
|
||||||
AuthService,
|
|
||||||
AuthService as AuthServiceAbstraction,
|
|
||||||
} from "@bitwarden/common/auth/abstractions/auth.service";
|
|
||||||
import {
|
import {
|
||||||
KdfConfigService,
|
KdfConfigService,
|
||||||
KdfConfigService as KdfConfigServiceAbstraction,
|
KdfConfigService as KdfConfigServiceAbstraction,
|
||||||
@@ -333,11 +326,6 @@ const safeProviders: SafeProvider[] = [
|
|||||||
ToastService,
|
ToastService,
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
safeProvider({
|
|
||||||
provide: LoginEmailService,
|
|
||||||
useClass: LoginEmailService,
|
|
||||||
deps: [AccountService, AuthService, StateProvider],
|
|
||||||
}),
|
|
||||||
safeProvider({
|
safeProvider({
|
||||||
provide: SdkClientFactory,
|
provide: SdkClientFactory,
|
||||||
useClass: flagEnabled("sdk") ? DefaultSdkClientFactory : NoopSdkClientFactory,
|
useClass: flagEnabled("sdk") ? DefaultSdkClientFactory : NoopSdkClientFactory,
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { Router } from "@angular/router";
|
|||||||
|
|
||||||
import { RegisterComponent as BaseRegisterComponent } from "@bitwarden/angular/auth/components/register.component";
|
import { RegisterComponent as BaseRegisterComponent } from "@bitwarden/angular/auth/components/register.component";
|
||||||
import { FormValidationErrorsService } from "@bitwarden/angular/platform/abstractions/form-validation-errors.service";
|
import { FormValidationErrorsService } from "@bitwarden/angular/platform/abstractions/form-validation-errors.service";
|
||||||
import { LoginEmailService, LoginStrategyServiceAbstraction } from "@bitwarden/auth/common";
|
import { LoginStrategyServiceAbstraction } from "@bitwarden/auth/common";
|
||||||
import { ApiService } from "@bitwarden/common/abstractions/api.service";
|
import { ApiService } from "@bitwarden/common/abstractions/api.service";
|
||||||
import { AuditService } from "@bitwarden/common/abstractions/audit.service";
|
import { AuditService } from "@bitwarden/common/abstractions/audit.service";
|
||||||
import { BroadcasterService } from "@bitwarden/common/platform/abstractions/broadcaster.service";
|
import { BroadcasterService } from "@bitwarden/common/platform/abstractions/broadcaster.service";
|
||||||
@@ -42,7 +42,6 @@ export class RegisterComponent extends BaseRegisterComponent implements OnInit,
|
|||||||
auditService: AuditService,
|
auditService: AuditService,
|
||||||
dialogService: DialogService,
|
dialogService: DialogService,
|
||||||
toastService: ToastService,
|
toastService: ToastService,
|
||||||
loginEmailService: LoginEmailService,
|
|
||||||
) {
|
) {
|
||||||
super(
|
super(
|
||||||
formValidationErrorService,
|
formValidationErrorService,
|
||||||
@@ -60,7 +59,6 @@ export class RegisterComponent extends BaseRegisterComponent implements OnInit,
|
|||||||
auditService,
|
auditService,
|
||||||
dialogService,
|
dialogService,
|
||||||
toastService,
|
toastService,
|
||||||
loginEmailService,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { ComponentFixture, TestBed, fakeAsync, tick, flush } from "@angular/core/testing";
|
import { ComponentFixture, TestBed } from "@angular/core/testing";
|
||||||
import { ReactiveFormsModule } from "@angular/forms";
|
import { ReactiveFormsModule } from "@angular/forms";
|
||||||
import { RouterTestingModule } from "@angular/router/testing";
|
import { RouterTestingModule } from "@angular/router/testing";
|
||||||
import { of, BehaviorSubject } from "rxjs";
|
import { of } from "rxjs";
|
||||||
|
|
||||||
import { OrganizationUserApiService } from "@bitwarden/admin-console/common";
|
import { OrganizationUserApiService } from "@bitwarden/admin-console/common";
|
||||||
import { FormValidationErrorsService } from "@bitwarden/angular/platform/abstractions/form-validation-errors.service";
|
import { FormValidationErrorsService } from "@bitwarden/angular/platform/abstractions/form-validation-errors.service";
|
||||||
@@ -26,7 +26,6 @@ import { PasswordStrengthServiceAbstraction } from "@bitwarden/common/tools/pass
|
|||||||
import { DialogService, ToastService } from "@bitwarden/components";
|
import { DialogService, ToastService } from "@bitwarden/components";
|
||||||
import { PasswordGenerationServiceAbstraction } from "@bitwarden/generator-legacy";
|
import { PasswordGenerationServiceAbstraction } from "@bitwarden/generator-legacy";
|
||||||
|
|
||||||
import { LoginEmailService } from "../../../../../../libs/auth/src/common/services/login-email/login-email.service";
|
|
||||||
import { SharedModule } from "../../shared";
|
import { SharedModule } from "../../shared";
|
||||||
import { AcceptOrganizationInviteService } from "../organization-invite/accept-organization.service";
|
import { AcceptOrganizationInviteService } from "../organization-invite/accept-organization.service";
|
||||||
|
|
||||||
@@ -59,15 +58,8 @@ class MockPasswordStrengthServiceAbstraction {
|
|||||||
describe("RegisterFormComponent", () => {
|
describe("RegisterFormComponent", () => {
|
||||||
let component: RegisterFormComponent;
|
let component: RegisterFormComponent;
|
||||||
let fixture: ComponentFixture<RegisterFormComponent>;
|
let fixture: ComponentFixture<RegisterFormComponent>;
|
||||||
let loginEmailService: LoginEmailService;
|
|
||||||
let loginEmailSubject: BehaviorSubject<string>;
|
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
loginEmailSubject = new BehaviorSubject<string>("");
|
|
||||||
const loginEmailServiceMock = {
|
|
||||||
loginEmail$: loginEmailSubject.asObservable(),
|
|
||||||
};
|
|
||||||
|
|
||||||
const authServiceMock = {
|
const authServiceMock = {
|
||||||
authStatuses$: of([]),
|
authStatuses$: of([]),
|
||||||
};
|
};
|
||||||
@@ -89,7 +81,6 @@ describe("RegisterFormComponent", () => {
|
|||||||
imports: [ReactiveFormsModule, RouterTestingModule, SharedModule],
|
imports: [ReactiveFormsModule, RouterTestingModule, SharedModule],
|
||||||
declarations: [RegisterFormComponent],
|
declarations: [RegisterFormComponent],
|
||||||
providers: [
|
providers: [
|
||||||
{ provide: LoginEmailService, useValue: loginEmailServiceMock },
|
|
||||||
{ provide: AuthService, useValue: authServiceMock },
|
{ provide: AuthService, useValue: authServiceMock },
|
||||||
{ provide: EncryptService, useValue: encryptServiceMock },
|
{ provide: EncryptService, useValue: encryptServiceMock },
|
||||||
{ provide: PolicyApiServiceAbstraction, useValue: policyApiServiceMock },
|
{ provide: PolicyApiServiceAbstraction, useValue: policyApiServiceMock },
|
||||||
@@ -123,33 +114,9 @@ describe("RegisterFormComponent", () => {
|
|||||||
|
|
||||||
fixture = TestBed.createComponent(RegisterFormComponent);
|
fixture = TestBed.createComponent(RegisterFormComponent);
|
||||||
component = fixture.componentInstance;
|
component = fixture.componentInstance;
|
||||||
loginEmailService = TestBed.inject(LoginEmailService);
|
|
||||||
|
|
||||||
// Ensure the form group is initialized
|
|
||||||
await component.ngOnInit();
|
|
||||||
|
|
||||||
// Subscribe to loginEmail$ to set the email value
|
|
||||||
loginEmailService.loginEmail$.subscribe((email) => {
|
|
||||||
component.formGroup.get("email")?.setValue(email);
|
|
||||||
});
|
|
||||||
|
|
||||||
fixture.detectChanges();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("creates without", () => {
|
it("creates without error", () => {
|
||||||
expect(component).toBeTruthy();
|
expect(component).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("sets email from loginEmailService", fakeAsync(() => {
|
|
||||||
// Emit a new email value to the loginEmailSubject
|
|
||||||
loginEmailSubject.next("test@example.com");
|
|
||||||
// Simulate the passage of time to allow for async operations
|
|
||||||
tick();
|
|
||||||
// Trigger change detection to update the view
|
|
||||||
fixture.detectChanges();
|
|
||||||
// Ensure all pending asynchronous activities are completed
|
|
||||||
flush();
|
|
||||||
|
|
||||||
expect(component.formGroup.get("email")?.value).toBe("test@example.com");
|
|
||||||
}));
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ import { StateService } from "@bitwarden/common/platform/abstractions/state.serv
|
|||||||
import { DialogService, ToastService } from "@bitwarden/components";
|
import { DialogService, ToastService } from "@bitwarden/components";
|
||||||
import { PasswordGenerationServiceAbstraction } from "@bitwarden/generator-legacy";
|
import { PasswordGenerationServiceAbstraction } from "@bitwarden/generator-legacy";
|
||||||
|
|
||||||
import { LoginEmailService } from "../../../../../../libs/auth/src/common/services/login-email/login-email.service";
|
|
||||||
import { AcceptOrganizationInviteService } from "../organization-invite/accept-organization.service";
|
import { AcceptOrganizationInviteService } from "../organization-invite/accept-organization.service";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -54,7 +53,6 @@ export class RegisterFormComponent extends BaseRegisterComponent implements OnIn
|
|||||||
dialogService: DialogService,
|
dialogService: DialogService,
|
||||||
acceptOrgInviteService: AcceptOrganizationInviteService,
|
acceptOrgInviteService: AcceptOrganizationInviteService,
|
||||||
toastService: ToastService,
|
toastService: ToastService,
|
||||||
loginEmailService: LoginEmailService,
|
|
||||||
) {
|
) {
|
||||||
super(
|
super(
|
||||||
formValidationErrorService,
|
formValidationErrorService,
|
||||||
@@ -72,7 +70,6 @@ export class RegisterFormComponent extends BaseRegisterComponent implements OnIn
|
|||||||
auditService,
|
auditService,
|
||||||
dialogService,
|
dialogService,
|
||||||
toastService,
|
toastService,
|
||||||
loginEmailService,
|
|
||||||
);
|
);
|
||||||
super.modifyRegisterRequest = async (request: RegisterRequest) => {
|
super.modifyRegisterRequest = async (request: RegisterRequest) => {
|
||||||
// Org invites are deep linked. Non-existent accounts are redirected to the register page.
|
// Org invites are deep linked. Non-existent accounts are redirected to the register page.
|
||||||
|
|||||||
@@ -31,10 +31,7 @@ import {
|
|||||||
LockComponentService,
|
LockComponentService,
|
||||||
SetPasswordJitService,
|
SetPasswordJitService,
|
||||||
} from "@bitwarden/auth/angular";
|
} from "@bitwarden/auth/angular";
|
||||||
import {
|
import { InternalUserDecryptionOptionsServiceAbstraction } from "@bitwarden/auth/common";
|
||||||
InternalUserDecryptionOptionsServiceAbstraction,
|
|
||||||
LoginEmailService,
|
|
||||||
} from "@bitwarden/auth/common";
|
|
||||||
import { ApiService } from "@bitwarden/common/abstractions/api.service";
|
import { ApiService } from "@bitwarden/common/abstractions/api.service";
|
||||||
import { OrganizationApiServiceAbstraction } from "@bitwarden/common/admin-console/abstractions/organization/organization-api.service.abstraction";
|
import { OrganizationApiServiceAbstraction } from "@bitwarden/common/admin-console/abstractions/organization/organization-api.service.abstraction";
|
||||||
import { PolicyApiServiceAbstraction } from "@bitwarden/common/admin-console/abstractions/policy/policy-api.service.abstraction";
|
import { PolicyApiServiceAbstraction } from "@bitwarden/common/admin-console/abstractions/policy/policy-api.service.abstraction";
|
||||||
@@ -44,7 +41,6 @@ import {
|
|||||||
} from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction";
|
} from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction";
|
||||||
import { AccountApiService as AccountApiServiceAbstraction } from "@bitwarden/common/auth/abstractions/account-api.service";
|
import { AccountApiService as AccountApiServiceAbstraction } from "@bitwarden/common/auth/abstractions/account-api.service";
|
||||||
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
|
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
|
||||||
import { AuthService } from "@bitwarden/common/auth/abstractions/auth.service";
|
|
||||||
import { KdfConfigService } from "@bitwarden/common/auth/abstractions/kdf-config.service";
|
import { KdfConfigService } from "@bitwarden/common/auth/abstractions/kdf-config.service";
|
||||||
import { InternalMasterPasswordServiceAbstraction } from "@bitwarden/common/auth/abstractions/master-password.service.abstraction";
|
import { InternalMasterPasswordServiceAbstraction } from "@bitwarden/common/auth/abstractions/master-password.service.abstraction";
|
||||||
import { SsoLoginServiceAbstraction } from "@bitwarden/common/auth/abstractions/sso-login.service.abstraction";
|
import { SsoLoginServiceAbstraction } from "@bitwarden/common/auth/abstractions/sso-login.service.abstraction";
|
||||||
@@ -272,11 +268,6 @@ const safeProviders: SafeProvider[] = [
|
|||||||
SsoLoginServiceAbstraction,
|
SsoLoginServiceAbstraction,
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
safeProvider({
|
|
||||||
provide: LoginEmailService,
|
|
||||||
useClass: LoginEmailService,
|
|
||||||
deps: [AccountService, AuthService, StateProvider],
|
|
||||||
}),
|
|
||||||
safeProvider({
|
safeProvider({
|
||||||
provide: CollectionAdminService,
|
provide: CollectionAdminService,
|
||||||
useClass: DefaultCollectionAdminService,
|
useClass: DefaultCollectionAdminService,
|
||||||
|
|||||||
@@ -2,11 +2,7 @@ import { Directive, EventEmitter, Input, OnInit, Output } from "@angular/core";
|
|||||||
import { AbstractControl, UntypedFormBuilder, ValidatorFn, Validators } from "@angular/forms";
|
import { AbstractControl, UntypedFormBuilder, ValidatorFn, Validators } from "@angular/forms";
|
||||||
import { Router } from "@angular/router";
|
import { Router } from "@angular/router";
|
||||||
|
|
||||||
import {
|
import { LoginStrategyServiceAbstraction, PasswordLoginCredentials } from "@bitwarden/auth/common";
|
||||||
LoginEmailService,
|
|
||||||
LoginStrategyServiceAbstraction,
|
|
||||||
PasswordLoginCredentials,
|
|
||||||
} from "@bitwarden/auth/common";
|
|
||||||
import { ApiService } from "@bitwarden/common/abstractions/api.service";
|
import { ApiService } from "@bitwarden/common/abstractions/api.service";
|
||||||
import { AuditService } from "@bitwarden/common/abstractions/audit.service";
|
import { AuditService } from "@bitwarden/common/abstractions/audit.service";
|
||||||
import { DEFAULT_KDF_CONFIG } from "@bitwarden/common/auth/models/domain/kdf-config";
|
import { DEFAULT_KDF_CONFIG } from "@bitwarden/common/auth/models/domain/kdf-config";
|
||||||
@@ -103,7 +99,6 @@ export class RegisterComponent extends CaptchaProtectedComponent implements OnIn
|
|||||||
protected auditService: AuditService,
|
protected auditService: AuditService,
|
||||||
protected dialogService: DialogService,
|
protected dialogService: DialogService,
|
||||||
protected toastService: ToastService,
|
protected toastService: ToastService,
|
||||||
protected loginEmailService: LoginEmailService,
|
|
||||||
) {
|
) {
|
||||||
super(environmentService, i18nService, platformUtilsService, toastService);
|
super(environmentService, i18nService, platformUtilsService, toastService);
|
||||||
this.showTerms = !platformUtilsService.isSelfHost();
|
this.showTerms = !platformUtilsService.isSelfHost();
|
||||||
|
|||||||
Reference in New Issue
Block a user