1
0
mirror of https://github.com/bitwarden/browser.git synced 2025-01-23 21:31:29 +01:00

Removing register component changes.

This commit is contained in:
Alec Rippberger 2024-10-10 15:34:37 -05:00
parent 75330897d1
commit 99ddbc9cd6
No known key found for this signature in database
GPG Key ID: 9DD8DA583B28154A
7 changed files with 10 additions and 82 deletions

View File

@ -23,16 +23,13 @@ import {
LoginComponentService,
LockComponentService,
} 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 { NotificationsService } from "@bitwarden/common/abstractions/notifications.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 { PolicyService } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction";
import {
AccountService,
AccountService as AccountServiceAbstraction,
} from "@bitwarden/common/auth/abstractions/account.service";
import { AccountService as AccountServiceAbstraction } 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 { InternalMasterPasswordServiceAbstraction } from "@bitwarden/common/auth/abstractions/master-password.service.abstraction";
@ -603,11 +600,6 @@ const safeProviders: SafeProvider[] = [
useClass: ForegroundLockService,
deps: [MessageSender, MessageListener],
}),
safeProvider({
provide: LoginEmailService,
useClass: LoginEmailService,
deps: [AccountService, AuthService, StateProvider],
}),
safeProvider({
provide: SdkClientFactory,
useClass: flagEnabled("sdk") ? BrowserSdkClientFactory : NoopSdkClientFactory,

View File

@ -26,21 +26,14 @@ import {
} from "@bitwarden/auth/angular";
import {
InternalUserDecryptionOptionsServiceAbstraction,
LoginEmailService,
PinServiceAbstraction,
} from "@bitwarden/auth/common";
import { ApiService } from "@bitwarden/common/abstractions/api.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 { PolicyService as PolicyServiceAbstraction } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction";
import {
AccountService,
AccountService as AccountServiceAbstraction,
} from "@bitwarden/common/auth/abstractions/account.service";
import {
AuthService,
AuthService as AuthServiceAbstraction,
} from "@bitwarden/common/auth/abstractions/auth.service";
import { AccountService as AccountServiceAbstraction } from "@bitwarden/common/auth/abstractions/account.service";
import { AuthService as AuthServiceAbstraction } from "@bitwarden/common/auth/abstractions/auth.service";
import {
KdfConfigService,
KdfConfigService as KdfConfigServiceAbstraction,
@ -333,11 +326,6 @@ const safeProviders: SafeProvider[] = [
ToastService,
],
}),
safeProvider({
provide: LoginEmailService,
useClass: LoginEmailService,
deps: [AccountService, AuthService, StateProvider],
}),
safeProvider({
provide: SdkClientFactory,
useClass: flagEnabled("sdk") ? DefaultSdkClientFactory : NoopSdkClientFactory,

View File

@ -4,7 +4,7 @@ import { Router } from "@angular/router";
import { RegisterComponent as BaseRegisterComponent } from "@bitwarden/angular/auth/components/register.component";
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 { AuditService } from "@bitwarden/common/abstractions/audit.service";
import { BroadcasterService } from "@bitwarden/common/platform/abstractions/broadcaster.service";
@ -42,7 +42,6 @@ export class RegisterComponent extends BaseRegisterComponent implements OnInit,
auditService: AuditService,
dialogService: DialogService,
toastService: ToastService,
loginEmailService: LoginEmailService,
) {
super(
formValidationErrorService,
@ -60,7 +59,6 @@ export class RegisterComponent extends BaseRegisterComponent implements OnInit,
auditService,
dialogService,
toastService,
loginEmailService,
);
}

View File

@ -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 { RouterTestingModule } from "@angular/router/testing";
import { of, BehaviorSubject } from "rxjs";
import { of } from "rxjs";
import { OrganizationUserApiService } from "@bitwarden/admin-console/common";
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 { PasswordGenerationServiceAbstraction } from "@bitwarden/generator-legacy";
import { LoginEmailService } from "../../../../../../libs/auth/src/common/services/login-email/login-email.service";
import { SharedModule } from "../../shared";
import { AcceptOrganizationInviteService } from "../organization-invite/accept-organization.service";
@ -59,15 +58,8 @@ class MockPasswordStrengthServiceAbstraction {
describe("RegisterFormComponent", () => {
let component: RegisterFormComponent;
let fixture: ComponentFixture<RegisterFormComponent>;
let loginEmailService: LoginEmailService;
let loginEmailSubject: BehaviorSubject<string>;
beforeEach(async () => {
loginEmailSubject = new BehaviorSubject<string>("");
const loginEmailServiceMock = {
loginEmail$: loginEmailSubject.asObservable(),
};
const authServiceMock = {
authStatuses$: of([]),
};
@ -89,7 +81,6 @@ describe("RegisterFormComponent", () => {
imports: [ReactiveFormsModule, RouterTestingModule, SharedModule],
declarations: [RegisterFormComponent],
providers: [
{ provide: LoginEmailService, useValue: loginEmailServiceMock },
{ provide: AuthService, useValue: authServiceMock },
{ provide: EncryptService, useValue: encryptServiceMock },
{ provide: PolicyApiServiceAbstraction, useValue: policyApiServiceMock },
@ -123,33 +114,9 @@ describe("RegisterFormComponent", () => {
fixture = TestBed.createComponent(RegisterFormComponent);
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();
});
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");
}));
});

View File

@ -20,7 +20,6 @@ import { StateService } from "@bitwarden/common/platform/abstractions/state.serv
import { DialogService, ToastService } from "@bitwarden/components";
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";
@Component({
@ -54,7 +53,6 @@ export class RegisterFormComponent extends BaseRegisterComponent implements OnIn
dialogService: DialogService,
acceptOrgInviteService: AcceptOrganizationInviteService,
toastService: ToastService,
loginEmailService: LoginEmailService,
) {
super(
formValidationErrorService,
@ -72,7 +70,6 @@ export class RegisterFormComponent extends BaseRegisterComponent implements OnIn
auditService,
dialogService,
toastService,
loginEmailService,
);
super.modifyRegisterRequest = async (request: RegisterRequest) => {
// Org invites are deep linked. Non-existent accounts are redirected to the register page.

View File

@ -31,10 +31,7 @@ import {
LockComponentService,
SetPasswordJitService,
} from "@bitwarden/auth/angular";
import {
InternalUserDecryptionOptionsServiceAbstraction,
LoginEmailService,
} from "@bitwarden/auth/common";
import { InternalUserDecryptionOptionsServiceAbstraction } from "@bitwarden/auth/common";
import { ApiService } from "@bitwarden/common/abstractions/api.service";
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";
@ -44,7 +41,6 @@ import {
} from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction";
import { AccountApiService as AccountApiServiceAbstraction } from "@bitwarden/common/auth/abstractions/account-api.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 { InternalMasterPasswordServiceAbstraction } from "@bitwarden/common/auth/abstractions/master-password.service.abstraction";
import { SsoLoginServiceAbstraction } from "@bitwarden/common/auth/abstractions/sso-login.service.abstraction";
@ -272,11 +268,6 @@ const safeProviders: SafeProvider[] = [
SsoLoginServiceAbstraction,
],
}),
safeProvider({
provide: LoginEmailService,
useClass: LoginEmailService,
deps: [AccountService, AuthService, StateProvider],
}),
safeProvider({
provide: CollectionAdminService,
useClass: DefaultCollectionAdminService,

View File

@ -2,11 +2,7 @@ import { Directive, EventEmitter, Input, OnInit, Output } from "@angular/core";
import { AbstractControl, UntypedFormBuilder, ValidatorFn, Validators } from "@angular/forms";
import { Router } from "@angular/router";
import {
LoginEmailService,
LoginStrategyServiceAbstraction,
PasswordLoginCredentials,
} from "@bitwarden/auth/common";
import { LoginStrategyServiceAbstraction, PasswordLoginCredentials } from "@bitwarden/auth/common";
import { ApiService } from "@bitwarden/common/abstractions/api.service";
import { AuditService } from "@bitwarden/common/abstractions/audit.service";
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 dialogService: DialogService,
protected toastService: ToastService,
protected loginEmailService: LoginEmailService,
) {
super(environmentService, i18nService, platformUtilsService, toastService);
this.showTerms = !platformUtilsService.isSelfHost();