Skip to content

Commit 928a7b5

Browse files
committed
Rename _getPasswordPolicy to _getPasswordPolicyInternal
1 parent c81f7d9 commit 928a7b5

File tree

5 files changed

+23
-19
lines changed

5 files changed

+23
-19
lines changed

packages/auth/src/core/auth/auth_impl.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -854,15 +854,15 @@ describe('core/auth/auth_impl', () => {
854854
auth.tenantId = null;
855855
await auth._updatePasswordPolicy();
856856

857-
expect(auth._getPasswordPolicy()).to.eql(CACHED_PASSWORD_POLICY);
857+
expect(auth._getPasswordPolicyInternal()).to.eql(CACHED_PASSWORD_POLICY);
858858
});
859859

860860
it('password policy should be set for tenant if tenant ID is not null', async () => {
861861
auth = await testAuth();
862862
auth.tenantId = TEST_TENANT_ID;
863863
await auth._updatePasswordPolicy();
864864

865-
expect(auth._getPasswordPolicy()).to.eql(
865+
expect(auth._getPasswordPolicyInternal()).to.eql(
866866
CACHED_PASSWORD_POLICY_REQUIRE_NUMERIC
867867
);
868868
});
@@ -876,13 +876,13 @@ describe('core/auth/auth_impl', () => {
876876
await auth._updatePasswordPolicy();
877877

878878
auth.tenantId = null;
879-
expect(auth._getPasswordPolicy()).to.eql(CACHED_PASSWORD_POLICY);
879+
expect(auth._getPasswordPolicyInternal()).to.eql(CACHED_PASSWORD_POLICY);
880880
auth.tenantId = TEST_TENANT_ID;
881-
expect(auth._getPasswordPolicy()).to.eql(
881+
expect(auth._getPasswordPolicyInternal()).to.eql(
882882
CACHED_PASSWORD_POLICY_REQUIRE_NUMERIC
883883
);
884884
auth.tenantId = 'other-tenant-id';
885-
expect(auth._getPasswordPolicy()).to.be.undefined;
885+
expect(auth._getPasswordPolicyInternal()).to.be.undefined;
886886
});
887887

888888
it('password policy should not be set when the schema version is not supported', async () => {
@@ -892,7 +892,7 @@ describe('core/auth/auth_impl', () => {
892892
AuthErrorCode.UNSUPPORTED_PASSWORD_POLICY_SCHEMA_VERSION
893893
);
894894

895-
expect(auth._getPasswordPolicy()).to.be.undefined;
895+
expect(auth._getPasswordPolicyInternal()).to.be.undefined;
896896
});
897897
});
898898
});

packages/auth/src/core/auth/auth_impl.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -430,14 +430,14 @@ export class AuthImpl implements AuthInternal, _FirebaseService {
430430
}
431431

