@firebase/auth 1.3.0-canary.b59229836 → 1.3.0-canary.bd073b26a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth-public.d.ts +25 -4
- package/dist/auth.d.ts +25 -4
- package/dist/browser-cjs/{index-4eb942ed.js → index-579a938f.js} +115 -127
- package/dist/browser-cjs/index-579a938f.js.map +1 -0
- package/dist/browser-cjs/index.js +1 -1
- package/dist/browser-cjs/internal.js +1 -1
- package/dist/browser-cjs/src/api/authentication/recaptcha.d.ts +2 -2
- package/dist/browser-cjs/src/api/index.d.ts +10 -0
- package/dist/browser-cjs/src/platform_browser/recaptcha/recaptcha.d.ts +18 -3
- package/dist/browser-cjs/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +3 -0
- package/dist/cordova/index.js +2 -2
- package/dist/cordova/internal.js +2 -2
- package/dist/cordova/{popup_redirect-b1a231bb.js → popup_redirect-400d4165.js} +165 -214
- package/dist/cordova/popup_redirect-400d4165.js.map +1 -0
- package/dist/cordova/src/api/authentication/recaptcha.d.ts +2 -2
- package/dist/cordova/src/api/index.d.ts +10 -0
- package/dist/cordova/src/platform_browser/recaptcha/recaptcha.d.ts +18 -3
- package/dist/cordova/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +3 -0
- package/dist/esm2017/{index-4b97e93f.js → index-5030de23.js} +115 -127
- package/dist/esm2017/index-5030de23.js.map +1 -0
- package/dist/esm2017/index.js +1 -1
- package/dist/esm2017/internal.js +2 -2
- package/dist/esm2017/src/api/authentication/recaptcha.d.ts +2 -2
- package/dist/esm2017/src/api/index.d.ts +10 -0
- package/dist/esm2017/src/platform_browser/recaptcha/recaptcha.d.ts +18 -3
- package/dist/esm2017/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +3 -0
- package/dist/esm5/{index-f6e4aa26.js → index-eeff7a7d.js} +165 -214
- package/dist/esm5/index-eeff7a7d.js.map +1 -0
- package/dist/esm5/index.js +1 -1
- package/dist/esm5/internal.js +2 -2
- package/dist/esm5/src/api/authentication/recaptcha.d.ts +2 -2
- package/dist/esm5/src/api/index.d.ts +10 -0
- package/dist/esm5/src/platform_browser/recaptcha/recaptcha.d.ts +18 -3
- package/dist/esm5/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +3 -0
- package/dist/index.webworker.esm5.js +123 -172
- package/dist/index.webworker.esm5.js.map +1 -1
- package/dist/node/index.js +1 -1
- package/dist/node/internal.js +1 -1
- package/dist/node/src/api/authentication/recaptcha.d.ts +2 -2
- package/dist/node/src/api/index.d.ts +10 -0
- package/dist/node/src/platform_browser/recaptcha/recaptcha.d.ts +18 -3
- package/dist/node/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +3 -0
- package/dist/node/{totp-effd4d8c.js → totp-a4fded14.js} +161 -210
- package/dist/node/totp-a4fded14.js.map +1 -0
- package/dist/node-esm/index.js +1 -1
- package/dist/node-esm/internal.js +2 -2
- package/dist/node-esm/src/api/authentication/recaptcha.d.ts +2 -2
- package/dist/node-esm/src/api/index.d.ts +10 -0
- package/dist/node-esm/src/platform_browser/recaptcha/recaptcha.d.ts +18 -3
- package/dist/node-esm/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +3 -0
- package/dist/node-esm/{totp-32f612c8.js → totp-1609c8f4.js} +111 -123
- package/dist/node-esm/totp-1609c8f4.js.map +1 -0
- package/dist/rn/{index-33580ad0.js → index-44789ad9.js} +165 -214
- package/dist/rn/index-44789ad9.js.map +1 -0
- package/dist/rn/index.js +1 -1
- package/dist/rn/internal.js +1 -1
- package/dist/rn/src/api/authentication/recaptcha.d.ts +2 -2
- package/dist/rn/src/api/index.d.ts +10 -0
- package/dist/rn/src/platform_browser/recaptcha/recaptcha.d.ts +18 -3
- package/dist/rn/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +3 -0
- package/dist/src/api/authentication/recaptcha.d.ts +2 -2
- package/dist/src/api/index.d.ts +10 -0
- package/dist/src/platform_browser/recaptcha/recaptcha.d.ts +18 -3
- package/dist/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +3 -0
- package/package.json +6 -6
- package/dist/browser-cjs/index-4eb942ed.js.map +0 -1
- package/dist/cordova/popup_redirect-b1a231bb.js.map +0 -1
- package/dist/esm2017/index-4b97e93f.js.map +0 -1
- package/dist/esm5/index-f6e4aa26.js.map +0 -1
- package/dist/node/totp-effd4d8c.js.map +0 -1
- package/dist/node-esm/totp-32f612c8.js.map +0 -1
- package/dist/rn/index-33580ad0.js.map +0 -1
package/dist/auth-public.d.ts
CHANGED
|
@@ -1087,6 +1087,13 @@ export declare interface EmulatorConfig {
|
|
|
1087
1087
|
readonly disableWarnings: boolean;
|
|
1088
1088
|
};
|
|
1089
1089
|
}
|
|
1090
|
+
|
|
1091
|
+
declare const enum EnforcementState {
|
|
1092
|
+
ENFORCE = "ENFORCE",
|
|
1093
|
+
AUDIT = "AUDIT",
|
|
1094
|
+
OFF = "OFF",
|
|
1095
|
+
ENFORCEMENT_STATE_UNSPECIFIED = "ENFORCEMENT_STATE_UNSPECIFIED"
|
|
1096
|
+
}
|
|
1090
1097
|
export { ErrorFn }
|
|
1091
1098
|
|
|
1092
1099
|
/* Excluded from this release type: EventManager */
|
|
@@ -1300,7 +1307,7 @@ export declare function getMultiFactorResolver(auth: Auth, error: MultiFactorErr
|
|
|
1300
1307
|
|
|
1301
1308
|
declare interface GetRecaptchaConfigResponse {
|
|
1302
1309
|
recaptchaKey: string;
|
|
1303
|
-
recaptchaEnforcementState:
|
|
1310
|
+
recaptchaEnforcementState: RecaptchaEnforcementProviderState[];
|
|
1304
1311
|
}
|
|
1305
1312
|
|
|
1306
1313
|
/**
|
|
@@ -2812,13 +2819,27 @@ declare class RecaptchaConfig {
|
|
|
2812
2819
|
*/
|
|
2813
2820
|
siteKey: string;
|
|
2814
2821
|
/**
|
|
2815
|
-
* The
|
|
2822
|
+
* The list of providers and their enablement status for reCAPTCHA Enterprise.
|
|
2816
2823
|
*/
|
|
2817
|
-
|
|
2824
|
+
recaptchaEnforcementState: RecaptchaEnforcementProviderState[];
|
|
2818
2825
|
constructor(response: GetRecaptchaConfigResponse);
|
|
2826
|
+
/**
|
|
2827
|
+
* Returns the reCAPTCHA Enterprise enforcement state for the given provider.
|
|
2828
|
+
*
|
|
2829
|
+
* @param providerStr - The provider whose enforcement state is to be returned.
|
|
2830
|
+
* @returns The reCAPTCHA Enterprise enforcement state for the given provider.
|
|
2831
|
+
*/
|
|
2832
|
+
getProviderEnforcementState(providerStr: string): EnforcementState | null;
|
|
2833
|
+
/**
|
|
2834
|
+
* Returns true if the reCAPTCHA Enterprise enforcement state for the provider is set to ENFORCE or AUDIT.
|
|
2835
|
+
*
|
|
2836
|
+
* @param providerStr - The provider whose enablement state is to be returned.
|
|
2837
|
+
* @returns Whether or not reCAPTCHA Enterprise protection is enabled for the given provider.
|
|
2838
|
+
*/
|
|
2839
|
+
isProviderEnabled(providerStr: string): boolean;
|
|
2819
2840
|
}
|
|
2820
2841
|
|
|
2821
|
-
declare interface
|
|
2842
|
+
declare interface RecaptchaEnforcementProviderState {
|
|
2822
2843
|
provider: string;
|
|
2823
2844
|
enforcementState: string;
|
|
2824
2845
|
}
|
package/dist/auth.d.ts
CHANGED
|
@@ -1367,6 +1367,13 @@ export declare interface EmulatorConfig {
|
|
|
1367
1367
|
readonly disableWarnings: boolean;
|
|
1368
1368
|
};
|
|
1369
1369
|
}
|
|
1370
|
+
|
|
1371
|
+
declare const enum EnforcementState {
|
|
1372
|
+
ENFORCE = "ENFORCE",
|
|
1373
|
+
AUDIT = "AUDIT",
|
|
1374
|
+
OFF = "OFF",
|
|
1375
|
+
ENFORCEMENT_STATE_UNSPECIFIED = "ENFORCEMENT_STATE_UNSPECIFIED"
|
|
1376
|
+
}
|
|
1370
1377
|
export { ErrorFn }
|
|
1371
1378
|
|
|
1372
1379
|
/**
|
|
@@ -1598,7 +1605,7 @@ export declare function getMultiFactorResolver(auth: Auth, error: MultiFactorErr
|
|
|
1598
1605
|
|
|
1599
1606
|
declare interface GetRecaptchaConfigResponse {
|
|
1600
1607
|
recaptchaKey: string;
|
|
1601
|
-
recaptchaEnforcementState:
|
|
1608
|
+
recaptchaEnforcementState: RecaptchaEnforcementProviderState[];
|
|
1602
1609
|
}
|
|
1603
1610
|
|
|
1604
1611
|
/**
|
|
@@ -3273,13 +3280,27 @@ declare class RecaptchaConfig {
|
|
|
3273
3280
|
*/
|
|
3274
3281
|
siteKey: string;
|
|
3275
3282
|
/**
|
|
3276
|
-
* The
|
|
3283
|
+
* The list of providers and their enablement status for reCAPTCHA Enterprise.
|
|
3277
3284
|
*/
|
|
3278
|
-
|
|
3285
|
+
recaptchaEnforcementState: RecaptchaEnforcementProviderState[];
|
|
3279
3286
|
constructor(response: GetRecaptchaConfigResponse);
|
|
3287
|
+
/**
|
|
3288
|
+
* Returns the reCAPTCHA Enterprise enforcement state for the given provider.
|
|
3289
|
+
*
|
|
3290
|
+
* @param providerStr - The provider whose enforcement state is to be returned.
|
|
3291
|
+
* @returns The reCAPTCHA Enterprise enforcement state for the given provider.
|
|
3292
|
+
*/
|
|
3293
|
+
getProviderEnforcementState(providerStr: string): EnforcementState | null;
|
|
3294
|
+
/**
|
|
3295
|
+
* Returns true if the reCAPTCHA Enterprise enforcement state for the provider is set to ENFORCE or AUDIT.
|
|
3296
|
+
*
|
|
3297
|
+
* @param providerStr - The provider whose enablement state is to be returned.
|
|
3298
|
+
* @returns Whether or not reCAPTCHA Enterprise protection is enabled for the given provider.
|
|
3299
|
+
*/
|
|
3300
|
+
isProviderEnabled(providerStr: string): boolean;
|
|
3280
3301
|
}
|
|
3281
3302
|
|
|
3282
|
-
declare interface
|
|
3303
|
+
declare interface RecaptchaEnforcementProviderState {
|
|
3283
3304
|
provider: string;
|
|
3284
3305
|
enforcementState: string;
|
|
3285
3306
|
}
|
|
@@ -105,50 +105,6 @@ const ActionCodeOperation = {
|
|
|
105
105
|
VERIFY_EMAIL: 'VERIFY_EMAIL'
|
|
106
106
|
};
|
|
107
107
|
|
|
108
|
-
/**
|
|
109
|
-
* @license
|
|
110
|
-
* Copyright 2020 Google LLC
|
|
111
|
-
*
|
|
112
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
113
|
-
* you may not use this file except in compliance with the License.
|
|
114
|
-
* You may obtain a copy of the License at
|
|
115
|
-
*
|
|
116
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
117
|
-
*
|
|
118
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
119
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
120
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
121
|
-
* See the License for the specific language governing permissions and
|
|
122
|
-
* limitations under the License.
|
|
123
|
-
*/
|
|
124
|
-
function isV2(grecaptcha) {
|
|
125
|
-
return (grecaptcha !== undefined &&
|
|
126
|
-
grecaptcha.getResponse !== undefined);
|
|
127
|
-
}
|
|
128
|
-
function isEnterprise(grecaptcha) {
|
|
129
|
-
return (grecaptcha !== undefined &&
|
|
130
|
-
grecaptcha.enterprise !== undefined);
|
|
131
|
-
}
|
|
132
|
-
class RecaptchaConfig {
|
|
133
|
-
constructor(response) {
|
|
134
|
-
/**
|
|
135
|
-
* The reCAPTCHA site key.
|
|
136
|
-
*/
|
|
137
|
-
this.siteKey = '';
|
|
138
|
-
/**
|
|
139
|
-
* The reCAPTCHA enablement status of the {@link EmailAuthProvider} for the current tenant.
|
|
140
|
-
*/
|
|
141
|
-
this.emailPasswordEnabled = false;
|
|
142
|
-
if (response.recaptchaKey === undefined) {
|
|
143
|
-
throw new Error('recaptchaKey undefined');
|
|
144
|
-
}
|
|
145
|
-
// Example response.recaptchaKey: "projects/proj123/keys/sitekey123"
|
|
146
|
-
this.siteKey = response.recaptchaKey.split('/')[3];
|
|
147
|
-
this.emailPasswordEnabled = response.recaptchaEnforcementState.some(enforcementState => enforcementState.provider === 'EMAIL_PASSWORD_PROVIDER' &&
|
|
148
|
-
enforcementState.enforcementState !== 'OFF');
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
108
|
/**
|
|
153
109
|
* @license
|
|
154
110
|
* Copyright 2020 Google LLC
|
|
@@ -987,6 +943,18 @@ function _getFinalTarget(auth, host, path, query) {
|
|
|
987
943
|
}
|
|
988
944
|
return _emulatorUrl(auth.config, base);
|
|
989
945
|
}
|
|
946
|
+
function _parseEnforcementState(enforcementStateStr) {
|
|
947
|
+
switch (enforcementStateStr) {
|
|
948
|
+
case 'ENFORCE':
|
|
949
|
+
return "ENFORCE" /* EnforcementState.ENFORCE */;
|
|
950
|
+
case 'AUDIT':
|
|
951
|
+
return "AUDIT" /* EnforcementState.AUDIT */;
|
|
952
|
+
case 'OFF':
|
|
953
|
+
return "OFF" /* EnforcementState.OFF */;
|
|
954
|
+
default:
|
|
955
|
+
return "ENFORCEMENT_STATE_UNSPECIFIED" /* EnforcementState.ENFORCEMENT_STATE_UNSPECIFIED */;
|
|
956
|
+
}
|
|
957
|
+
}
|
|
990
958
|
class NetworkTimeout {
|
|
991
959
|
constructor(auth) {
|
|
992
960
|
this.auth = auth;
|
|
@@ -1020,6 +988,79 @@ function _makeTaggedError(auth, code, response) {
|
|
|
1020
988
|
return error;
|
|
1021
989
|
}
|
|
1022
990
|
|
|
991
|
+
/**
|
|
992
|
+
* @license
|
|
993
|
+
* Copyright 2020 Google LLC
|
|
994
|
+
*
|
|
995
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
996
|
+
* you may not use this file except in compliance with the License.
|
|
997
|
+
* You may obtain a copy of the License at
|
|
998
|
+
*
|
|
999
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1000
|
+
*
|
|
1001
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1002
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1003
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1004
|
+
* See the License for the specific language governing permissions and
|
|
1005
|
+
* limitations under the License.
|
|
1006
|
+
*/
|
|
1007
|
+
function isV2(grecaptcha) {
|
|
1008
|
+
return (grecaptcha !== undefined &&
|
|
1009
|
+
grecaptcha.getResponse !== undefined);
|
|
1010
|
+
}
|
|
1011
|
+
function isEnterprise(grecaptcha) {
|
|
1012
|
+
return (grecaptcha !== undefined &&
|
|
1013
|
+
grecaptcha.enterprise !== undefined);
|
|
1014
|
+
}
|
|
1015
|
+
class RecaptchaConfig {
|
|
1016
|
+
constructor(response) {
|
|
1017
|
+
/**
|
|
1018
|
+
* The reCAPTCHA site key.
|
|
1019
|
+
*/
|
|
1020
|
+
this.siteKey = '';
|
|
1021
|
+
/**
|
|
1022
|
+
* The list of providers and their enablement status for reCAPTCHA Enterprise.
|
|
1023
|
+
*/
|
|
1024
|
+
this.recaptchaEnforcementState = [];
|
|
1025
|
+
if (response.recaptchaKey === undefined) {
|
|
1026
|
+
throw new Error('recaptchaKey undefined');
|
|
1027
|
+
}
|
|
1028
|
+
// Example response.recaptchaKey: "projects/proj123/keys/sitekey123"
|
|
1029
|
+
this.siteKey = response.recaptchaKey.split('/')[3];
|
|
1030
|
+
this.recaptchaEnforcementState = response.recaptchaEnforcementState;
|
|
1031
|
+
}
|
|
1032
|
+
/**
|
|
1033
|
+
* Returns the reCAPTCHA Enterprise enforcement state for the given provider.
|
|
1034
|
+
*
|
|
1035
|
+
* @param providerStr - The provider whose enforcement state is to be returned.
|
|
1036
|
+
* @returns The reCAPTCHA Enterprise enforcement state for the given provider.
|
|
1037
|
+
*/
|
|
1038
|
+
getProviderEnforcementState(providerStr) {
|
|
1039
|
+
if (!this.recaptchaEnforcementState ||
|
|
1040
|
+
this.recaptchaEnforcementState.length === 0) {
|
|
1041
|
+
return null;
|
|
1042
|
+
}
|
|
1043
|
+
for (const recaptchaEnforcementState of this.recaptchaEnforcementState) {
|
|
1044
|
+
if (recaptchaEnforcementState.provider &&
|
|
1045
|
+
recaptchaEnforcementState.provider === providerStr) {
|
|
1046
|
+
return _parseEnforcementState(recaptchaEnforcementState.enforcementState);
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
return null;
|
|
1050
|
+
}
|
|
1051
|
+
/**
|
|
1052
|
+
* Returns true if the reCAPTCHA Enterprise enforcement state for the provider is set to ENFORCE or AUDIT.
|
|
1053
|
+
*
|
|
1054
|
+
* @param providerStr - The provider whose enablement state is to be returned.
|
|
1055
|
+
* @returns Whether or not reCAPTCHA Enterprise protection is enabled for the given provider.
|
|
1056
|
+
*/
|
|
1057
|
+
isProviderEnabled(providerStr) {
|
|
1058
|
+
return (this.getProviderEnforcementState(providerStr) ===
|
|
1059
|
+
"ENFORCE" /* EnforcementState.ENFORCE */ ||
|
|
1060
|
+
this.getProviderEnforcementState(providerStr) === "AUDIT" /* EnforcementState.AUDIT */);
|
|
1061
|
+
}
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1023
1064
|
/**
|
|
1024
1065
|
* @license
|
|
1025
1066
|
* Copyright 2020 Google LLC
|
|
@@ -3135,6 +3176,26 @@ async function injectRecaptchaFields(auth, request, action, captchaResp = false)
|
|
|
3135
3176
|
});
|
|
3136
3177
|
return newRequest;
|
|
3137
3178
|
}
|
|
3179
|
+
async function handleRecaptchaFlow(authInstance, request, actionName, actionMethod) {
|
|
3180
|
+
var _a;
|
|
3181
|
+
if ((_a = authInstance
|
|
3182
|
+
._getRecaptchaConfig()) === null || _a === void 0 ? void 0 : _a.isProviderEnabled("EMAIL_PASSWORD_PROVIDER" /* RecaptchaProvider.EMAIL_PASSWORD_PROVIDER */)) {
|
|
3183
|
+
const requestWithRecaptcha = await injectRecaptchaFields(authInstance, request, actionName, actionName === "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */);
|
|
3184
|
+
return actionMethod(authInstance, requestWithRecaptcha);
|
|
3185
|
+
}
|
|
3186
|
+
else {
|
|
3187
|
+
return actionMethod(authInstance, request).catch(async (error) => {
|
|
3188
|
+
if (error.code === `auth/${"missing-recaptcha-token" /* AuthErrorCode.MISSING_RECAPTCHA_TOKEN */}`) {
|
|
3189
|
+
console.log(`${actionName} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);
|
|
3190
|
+
const requestWithRecaptcha = await injectRecaptchaFields(authInstance, request, actionName, actionName === "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */);
|
|
3191
|
+
return actionMethod(authInstance, requestWithRecaptcha);
|
|
3192
|
+
}
|
|
3193
|
+
else {
|
|
3194
|
+
return Promise.reject(error);
|
|
3195
|
+
}
|
|
3196
|
+
});
|
|
3197
|
+
}
|
|
3198
|
+
}
|
|
3138
3199
|
async function _initializeRecaptchaConfig(auth) {
|
|
3139
3200
|
const authInternal = _castAuth(auth);
|
|
3140
3201
|
const response = await getRecaptchaConfig(authInternal, {
|
|
@@ -3148,7 +3209,7 @@ async function _initializeRecaptchaConfig(auth) {
|
|
|
3148
3209
|
else {
|
|
3149
3210
|
authInternal._tenantRecaptchaConfigs[authInternal.tenantId] = config;
|
|
3150
3211
|
}
|
|
3151
|
-
if (config.
|
|
3212
|
+
if (config.isProviderEnabled("EMAIL_PASSWORD_PROVIDER" /* RecaptchaProvider.EMAIL_PASSWORD_PROVIDER */)) {
|
|
3152
3213
|
const verifier = new RecaptchaEnterpriseVerifier(authInternal);
|
|
3153
3214
|
void verifier.verify();
|
|
3154
3215
|
}
|
|
@@ -3561,7 +3622,6 @@ class EmailAuthCredential extends AuthCredential {
|
|
|
3561
3622
|
}
|
|
3562
3623
|
/** @internal */
|
|
3563
3624
|
async _getIdTokenResponse(auth) {
|
|
3564
|
-
var _a;
|
|
3565
3625
|
switch (this.signInMethod) {
|
|
3566
3626
|
case "password" /* SignInMethod.EMAIL_PASSWORD */:
|
|
3567
3627
|
const request = {
|
|
@@ -3570,22 +3630,7 @@ class EmailAuthCredential extends AuthCredential {
|
|
|
3570
3630
|
password: this._password,
|
|
3571
3631
|
clientType: "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */
|
|
3572
3632
|
};
|
|
3573
|
-
|
|
3574
|
-
const requestWithRecaptcha = await injectRecaptchaFields(auth, request, "signInWithPassword" /* RecaptchaActionName.SIGN_IN_WITH_PASSWORD */);
|
|
3575
|
-
return signInWithPassword(auth, requestWithRecaptcha);
|
|
3576
|
-
}
|
|
3577
|
-
else {
|
|
3578
|
-
return signInWithPassword(auth, request).catch(async (error) => {
|
|
3579
|
-
if (error.code === `auth/${"missing-recaptcha-token" /* AuthErrorCode.MISSING_RECAPTCHA_TOKEN */}`) {
|
|
3580
|
-
console.log('Sign-in with email address and password is protected by reCAPTCHA for this project. Automatically triggering the reCAPTCHA flow and restarting the sign-in flow.');
|
|
3581
|
-
const requestWithRecaptcha = await injectRecaptchaFields(auth, request, "signInWithPassword" /* RecaptchaActionName.SIGN_IN_WITH_PASSWORD */);
|
|
3582
|
-
return signInWithPassword(auth, requestWithRecaptcha);
|
|
3583
|
-
}
|
|
3584
|
-
else {
|
|
3585
|
-
return Promise.reject(error);
|
|
3586
|
-
}
|
|
3587
|
-
});
|
|
3588
|
-
}
|
|
3633
|
+
return handleRecaptchaFlow(auth, request, "signInWithPassword" /* RecaptchaActionName.SIGN_IN_WITH_PASSWORD */, signInWithPassword);
|
|
3589
3634
|
case "emailLink" /* SignInMethod.EMAIL_LINK */:
|
|
3590
3635
|
return signInWithEmailLink$1(auth, {
|
|
3591
3636
|
email: this._email,
|
|
@@ -5563,39 +5608,16 @@ async function recachePasswordPolicy(auth) {
|
|
|
5563
5608
|
* @public
|
|
5564
5609
|
*/
|
|
5565
5610
|
async function sendPasswordResetEmail(auth, email, actionCodeSettings) {
|
|
5566
|
-
var _a;
|
|
5567
5611
|
const authInternal = _castAuth(auth);
|
|
5568
5612
|
const request = {
|
|
5569
5613
|
requestType: "PASSWORD_RESET" /* ActionCodeOperation.PASSWORD_RESET */,
|
|
5570
5614
|
email,
|
|
5571
5615
|
clientType: "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */
|
|
5572
5616
|
};
|
|
5573
|
-
if (
|
|
5574
|
-
|
|
5575
|
-
if (actionCodeSettings) {
|
|
5576
|
-
_setActionCodeSettingsOnRequest(authInternal, requestWithRecaptcha, actionCodeSettings);
|
|
5577
|
-
}
|
|
5578
|
-
await sendPasswordResetEmail$1(authInternal, requestWithRecaptcha);
|
|
5579
|
-
}
|
|
5580
|
-
else {
|
|
5581
|
-
if (actionCodeSettings) {
|
|
5582
|
-
_setActionCodeSettingsOnRequest(authInternal, request, actionCodeSettings);
|
|
5583
|
-
}
|
|
5584
|
-
await sendPasswordResetEmail$1(authInternal, request)
|
|
5585
|
-
.catch(async (error) => {
|
|
5586
|
-
if (error.code === `auth/${"missing-recaptcha-token" /* AuthErrorCode.MISSING_RECAPTCHA_TOKEN */}`) {
|
|
5587
|
-
console.log('Password resets are protected by reCAPTCHA for this project. Automatically triggering the reCAPTCHA flow and restarting the password reset flow.');
|
|
5588
|
-
const requestWithRecaptcha = await injectRecaptchaFields(authInternal, request, "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */, true);
|
|
5589
|
-
if (actionCodeSettings) {
|
|
5590
|
-
_setActionCodeSettingsOnRequest(authInternal, requestWithRecaptcha, actionCodeSettings);
|
|
5591
|
-
}
|
|
5592
|
-
await sendPasswordResetEmail$1(authInternal, requestWithRecaptcha);
|
|
5593
|
-
}
|
|
5594
|
-
else {
|
|
5595
|
-
return Promise.reject(error);
|
|
5596
|
-
}
|
|
5597
|
-
});
|
|
5617
|
+
if (actionCodeSettings) {
|
|
5618
|
+
_setActionCodeSettingsOnRequest(authInternal, request, actionCodeSettings);
|
|
5598
5619
|
}
|
|
5620
|
+
await handleRecaptchaFlow(authInternal, request, "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */, sendPasswordResetEmail$1);
|
|
5599
5621
|
}
|
|
5600
5622
|
/**
|
|
5601
5623
|
* Completes the password reset process, given a confirmation code and new password.
|
|
@@ -5715,7 +5737,6 @@ async function verifyPasswordResetCode(auth, code) {
|
|
|
5715
5737
|
* @public
|
|
5716
5738
|
*/
|
|
5717
5739
|
async function createUserWithEmailAndPassword(auth, email, password) {
|
|
5718
|
-
var _a;
|
|
5719
5740
|
const authInternal = _castAuth(auth);
|
|
5720
5741
|
const request = {
|
|
5721
5742
|
returnSecureToken: true,
|
|
@@ -5723,21 +5744,7 @@ async function createUserWithEmailAndPassword(auth, email, password) {
|
|
|
5723
5744
|
password,
|
|
5724
5745
|
clientType: "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */
|
|
5725
5746
|
};
|
|
5726
|
-
|
|
5727
|
-
if ((_a = authInternal._getRecaptchaConfig()) === null || _a === void 0 ? void 0 : _a.emailPasswordEnabled) {
|
|
5728
|
-
const requestWithRecaptcha = await injectRecaptchaFields(authInternal, request, "signUpPassword" /* RecaptchaActionName.SIGN_UP_PASSWORD */);
|
|
5729
|
-
signUpResponse = signUp(authInternal, requestWithRecaptcha);
|
|
5730
|
-
}
|
|
5731
|
-
else {
|
|
5732
|
-
signUpResponse = signUp(authInternal, request).catch(async (error) => {
|
|
5733
|
-
if (error.code === `auth/${"missing-recaptcha-token" /* AuthErrorCode.MISSING_RECAPTCHA_TOKEN */}`) {
|
|
5734
|
-
console.log('Sign-up is protected by reCAPTCHA for this project. Automatically triggering the reCAPTCHA flow and restarting the sign-up flow.');
|
|
5735
|
-
const requestWithRecaptcha = await injectRecaptchaFields(authInternal, request, "signUpPassword" /* RecaptchaActionName.SIGN_UP_PASSWORD */);
|
|
5736
|
-
return signUp(authInternal, requestWithRecaptcha);
|
|
5737
|
-
}
|
|
5738
|
-
throw error;
|
|
5739
|
-
});
|
|
5740
|
-
}
|
|
5747
|
+
const signUpResponse = handleRecaptchaFlow(authInternal, request, "signUpPassword" /* RecaptchaActionName.SIGN_UP_PASSWORD */, signUp);
|
|
5741
5748
|
const response = await signUpResponse.catch(error => {
|
|
5742
5749
|
if (error.code === `auth/${"password-does-not-meet-requirements" /* AuthErrorCode.PASSWORD_DOES_NOT_MEET_REQUIREMENTS */}`) {
|
|
5743
5750
|
void recachePasswordPolicy(auth);
|
|
@@ -5828,7 +5835,6 @@ function signInWithEmailAndPassword(auth, email, password) {
|
|
|
5828
5835
|
* @public
|
|
5829
5836
|
*/
|
|
5830
5837
|
async function sendSignInLinkToEmail(auth, email, actionCodeSettings) {
|
|
5831
|
-
var _a;
|
|
5832
5838
|
const authInternal = _castAuth(auth);
|
|
5833
5839
|
const request = {
|
|
5834
5840
|
requestType: "EMAIL_SIGNIN" /* ActionCodeOperation.EMAIL_SIGNIN */,
|
|
@@ -5841,26 +5847,8 @@ async function sendSignInLinkToEmail(auth, email, actionCodeSettings) {
|
|
|
5841
5847
|
_setActionCodeSettingsOnRequest(authInternal, request, actionCodeSettings);
|
|
5842
5848
|
}
|
|
5843
5849
|
}
|
|
5844
|
-
|
|
5845
|
-
|
|
5846
|
-
setActionCodeSettings(requestWithRecaptcha, actionCodeSettings);
|
|
5847
|
-
await sendSignInLinkToEmail$1(authInternal, requestWithRecaptcha);
|
|
5848
|
-
}
|
|
5849
|
-
else {
|
|
5850
|
-
setActionCodeSettings(request, actionCodeSettings);
|
|
5851
|
-
await sendSignInLinkToEmail$1(authInternal, request)
|
|
5852
|
-
.catch(async (error) => {
|
|
5853
|
-
if (error.code === `auth/${"missing-recaptcha-token" /* AuthErrorCode.MISSING_RECAPTCHA_TOKEN */}`) {
|
|
5854
|
-
console.log('Email link sign-in is protected by reCAPTCHA for this project. Automatically triggering the reCAPTCHA flow and restarting the sign-in flow.');
|
|
5855
|
-
const requestWithRecaptcha = await injectRecaptchaFields(authInternal, request, "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */, true);
|
|
5856
|
-
setActionCodeSettings(requestWithRecaptcha, actionCodeSettings);
|
|
5857
|
-
await sendSignInLinkToEmail$1(authInternal, requestWithRecaptcha);
|
|
5858
|
-
}
|
|
5859
|
-
else {
|
|
5860
|
-
return Promise.reject(error);
|
|
5861
|
-
}
|
|
5862
|
-
});
|
|
5863
|
-
}
|
|
5850
|
+
setActionCodeSettings(request, actionCodeSettings);
|
|
5851
|
+
await handleRecaptchaFlow(authInternal, request, "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */, sendSignInLinkToEmail$1);
|
|
5864
5852
|
}
|
|
5865
5853
|
/**
|
|
5866
5854
|
* Checks if an incoming link is a sign-in with email link suitable for {@link signInWithEmailLink}.
|
|
@@ -10220,7 +10208,7 @@ function _isEmptyString(input) {
|
|
|
10220
10208
|
}
|
|
10221
10209
|
|
|
10222
10210
|
var name = "@firebase/auth";
|
|
10223
|
-
var version = "1.3.0-canary.
|
|
10211
|
+
var version = "1.3.0-canary.bd073b26a";
|
|
10224
10212
|
|
|
10225
10213
|
/**
|
|
10226
10214
|
* @license
|
|
@@ -10546,4 +10534,4 @@ exports.useDeviceLanguage = useDeviceLanguage;
|
|
|
10546
10534
|
exports.validatePassword = validatePassword;
|
|
10547
10535
|
exports.verifyBeforeUpdateEmail = verifyBeforeUpdateEmail;
|
|
10548
10536
|
exports.verifyPasswordResetCode = verifyPasswordResetCode;
|
|
10549
|
-
//# sourceMappingURL=index-
|
|
10537
|
+
//# sourceMappingURL=index-579a938f.js.map
|