@firebase/auth 1.3.0-canary.60e4a07d2 → 1.3.0-canary.698eeb67d
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-9e6c4f37.js → index-6c320c88.js} +115 -127
- package/dist/browser-cjs/index-6c320c88.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-4758cdae.js → popup_redirect-96bd7835.js} +165 -214
- package/dist/cordova/popup_redirect-96bd7835.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-c088af8a.js → index-57aefb02.js} +115 -127
- package/dist/esm2017/index-57aefb02.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-f6b0662a.js → index-6728b711.js} +165 -214
- package/dist/esm5/index-6728b711.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-2cc6b74c.js → totp-8ef4e9a8.js} +161 -210
- package/dist/node/totp-8ef4e9a8.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-bfa3ee61.js → totp-19c74b23.js} +111 -123
- package/dist/node-esm/totp-19c74b23.js.map +1 -0
- package/dist/rn/{index-6ea1dd0a.js → index-95a9f1bd.js} +165 -214
- package/dist/rn/index-95a9f1bd.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 +12 -12
- package/dist/browser-cjs/index-9e6c4f37.js.map +0 -1
- package/dist/cordova/popup_redirect-4758cdae.js.map +0 -1
- package/dist/esm2017/index-c088af8a.js.map +0 -1
- package/dist/esm5/index-f6b0662a.js.map +0 -1
- package/dist/node/totp-2cc6b74c.js.map +0 -1
- package/dist/node-esm/totp-bfa3ee61.js.map +0 -1
- package/dist/rn/index-6ea1dd0a.js.map +0 -1
package/dist/node/index.js
CHANGED
package/dist/node/internal.js
CHANGED
|
@@ -22,13 +22,13 @@ interface GetRecaptchaConfigRequest {
|
|
|
22
22
|
clientType?: RecaptchaClientType;
|
|
23
23
|
version?: RecaptchaVersion;
|
|
24
24
|
}
|
|
25
|
-
interface
|
|
25
|
+
export interface RecaptchaEnforcementProviderState {
|
|
26
26
|
provider: string;
|
|
27
27
|
enforcementState: string;
|
|
28
28
|
}
|
|
29
29
|
export interface GetRecaptchaConfigResponse {
|
|
30
30
|
recaptchaKey: string;
|
|
31
|
-
recaptchaEnforcementState:
|
|
31
|
+
recaptchaEnforcementState: RecaptchaEnforcementProviderState[];
|
|
32
32
|
}
|
|
33
33
|
export declare function getRecaptchaConfig(auth: Auth, request: GetRecaptchaConfigRequest): Promise<GetRecaptchaConfigResponse>;
|
|
34
34
|
export {};
|
|
@@ -69,6 +69,15 @@ export declare const enum RecaptchaActionName {
|
|
|
69
69
|
GET_OOB_CODE = "getOobCode",
|
|
70
70
|
SIGN_UP_PASSWORD = "signUpPassword"
|
|
71
71
|
}
|
|
72
|
+
export declare const enum EnforcementState {
|
|
73
|
+
ENFORCE = "ENFORCE",
|
|
74
|
+
AUDIT = "AUDIT",
|
|
75
|
+
OFF = "OFF",
|
|
76
|
+
ENFORCEMENT_STATE_UNSPECIFIED = "ENFORCEMENT_STATE_UNSPECIFIED"
|
|
77
|
+
}
|
|
78
|
+
export declare const enum RecaptchaProvider {
|
|
79
|
+
EMAIL_PASSWORD_PROVIDER = "EMAIL_PASSWORD_PROVIDER"
|
|
80
|
+
}
|
|
72
81
|
export declare const DEFAULT_API_TIMEOUT_MS: Delay;
|
|
73
82
|
export declare function _addTidIfNecessary<T extends {
|
|
74
83
|
tenantId?: string;
|
|
@@ -77,6 +86,7 @@ export declare function _performApiRequest<T, V>(auth: Auth, method: HttpMethod,
|
|
|
77
86
|
export declare function _performFetchWithErrorHandling<V>(auth: Auth, customErrorMap: Partial<ServerErrorMap<ServerError>>, fetchFn: () => Promise<Response>): Promise<V>;
|
|
78
87
|
export declare function _performSignInRequest<T, V extends IdTokenResponse>(auth: Auth, method: HttpMethod, path: Endpoint, request?: T, customErrorMap?: Partial<ServerErrorMap<ServerError>>): Promise<V>;
|
|
79
88
|
export declare function _getFinalTarget(auth: Auth, host: string, path: string, query: string): string;
|
|
89
|
+
export declare function _parseEnforcementState(enforcementStateStr: string): EnforcementState;
|
|
80
90
|
interface PotentialResponse extends IdTokenResponse {
|
|
81
91
|
email?: string;
|
|
82
92
|
phoneNumber?: string;
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
import { RecaptchaParameters } from '../../model/public_types';
|
|
18
|
-
import { GetRecaptchaConfigResponse } from '../../api/authentication/recaptcha';
|
|
18
|
+
import { GetRecaptchaConfigResponse, RecaptchaEnforcementProviderState } from '../../api/authentication/recaptcha';
|
|
19
|
+
import { EnforcementState } from '../../api/index';
|
|
19
20
|
export interface Recaptcha {
|
|
20
21
|
render: (container: HTMLElement, parameters: RecaptchaParameters) => number;
|
|
21
22
|
getResponse: (id: number) => string;
|
|
@@ -49,8 +50,22 @@ export declare class RecaptchaConfig {
|
|
|
49
50
|
*/
|
|
50
51
|
siteKey: string;
|
|
51
52
|
/**
|
|
52
|
-
* The
|
|
53
|
+
* The list of providers and their enablement status for reCAPTCHA Enterprise.
|
|
53
54
|
*/
|
|
54
|
-
|
|
55
|
+
recaptchaEnforcementState: RecaptchaEnforcementProviderState[];
|
|
55
56
|
constructor(response: GetRecaptchaConfigResponse);
|
|
57
|
+
/**
|
|
58
|
+
* Returns the reCAPTCHA Enterprise enforcement state for the given provider.
|
|
59
|
+
*
|
|
60
|
+
* @param providerStr - The provider whose enforcement state is to be returned.
|
|
61
|
+
* @returns The reCAPTCHA Enterprise enforcement state for the given provider.
|
|
62
|
+
*/
|
|
63
|
+
getProviderEnforcementState(providerStr: string): EnforcementState | null;
|
|
64
|
+
/**
|
|
65
|
+
* Returns true if the reCAPTCHA Enterprise enforcement state for the provider is set to ENFORCE or AUDIT.
|
|
66
|
+
*
|
|
67
|
+
* @param providerStr - The provider whose enablement state is to be returned.
|
|
68
|
+
* @returns Whether or not reCAPTCHA Enterprise protection is enabled for the given provider.
|
|
69
|
+
*/
|
|
70
|
+
isProviderEnabled(providerStr: string): boolean;
|
|
56
71
|
}
|
|
@@ -39,4 +39,7 @@ export declare class RecaptchaEnterpriseVerifier {
|
|
|
39
39
|
verify(action?: string, forceRefresh?: boolean): Promise<string>;
|
|
40
40
|
}
|
|
41
41
|
export declare function injectRecaptchaFields<T>(auth: AuthInternal, request: T, action: RecaptchaActionName, captchaResp?: boolean): Promise<T>;
|
|
42
|
+
declare type ActionMethod<TRequest, TResponse> = (auth: Auth, request: TRequest) => Promise<TResponse>;
|
|
43
|
+
export declare function handleRecaptchaFlow<TRequest, TResponse>(authInstance: AuthInternal, request: TRequest, actionName: RecaptchaActionName, actionMethod: ActionMethod<TRequest, TResponse>): Promise<TResponse>;
|
|
42
44
|
export declare function _initializeRecaptchaConfig(auth: Auth): Promise<void>;
|
|
45
|
+
export {};
|
|
@@ -126,49 +126,6 @@ var ActionCodeOperation = {
|
|
|
126
126
|
VERIFY_EMAIL: 'VERIFY_EMAIL'
|
|
127
127
|
};
|
|
128
128
|
|
|
129
|
-
/**
|
|
130
|
-
* @license
|
|
131
|
-
* Copyright 2020 Google LLC
|
|
132
|
-
*
|
|
133
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
134
|
-
* you may not use this file except in compliance with the License.
|
|
135
|
-
* You may obtain a copy of the License at
|
|
136
|
-
*
|
|
137
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
138
|
-
*
|
|
139
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
140
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
141
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
142
|
-
* See the License for the specific language governing permissions and
|
|
143
|
-
* limitations under the License.
|
|
144
|
-
*/
|
|
145
|
-
function isEnterprise(grecaptcha) {
|
|
146
|
-
return (grecaptcha !== undefined &&
|
|
147
|
-
grecaptcha.enterprise !== undefined);
|
|
148
|
-
}
|
|
149
|
-
var RecaptchaConfig = /** @class */ (function () {
|
|
150
|
-
function RecaptchaConfig(response) {
|
|
151
|
-
/**
|
|
152
|
-
* The reCAPTCHA site key.
|
|
153
|
-
*/
|
|
154
|
-
this.siteKey = '';
|
|
155
|
-
/**
|
|
156
|
-
* The reCAPTCHA enablement status of the {@link EmailAuthProvider} for the current tenant.
|
|
157
|
-
*/
|
|
158
|
-
this.emailPasswordEnabled = false;
|
|
159
|
-
if (response.recaptchaKey === undefined) {
|
|
160
|
-
throw new Error('recaptchaKey undefined');
|
|
161
|
-
}
|
|
162
|
-
// Example response.recaptchaKey: "projects/proj123/keys/sitekey123"
|
|
163
|
-
this.siteKey = response.recaptchaKey.split('/')[3];
|
|
164
|
-
this.emailPasswordEnabled = response.recaptchaEnforcementState.some(function (enforcementState) {
|
|
165
|
-
return enforcementState.provider === 'EMAIL_PASSWORD_PROVIDER' &&
|
|
166
|
-
enforcementState.enforcementState !== 'OFF';
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
return RecaptchaConfig;
|
|
170
|
-
}());
|
|
171
|
-
|
|
172
129
|
/**
|
|
173
130
|
* @license
|
|
174
131
|
* Copyright 2020 Google LLC
|
|
@@ -1069,6 +1026,18 @@ function _getFinalTarget(auth, host, path, query) {
|
|
|
1069
1026
|
}
|
|
1070
1027
|
return _emulatorUrl(auth.config, base);
|
|
1071
1028
|
}
|
|
1029
|
+
function _parseEnforcementState(enforcementStateStr) {
|
|
1030
|
+
switch (enforcementStateStr) {
|
|
1031
|
+
case 'ENFORCE':
|
|
1032
|
+
return "ENFORCE" /* EnforcementState.ENFORCE */;
|
|
1033
|
+
case 'AUDIT':
|
|
1034
|
+
return "AUDIT" /* EnforcementState.AUDIT */;
|
|
1035
|
+
case 'OFF':
|
|
1036
|
+
return "OFF" /* EnforcementState.OFF */;
|
|
1037
|
+
default:
|
|
1038
|
+
return "ENFORCEMENT_STATE_UNSPECIFIED" /* EnforcementState.ENFORCEMENT_STATE_UNSPECIFIED */;
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1072
1041
|
var NetworkTimeout = /** @class */ (function () {
|
|
1073
1042
|
function NetworkTimeout(auth) {
|
|
1074
1043
|
var _this = this;
|
|
@@ -1104,6 +1073,77 @@ function _makeTaggedError(auth, code, response) {
|
|
|
1104
1073
|
return error;
|
|
1105
1074
|
}
|
|
1106
1075
|
|
|
1076
|
+
/**
|
|
1077
|
+
* @license
|
|
1078
|
+
* Copyright 2020 Google LLC
|
|
1079
|
+
*
|
|
1080
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1081
|
+
* you may not use this file except in compliance with the License.
|
|
1082
|
+
* You may obtain a copy of the License at
|
|
1083
|
+
*
|
|
1084
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1085
|
+
*
|
|
1086
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1087
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1088
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1089
|
+
* See the License for the specific language governing permissions and
|
|
1090
|
+
* limitations under the License.
|
|
1091
|
+
*/
|
|
1092
|
+
function isEnterprise(grecaptcha) {
|
|
1093
|
+
return (grecaptcha !== undefined &&
|
|
1094
|
+
grecaptcha.enterprise !== undefined);
|
|
1095
|
+
}
|
|
1096
|
+
var RecaptchaConfig = /** @class */ (function () {
|
|
1097
|
+
function RecaptchaConfig(response) {
|
|
1098
|
+
/**
|
|
1099
|
+
* The reCAPTCHA site key.
|
|
1100
|
+
*/
|
|
1101
|
+
this.siteKey = '';
|
|
1102
|
+
/**
|
|
1103
|
+
* The list of providers and their enablement status for reCAPTCHA Enterprise.
|
|
1104
|
+
*/
|
|
1105
|
+
this.recaptchaEnforcementState = [];
|
|
1106
|
+
if (response.recaptchaKey === undefined) {
|
|
1107
|
+
throw new Error('recaptchaKey undefined');
|
|
1108
|
+
}
|
|
1109
|
+
// Example response.recaptchaKey: "projects/proj123/keys/sitekey123"
|
|
1110
|
+
this.siteKey = response.recaptchaKey.split('/')[3];
|
|
1111
|
+
this.recaptchaEnforcementState = response.recaptchaEnforcementState;
|
|
1112
|
+
}
|
|
1113
|
+
/**
|
|
1114
|
+
* Returns the reCAPTCHA Enterprise enforcement state for the given provider.
|
|
1115
|
+
*
|
|
1116
|
+
* @param providerStr - The provider whose enforcement state is to be returned.
|
|
1117
|
+
* @returns The reCAPTCHA Enterprise enforcement state for the given provider.
|
|
1118
|
+
*/
|
|
1119
|
+
RecaptchaConfig.prototype.getProviderEnforcementState = function (providerStr) {
|
|
1120
|
+
if (!this.recaptchaEnforcementState ||
|
|
1121
|
+
this.recaptchaEnforcementState.length === 0) {
|
|
1122
|
+
return null;
|
|
1123
|
+
}
|
|
1124
|
+
for (var _i = 0, _a = this.recaptchaEnforcementState; _i < _a.length; _i++) {
|
|
1125
|
+
var recaptchaEnforcementState = _a[_i];
|
|
1126
|
+
if (recaptchaEnforcementState.provider &&
|
|
1127
|
+
recaptchaEnforcementState.provider === providerStr) {
|
|
1128
|
+
return _parseEnforcementState(recaptchaEnforcementState.enforcementState);
|
|
1129
|
+
}
|
|
1130
|
+
}
|
|
1131
|
+
return null;
|
|
1132
|
+
};
|
|
1133
|
+
/**
|
|
1134
|
+
* Returns true if the reCAPTCHA Enterprise enforcement state for the provider is set to ENFORCE or AUDIT.
|
|
1135
|
+
*
|
|
1136
|
+
* @param providerStr - The provider whose enablement state is to be returned.
|
|
1137
|
+
* @returns Whether or not reCAPTCHA Enterprise protection is enabled for the given provider.
|
|
1138
|
+
*/
|
|
1139
|
+
RecaptchaConfig.prototype.isProviderEnabled = function (providerStr) {
|
|
1140
|
+
return (this.getProviderEnforcementState(providerStr) ===
|
|
1141
|
+
"ENFORCE" /* EnforcementState.ENFORCE */ ||
|
|
1142
|
+
this.getProviderEnforcementState(providerStr) === "AUDIT" /* EnforcementState.AUDIT */);
|
|
1143
|
+
};
|
|
1144
|
+
return RecaptchaConfig;
|
|
1145
|
+
}());
|
|
1146
|
+
|
|
1107
1147
|
/**
|
|
1108
1148
|
* @license
|
|
1109
1149
|
* Copyright 2020 Google LLC
|
|
@@ -3768,6 +3808,39 @@ function injectRecaptchaFields(auth, request, action, captchaResp) {
|
|
|
3768
3808
|
});
|
|
3769
3809
|
});
|
|
3770
3810
|
}
|
|
3811
|
+
function handleRecaptchaFlow(authInstance, request, actionName, actionMethod) {
|
|
3812
|
+
var _a;
|
|
3813
|
+
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
3814
|
+
var requestWithRecaptcha;
|
|
3815
|
+
var _this = this;
|
|
3816
|
+
return tslib.__generator(this, function (_b) {
|
|
3817
|
+
switch (_b.label) {
|
|
3818
|
+
case 0:
|
|
3819
|
+
if (!((_a = authInstance
|
|
3820
|
+
._getRecaptchaConfig()) === null || _a === void 0 ? void 0 : _a.isProviderEnabled("EMAIL_PASSWORD_PROVIDER" /* RecaptchaProvider.EMAIL_PASSWORD_PROVIDER */))) return [3 /*break*/, 2];
|
|
3821
|
+
return [4 /*yield*/, injectRecaptchaFields(authInstance, request, actionName, actionName === "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */)];
|
|
3822
|
+
case 1:
|
|
3823
|
+
requestWithRecaptcha = _b.sent();
|
|
3824
|
+
return [2 /*return*/, actionMethod(authInstance, requestWithRecaptcha)];
|
|
3825
|
+
case 2: return [2 /*return*/, actionMethod(authInstance, request).catch(function (error) { return tslib.__awaiter(_this, void 0, void 0, function () {
|
|
3826
|
+
var requestWithRecaptcha;
|
|
3827
|
+
return tslib.__generator(this, function (_a) {
|
|
3828
|
+
switch (_a.label) {
|
|
3829
|
+
case 0:
|
|
3830
|
+
if (!(error.code === "auth/".concat("missing-recaptcha-token" /* AuthErrorCode.MISSING_RECAPTCHA_TOKEN */))) return [3 /*break*/, 2];
|
|
3831
|
+
console.log("".concat(actionName, " is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow."));
|
|
3832
|
+
return [4 /*yield*/, injectRecaptchaFields(authInstance, request, actionName, actionName === "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */)];
|
|
3833
|
+
case 1:
|
|
3834
|
+
requestWithRecaptcha = _a.sent();
|
|
3835
|
+
return [2 /*return*/, actionMethod(authInstance, requestWithRecaptcha)];
|
|
3836
|
+
case 2: return [2 /*return*/, Promise.reject(error)];
|
|
3837
|
+
}
|
|
3838
|
+
});
|
|
3839
|
+
}); })];
|
|
3840
|
+
}
|
|
3841
|
+
});
|
|
3842
|
+
});
|
|
3843
|
+
}
|
|
3771
3844
|
function _initializeRecaptchaConfig(auth) {
|
|
3772
3845
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
3773
3846
|
var authInternal, response, config, verifier;
|
|
@@ -3788,7 +3861,7 @@ function _initializeRecaptchaConfig(auth) {
|
|
|
3788
3861
|
else {
|
|
3789
3862
|
authInternal._tenantRecaptchaConfigs[authInternal.tenantId] = config;
|
|
3790
3863
|
}
|
|
3791
|
-
if (config.
|
|
3864
|
+
if (config.isProviderEnabled("EMAIL_PASSWORD_PROVIDER" /* RecaptchaProvider.EMAIL_PASSWORD_PROVIDER */)) {
|
|
3792
3865
|
verifier = new RecaptchaEnterpriseVerifier(authInternal);
|
|
3793
3866
|
void verifier.verify();
|
|
3794
3867
|
}
|
|
@@ -4254,55 +4327,27 @@ var EmailAuthCredential = /** @class */ (function (_super) {
|
|
|
4254
4327
|
};
|
|
4255
4328
|
/** @internal */
|
|
4256
4329
|
EmailAuthCredential.prototype._getIdTokenResponse = function (auth) {
|
|
4257
|
-
var _a;
|
|
4258
4330
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
4259
|
-
var
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
_b = this.signInMethod;
|
|
4265
|
-
switch (_b) {
|
|
4266
|
-
case "password" /* SignInMethod.EMAIL_PASSWORD */: return [3 /*break*/, 1];
|
|
4267
|
-
case "emailLink" /* SignInMethod.EMAIL_LINK */: return [3 /*break*/, 4];
|
|
4268
|
-
}
|
|
4269
|
-
return [3 /*break*/, 5];
|
|
4270
|
-
case 1:
|
|
4271
|
-
request_1 = {
|
|
4331
|
+
var request;
|
|
4332
|
+
return tslib.__generator(this, function (_a) {
|
|
4333
|
+
switch (this.signInMethod) {
|
|
4334
|
+
case "password" /* SignInMethod.EMAIL_PASSWORD */:
|
|
4335
|
+
request = {
|
|
4272
4336
|
returnSecureToken: true,
|
|
4273
4337
|
email: this._email,
|
|
4274
4338
|
password: this._password,
|
|
4275
4339
|
clientType: "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */
|
|
4276
4340
|
};
|
|
4277
|
-
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
return tslib.__generator(this, function (_a) {
|
|
4285
|
-
switch (_a.label) {
|
|
4286
|
-
case 0:
|
|
4287
|
-
if (!(error.code === "auth/".concat("missing-recaptcha-token" /* AuthErrorCode.MISSING_RECAPTCHA_TOKEN */))) return [3 /*break*/, 2];
|
|
4288
|
-
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.');
|
|
4289
|
-
return [4 /*yield*/, injectRecaptchaFields(auth, request_1, "signInWithPassword" /* RecaptchaActionName.SIGN_IN_WITH_PASSWORD */)];
|
|
4290
|
-
case 1:
|
|
4291
|
-
requestWithRecaptcha = _a.sent();
|
|
4292
|
-
return [2 /*return*/, signInWithPassword(auth, requestWithRecaptcha)];
|
|
4293
|
-
case 2: return [2 /*return*/, Promise.reject(error)];
|
|
4294
|
-
}
|
|
4295
|
-
});
|
|
4296
|
-
}); })];
|
|
4297
|
-
case 4: return [2 /*return*/, signInWithEmailLink$1(auth, {
|
|
4298
|
-
email: this._email,
|
|
4299
|
-
oobCode: this._password
|
|
4300
|
-
})];
|
|
4301
|
-
case 5:
|
|
4341
|
+
return [2 /*return*/, handleRecaptchaFlow(auth, request, "signInWithPassword" /* RecaptchaActionName.SIGN_IN_WITH_PASSWORD */, signInWithPassword)];
|
|
4342
|
+
case "emailLink" /* SignInMethod.EMAIL_LINK */:
|
|
4343
|
+
return [2 /*return*/, signInWithEmailLink$1(auth, {
|
|
4344
|
+
email: this._email,
|
|
4345
|
+
oobCode: this._password
|
|
4346
|
+
})];
|
|
4347
|
+
default:
|
|
4302
4348
|
_fail(auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
4303
|
-
_c.label = 6;
|
|
4304
|
-
case 6: return [2 /*return*/];
|
|
4305
4349
|
}
|
|
4350
|
+
return [2 /*return*/];
|
|
4306
4351
|
});
|
|
4307
4352
|
});
|
|
4308
4353
|
};
|
|
@@ -6512,12 +6557,10 @@ function recachePasswordPolicy(auth) {
|
|
|
6512
6557
|
* @public
|
|
6513
6558
|
*/
|
|
6514
6559
|
function sendPasswordResetEmail(auth, email, actionCodeSettings) {
|
|
6515
|
-
var _a;
|
|
6516
6560
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
6517
|
-
var authInternal, request
|
|
6518
|
-
|
|
6519
|
-
|
|
6520
|
-
switch (_b.label) {
|
|
6561
|
+
var authInternal, request;
|
|
6562
|
+
return tslib.__generator(this, function (_a) {
|
|
6563
|
+
switch (_a.label) {
|
|
6521
6564
|
case 0:
|
|
6522
6565
|
authInternal = _castAuth(auth);
|
|
6523
6566
|
request = {
|
|
@@ -6525,48 +6568,13 @@ function sendPasswordResetEmail(auth, email, actionCodeSettings) {
|
|
|
6525
6568
|
email: email,
|
|
6526
6569
|
clientType: "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */
|
|
6527
6570
|
};
|
|
6528
|
-
if (!((_a = authInternal._getRecaptchaConfig()) === null || _a === void 0 ? void 0 : _a.emailPasswordEnabled)) return [3 /*break*/, 3];
|
|
6529
|
-
return [4 /*yield*/, injectRecaptchaFields(authInternal, request, "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */, true)];
|
|
6530
|
-
case 1:
|
|
6531
|
-
requestWithRecaptcha = _b.sent();
|
|
6532
|
-
if (actionCodeSettings) {
|
|
6533
|
-
_setActionCodeSettingsOnRequest(authInternal, requestWithRecaptcha, actionCodeSettings);
|
|
6534
|
-
}
|
|
6535
|
-
return [4 /*yield*/, sendPasswordResetEmail$1(authInternal, requestWithRecaptcha)];
|
|
6536
|
-
case 2:
|
|
6537
|
-
_b.sent();
|
|
6538
|
-
return [3 /*break*/, 5];
|
|
6539
|
-
case 3:
|
|
6540
6571
|
if (actionCodeSettings) {
|
|
6541
6572
|
_setActionCodeSettingsOnRequest(authInternal, request, actionCodeSettings);
|
|
6542
6573
|
}
|
|
6543
|
-
return [4 /*yield*/,
|
|
6544
|
-
|
|
6545
|
-
|
|
6546
|
-
|
|
6547
|
-
switch (_a.label) {
|
|
6548
|
-
case 0:
|
|
6549
|
-
if (!(error.code === "auth/".concat("missing-recaptcha-token" /* AuthErrorCode.MISSING_RECAPTCHA_TOKEN */))) return [3 /*break*/, 3];
|
|
6550
|
-
console.log('Password resets are protected by reCAPTCHA for this project. Automatically triggering the reCAPTCHA flow and restarting the password reset flow.');
|
|
6551
|
-
return [4 /*yield*/, injectRecaptchaFields(authInternal, request, "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */, true)];
|
|
6552
|
-
case 1:
|
|
6553
|
-
requestWithRecaptcha = _a.sent();
|
|
6554
|
-
if (actionCodeSettings) {
|
|
6555
|
-
_setActionCodeSettingsOnRequest(authInternal, requestWithRecaptcha, actionCodeSettings);
|
|
6556
|
-
}
|
|
6557
|
-
return [4 /*yield*/, sendPasswordResetEmail$1(authInternal, requestWithRecaptcha)];
|
|
6558
|
-
case 2:
|
|
6559
|
-
_a.sent();
|
|
6560
|
-
return [3 /*break*/, 4];
|
|
6561
|
-
case 3: return [2 /*return*/, Promise.reject(error)];
|
|
6562
|
-
case 4: return [2 /*return*/];
|
|
6563
|
-
}
|
|
6564
|
-
});
|
|
6565
|
-
}); })];
|
|
6566
|
-
case 4:
|
|
6567
|
-
_b.sent();
|
|
6568
|
-
_b.label = 5;
|
|
6569
|
-
case 5: return [2 /*return*/];
|
|
6574
|
+
return [4 /*yield*/, handleRecaptchaFlow(authInternal, request, "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */, sendPasswordResetEmail$1)];
|
|
6575
|
+
case 1:
|
|
6576
|
+
_a.sent();
|
|
6577
|
+
return [2 /*return*/];
|
|
6570
6578
|
}
|
|
6571
6579
|
});
|
|
6572
6580
|
});
|
|
@@ -6721,12 +6729,10 @@ function verifyPasswordResetCode(auth, code) {
|
|
|
6721
6729
|
* @public
|
|
6722
6730
|
*/
|
|
6723
6731
|
function createUserWithEmailAndPassword(auth, email, password) {
|
|
6724
|
-
var _a;
|
|
6725
6732
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
6726
|
-
var authInternal, request, signUpResponse,
|
|
6727
|
-
|
|
6728
|
-
|
|
6729
|
-
switch (_b.label) {
|
|
6733
|
+
var authInternal, request, signUpResponse, response, userCredential;
|
|
6734
|
+
return tslib.__generator(this, function (_a) {
|
|
6735
|
+
switch (_a.label) {
|
|
6730
6736
|
case 0:
|
|
6731
6737
|
authInternal = _castAuth(auth);
|
|
6732
6738
|
request = {
|
|
@@ -6735,43 +6741,21 @@ function createUserWithEmailAndPassword(auth, email, password) {
|
|
|
6735
6741
|
password: password,
|
|
6736
6742
|
clientType: "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */
|
|
6737
6743
|
};
|
|
6738
|
-
|
|
6739
|
-
return [4 /*yield*/,
|
|
6740
|
-
|
|
6741
|
-
|
|
6742
|
-
signUpResponse = signUp(authInternal, requestWithRecaptcha);
|
|
6743
|
-
return [3 /*break*/, 3];
|
|
6744
|
-
case 2:
|
|
6745
|
-
signUpResponse = signUp(authInternal, request).catch(function (error) { return tslib.__awaiter(_this, void 0, void 0, function () {
|
|
6746
|
-
var requestWithRecaptcha;
|
|
6747
|
-
return tslib.__generator(this, function (_a) {
|
|
6748
|
-
switch (_a.label) {
|
|
6749
|
-
case 0:
|
|
6750
|
-
if (!(error.code === "auth/".concat("missing-recaptcha-token" /* AuthErrorCode.MISSING_RECAPTCHA_TOKEN */))) return [3 /*break*/, 2];
|
|
6751
|
-
console.log('Sign-up is protected by reCAPTCHA for this project. Automatically triggering the reCAPTCHA flow and restarting the sign-up flow.');
|
|
6752
|
-
return [4 /*yield*/, injectRecaptchaFields(authInternal, request, "signUpPassword" /* RecaptchaActionName.SIGN_UP_PASSWORD */)];
|
|
6753
|
-
case 1:
|
|
6754
|
-
requestWithRecaptcha = _a.sent();
|
|
6755
|
-
return [2 /*return*/, signUp(authInternal, requestWithRecaptcha)];
|
|
6756
|
-
case 2: throw error;
|
|
6744
|
+
signUpResponse = handleRecaptchaFlow(authInternal, request, "signUpPassword" /* RecaptchaActionName.SIGN_UP_PASSWORD */, signUp);
|
|
6745
|
+
return [4 /*yield*/, signUpResponse.catch(function (error) {
|
|
6746
|
+
if (error.code === "auth/".concat("password-does-not-meet-requirements" /* AuthErrorCode.PASSWORD_DOES_NOT_MEET_REQUIREMENTS */)) {
|
|
6747
|
+
void recachePasswordPolicy(auth);
|
|
6757
6748
|
}
|
|
6758
|
-
|
|
6759
|
-
|
|
6760
|
-
|
|
6761
|
-
|
|
6762
|
-
if (error.code === "auth/".concat("password-does-not-meet-requirements" /* AuthErrorCode.PASSWORD_DOES_NOT_MEET_REQUIREMENTS */)) {
|
|
6763
|
-
void recachePasswordPolicy(auth);
|
|
6764
|
-
}
|
|
6765
|
-
throw error;
|
|
6766
|
-
})];
|
|
6767
|
-
case 4:
|
|
6768
|
-
response = _b.sent();
|
|
6749
|
+
throw error;
|
|
6750
|
+
})];
|
|
6751
|
+
case 1:
|
|
6752
|
+
response = _a.sent();
|
|
6769
6753
|
return [4 /*yield*/, UserCredentialImpl._fromIdTokenResponse(authInternal, "signIn" /* OperationType.SIGN_IN */, response)];
|
|
6770
|
-
case
|
|
6771
|
-
userCredential =
|
|
6754
|
+
case 2:
|
|
6755
|
+
userCredential = _a.sent();
|
|
6772
6756
|
return [4 /*yield*/, authInternal._updateCurrentUser(userCredential.user)];
|
|
6773
|
-
case
|
|
6774
|
-
|
|
6757
|
+
case 3:
|
|
6758
|
+
_a.sent();
|
|
6775
6759
|
return [2 /*return*/, userCredential];
|
|
6776
6760
|
}
|
|
6777
6761
|
});
|
|
@@ -6860,7 +6844,6 @@ function signInWithEmailAndPassword(auth, email, password) {
|
|
|
6860
6844
|
* @public
|
|
6861
6845
|
*/
|
|
6862
6846
|
function sendSignInLinkToEmail(auth, email, actionCodeSettings) {
|
|
6863
|
-
var _a;
|
|
6864
6847
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
6865
6848
|
function setActionCodeSettings(request, actionCodeSettings) {
|
|
6866
6849
|
_assert(actionCodeSettings.handleCodeInApp, authInternal, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
@@ -6868,10 +6851,9 @@ function sendSignInLinkToEmail(auth, email, actionCodeSettings) {
|
|
|
6868
6851
|
_setActionCodeSettingsOnRequest(authInternal, request, actionCodeSettings);
|
|
6869
6852
|
}
|
|
6870
6853
|
}
|
|
6871
|
-
var authInternal, request
|
|
6872
|
-
|
|
6873
|
-
|
|
6874
|
-
switch (_b.label) {
|
|
6854
|
+
var authInternal, request;
|
|
6855
|
+
return tslib.__generator(this, function (_a) {
|
|
6856
|
+
switch (_a.label) {
|
|
6875
6857
|
case 0:
|
|
6876
6858
|
authInternal = _castAuth(auth);
|
|
6877
6859
|
request = {
|
|
@@ -6879,42 +6861,11 @@ function sendSignInLinkToEmail(auth, email, actionCodeSettings) {
|
|
|
6879
6861
|
email: email,
|
|
6880
6862
|
clientType: "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */
|
|
6881
6863
|
};
|
|
6882
|
-
if (!((_a = authInternal._getRecaptchaConfig()) === null || _a === void 0 ? void 0 : _a.emailPasswordEnabled)) return [3 /*break*/, 3];
|
|
6883
|
-
return [4 /*yield*/, injectRecaptchaFields(authInternal, request, "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */, true)];
|
|
6884
|
-
case 1:
|
|
6885
|
-
requestWithRecaptcha = _b.sent();
|
|
6886
|
-
setActionCodeSettings(requestWithRecaptcha, actionCodeSettings);
|
|
6887
|
-
return [4 /*yield*/, sendSignInLinkToEmail$1(authInternal, requestWithRecaptcha)];
|
|
6888
|
-
case 2:
|
|
6889
|
-
_b.sent();
|
|
6890
|
-
return [3 /*break*/, 5];
|
|
6891
|
-
case 3:
|
|
6892
6864
|
setActionCodeSettings(request, actionCodeSettings);
|
|
6893
|
-
return [4 /*yield*/,
|
|
6894
|
-
|
|
6895
|
-
|
|
6896
|
-
|
|
6897
|
-
switch (_a.label) {
|
|
6898
|
-
case 0:
|
|
6899
|
-
if (!(error.code === "auth/".concat("missing-recaptcha-token" /* AuthErrorCode.MISSING_RECAPTCHA_TOKEN */))) return [3 /*break*/, 3];
|
|
6900
|
-
console.log('Email link sign-in is protected by reCAPTCHA for this project. Automatically triggering the reCAPTCHA flow and restarting the sign-in flow.');
|
|
6901
|
-
return [4 /*yield*/, injectRecaptchaFields(authInternal, request, "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */, true)];
|
|
6902
|
-
case 1:
|
|
6903
|
-
requestWithRecaptcha = _a.sent();
|
|
6904
|
-
setActionCodeSettings(requestWithRecaptcha, actionCodeSettings);
|
|
6905
|
-
return [4 /*yield*/, sendSignInLinkToEmail$1(authInternal, requestWithRecaptcha)];
|
|
6906
|
-
case 2:
|
|
6907
|
-
_a.sent();
|
|
6908
|
-
return [3 /*break*/, 4];
|
|
6909
|
-
case 3: return [2 /*return*/, Promise.reject(error)];
|
|
6910
|
-
case 4: return [2 /*return*/];
|
|
6911
|
-
}
|
|
6912
|
-
});
|
|
6913
|
-
}); })];
|
|
6914
|
-
case 4:
|
|
6915
|
-
_b.sent();
|
|
6916
|
-
_b.label = 5;
|
|
6917
|
-
case 5: return [2 /*return*/];
|
|
6865
|
+
return [4 /*yield*/, handleRecaptchaFlow(authInternal, request, "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */, sendSignInLinkToEmail$1)];
|
|
6866
|
+
case 1:
|
|
6867
|
+
_a.sent();
|
|
6868
|
+
return [2 /*return*/];
|
|
6918
6869
|
}
|
|
6919
6870
|
});
|
|
6920
6871
|
});
|
|
@@ -7988,7 +7939,7 @@ function multiFactor(user) {
|
|
|
7988
7939
|
}
|
|
7989
7940
|
|
|
7990
7941
|
var name = "@firebase/auth";
|
|
7991
|
-
var version = "1.3.0-canary.
|
|
7942
|
+
var version = "1.3.0-canary.698eeb67d";
|
|
7992
7943
|
|
|
7993
7944
|
/**
|
|
7994
7945
|
* @license
|
|
@@ -8559,4 +8510,4 @@ exports.useDeviceLanguage = useDeviceLanguage;
|
|
|
8559
8510
|
exports.validatePassword = validatePassword;
|
|
8560
8511
|
exports.verifyBeforeUpdateEmail = verifyBeforeUpdateEmail;
|
|
8561
8512
|
exports.verifyPasswordResetCode = verifyPasswordResetCode;
|
|
8562
|
-
//# sourceMappingURL=totp-
|
|
8513
|
+
//# sourceMappingURL=totp-8ef4e9a8.js.map
|