432432
async validatePassword(password: string): Promise<PasswordValidationStatus> {
433-
if (!this._getPasswordPolicy()) {
433+
if (!this._getPasswordPolicyInternal()) {
434434
await this._updatePasswordPolicy();
435435
}
436436

437-
return this._getPasswordPolicy()!.validatePassword(password);
437+
return this._getPasswordPolicyInternal()!.validatePassword(password);
438438
}
439439

440-
_getPasswordPolicy(): PasswordPolicyInternal | null {
440+
_getPasswordPolicyInternal(): PasswordPolicyInternal | null {
441441
if (this.tenantId === null) {
442442
return this._projectPasswordPolicy;
443443
} else {

packages/auth/src/core/strategies/email_and_password.test.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -807,7 +807,7 @@ describe('core/strategies/email_and_password/createUserWithEmailAndPassword', ()
807807
).to.be.fulfilled;
808808

809809
expect(policyEndpointMock.calls.length).to.eq(0);
810-
expect(auth._getPasswordPolicy()).to.be.null;
810+
expect(auth._getPasswordPolicyInternal()).to.be.null;
811811
});
812812

813813
it('does not update the cached password policy upon successful sign up when there is an existing policy cache', async () => {
@@ -818,7 +818,7 @@ describe('core/strategies/email_and_password/createUserWithEmailAndPassword', ()
818818
).to.be.fulfilled;
819819

820820
expect(policyEndpointMock.calls.length).to.eq(1);
821-
expect(auth._getPasswordPolicy()).to.eql(CACHED_PASSWORD_POLICY);
821+
expect(auth._getPasswordPolicyInternal()).to.eql(CACHED_PASSWORD_POLICY);
822822
});
823823

824824
context('handles password validation errors', () => {
@@ -838,7 +838,9 @@ describe('core/strategies/email_and_password/createUserWithEmailAndPassword', ()
838838
it('updates the cached password policy when password does not meet backend requirements', async () => {
839839
await auth._updatePasswordPolicy();
840840
expect(policyEndpointMock.calls.length).to.eq(1);
841-
expect(auth._getPasswordPolicy()).to.eql(CACHED_PASSWORD_POLICY);
841+
expect(auth._getPasswordPolicyInternal()).to.eql(
842+
CACHED_PASSWORD_POLICY
843+
);
842844

843845
// Password policy changed after previous fetch.
844846
policyEndpointMock.response = PASSWORD_POLICY_RESPONSE_REQUIRE_NUMERIC;
@@ -847,34 +849,36 @@ describe('core/strategies/email_and_password/createUserWithEmailAndPassword', ()
847849
).to.be.rejectedWith(FirebaseError, PASSWORD_ERROR_MSG);
848850

849851
expect(policyEndpointMock.calls.length).to.eq(2);
850-
expect(auth._getPasswordPolicy()).to.eql(
852+
expect(auth._getPasswordPolicyInternal()).to.eql(
851853
CACHED_PASSWORD_POLICY_REQUIRE_NUMERIC
852854
);
853855
});
854856

855857
it('does not update the cached password policy upon error if policy has not previously been fetched', async () => {
856-
expect(auth._getPasswordPolicy()).to.be.null;
858+
expect(auth._getPasswordPolicyInternal()).to.be.null;
857859

858860
await expect(
859861
createUserWithEmailAndPassword(auth, 'some-email', 'some-password')
860862
).to.be.rejectedWith(FirebaseError, PASSWORD_ERROR_MSG);
861863

862864
expect(policyEndpointMock.calls.length).to.eq(0);
863-
expect(auth._getPasswordPolicy()).to.be.null;
865+
expect(auth._getPasswordPolicyInternal()).to.be.null;
864866
});
865867

866868
it('does not update the cached password policy upon error if tenant changes and policy has not previously been fetched', async () => {
867869
auth.tenantId = TEST_TENANT_ID;
868870
await auth._updatePasswordPolicy();
869871
expect(policyEndpointMockWithTenant.calls.length).to.eq(1);
870-
expect(auth._getPasswordPolicy()).to.eql(CACHED_PASSWORD_POLICY);
872+
expect(auth._getPasswordPolicyInternal()).to.eql(
873+
CACHED_PASSWORD_POLICY
874+
);
871875

872876
auth.tenantId = TEST_REQUIRE_NUMERIC_TENANT_ID;
873877
await expect(
874878
createUserWithEmailAndPassword(auth, 'some-email', 'some-password')
875879
).to.be.rejectedWith(FirebaseError, PASSWORD_ERROR_MSG);
876880
expect(policyEndpointMockWithOtherTenant.calls.length).to.eq(0);
877-
expect(auth._getPasswordPolicy()).to.be.undefined;
881+
expect(auth._getPasswordPolicyInternal()).to.be.undefined;
878882
});
879883
});
880884
});

packages/auth/src/core/strategies/email_and_password.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ export async function createUserWithEmailAndPassword(
313313
if (
314314
error.code ===
315315
`auth/${AuthErrorCode.PASSWORD_DOES_NOT_MEET_REQUIREMENTS}` &&
316-
authInternal._getPasswordPolicy()
316+
authInternal._getPasswordPolicyInternal()
317317
) {
318318
await authInternal._updatePasswordPolicy();
319319
}

packages/auth/src/model/auth.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export interface AuthInternal extends Auth {
8888
_stopProactiveRefresh(): void;
8989
_getPersistence(): string;
9090
_getRecaptchaConfig(): RecaptchaConfig | null;
91-
_getPasswordPolicy(): PasswordPolicyInternal | null;
91+
_getPasswordPolicyInternal(): PasswordPolicyInternal | null;
9292
_updatePasswordPolicy(): Promise<void>;
9393
_logFramework(framework: string): void;
9494
_getFrameworks(): readonly string[];

0 commit comments

Comments
 (0)