Skip to content

Commit deb878d

Browse files
committed
Rename recaptchaEnforcementStateList to recaptchaEnforcementState
1 parent 1e6feae commit deb878d

File tree

4 files changed

+11
-12
lines changed

4 files changed

+11
-12
lines changed

packages/auth/src/api/authentication/recaptcha.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,14 @@ interface GetRecaptchaConfigRequest {
4848
version?: RecaptchaVersion;
4949
}
5050

51-
export interface RecaptchaEnforcementState {
51+
export interface RecaptchaEnforcementProviderState {
5252
provider: string;
5353
enforcementState: string;
5454
}
5555

5656
export interface GetRecaptchaConfigResponse {
5757
recaptchaKey: string;
58-
recaptchaEnforcementState: RecaptchaEnforcementState[];
58+
recaptchaEnforcementState: RecaptchaEnforcementProviderState[];
5959
}
6060

6161
export async function getRecaptchaConfig(

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,7 @@ describe('core/auth/auth_impl', () => {
710710
]
711711
};
712712
const cachedRecaptchaConfigEnforce = {
713-
recaptchaEnforcementStateList: [
713+
recaptchaEnforcementState: [
714714
{
715715
'enforcementState': 'ENFORCE',
716716
'provider': 'EMAIL_PASSWORD_PROVIDER'
@@ -719,7 +719,7 @@ describe('core/auth/auth_impl', () => {
719719
siteKey: 'site-key'
720720
};
721721
const cachedRecaptchaConfigOFF = {
722-
recaptchaEnforcementStateList: [
722+
recaptchaEnforcementState: [
723723
{
724724
'enforcementState': 'OFF',
725725
'provider': 'EMAIL_PASSWORD_PROVIDER'

packages/auth/src/platform_browser/recaptcha/recaptcha.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ describe('platform_browser/recaptcha/recaptcha', () => {
8080

8181
it('should construct the recaptcha config from the backend response', () => {
8282
expect(recaptchaConfig.siteKey).to.eq(TEST_SITE_KEY);
83-
expect(recaptchaConfig.recaptchaEnforcementStateList[0]).to.eql({
83+
expect(recaptchaConfig.recaptchaEnforcementState[0]).to.eql({
8484
provider: 'EMAIL_PASSWORD_PROVIDER',
8585
enforcementState: 'ENFORCE'
8686
});

packages/auth/src/platform_browser/recaptcha/recaptcha.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import { RecaptchaParameters } from '../../model/public_types';
1919
import {
2020
GetRecaptchaConfigResponse,
21-
RecaptchaEnforcementState
21+
RecaptchaEnforcementProviderState
2222
} from '../../api/authentication/recaptcha';
2323
import { EnforcementState, _parseEnforcementState } from '../../api/index';
2424

@@ -84,15 +84,15 @@ export class RecaptchaConfig {
8484
/**
8585
* The list of providers and their enablement status for reCAPTCHA Enterprise.
8686
*/
87-
recaptchaEnforcementStateList: RecaptchaEnforcementState[] = [];
87+
recaptchaEnforcementState: RecaptchaEnforcementProviderState[] = [];
8888

8989
constructor(response: GetRecaptchaConfigResponse) {
9090
if (response.recaptchaKey === undefined) {
9191
throw new Error('recaptchaKey undefined');
9292
}
9393
// Example response.recaptchaKey: "projects/proj123/keys/sitekey123"
9494
this.siteKey = response.recaptchaKey.split('/')[3];
95-
this.recaptchaEnforcementStateList = response.recaptchaEnforcementState;
95+
this.recaptchaEnforcementState = response.recaptchaEnforcementState;
9696
}
9797

9898
/**
@@ -103,14 +103,13 @@ export class RecaptchaConfig {
103103
*/
104104
getProviderEnforcementState(providerStr: string): EnforcementState | null {
105105
if (
106-
!this.recaptchaEnforcementStateList ||
107-
this.recaptchaEnforcementStateList.length === 0
106+
!this.recaptchaEnforcementState ||
107+
this.recaptchaEnforcementState.length === 0
108108
) {
109109
return null;
110110
}
111111

112-
for (const recaptchaEnforcementState of this
113-
.recaptchaEnforcementStateList) {
112+
for (const recaptchaEnforcementState of this.recaptchaEnforcementState) {
114113
if (
115114
recaptchaEnforcementState.provider &&
116115
recaptchaEnforcementState.provider === providerStr

0 commit comments

Comments
 (0)