@firebase/auth 1.3.0-canary.b2f6084ef → 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-6dea9e71.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-26919902.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-8d700a94.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-2f338edd.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-4fce07b4.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-4eb6ee99.js → totp-1609c8f4.js} +111 -123
- package/dist/node-esm/totp-1609c8f4.js.map +1 -0
- package/dist/rn/{index-e781fb23.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 +12 -12
- package/dist/browser-cjs/index-6dea9e71.js.map +0 -1
- package/dist/cordova/popup_redirect-26919902.js.map +0 -1
- package/dist/esm2017/index-8d700a94.js.map +0 -1
- package/dist/esm5/index-2f338edd.js.map +0 -1
- package/dist/node/totp-4fce07b4.js.map +0 -1
- package/dist/node-esm/totp-4eb6ee99.js.map +0 -1
- package/dist/rn/index-e781fb23.js.map +0 -1
|
@@ -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 {};
|
package/dist/cordova/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getApp, _getProvider } from '@firebase/app';
|
|
2
|
-
import { _ as _signInWithRedirect, a as _reauthenticateWithRedirect, b as _linkWithRedirect, r as registerAuth, i as initializeAuth, c as indexedDBLocalPersistence, d as cordovaPopupRedirectResolver } from './popup_redirect-
|
|
3
|
-
export { A as ActionCodeOperation, a5 as ActionCodeURL, x as AuthCredential, t as AuthErrorCodes, E as EmailAuthCredential, C as EmailAuthProvider, D as FacebookAuthProvider, F as FactorId, H as GithubAuthProvider, G as GoogleAuthProvider, y as OAuthCredential, I as OAuthProvider, O as OperationType, z as PhoneAuthCredential, P as ProviderId, J as SAMLAuthProvider, S as SignInMethod, T as TwitterAuthProvider, V as applyActionCode, j as beforeAuthStateChanged, e as browserLocalPersistence, f as browserSessionPersistence, W as checkActionCode, U as confirmPasswordReset, w as connectAuthEmulator, d as cordovaPopupRedirectResolver, Y as createUserWithEmailAndPassword, p as debugErrorMap, n as deleteUser, a2 as fetchSignInMethodsForEmail, ad as getAdditionalUserInfo, aa as getIdToken, ab as getIdTokenResult, af as getMultiFactorResolver, g as getRedirectResult, B as inMemoryPersistence, c as indexedDBLocalPersistence, i as initializeAuth, h as initializeRecaptchaConfig, a0 as isSignInWithEmailLink, M as linkWithCredential, ag as multiFactor, k as onAuthStateChanged, o as onIdTokenChanged, a6 as parseActionCodeURL, q as prodErrorMap, N as reauthenticateWithCredential, ae as reload, a3 as sendEmailVerification, R as sendPasswordResetEmail, $ as sendSignInLinkToEmail, s as setPersistence, K as signInAnonymously, L as signInWithCredential, Q as signInWithCustomToken, Z as signInWithEmailAndPassword, a1 as signInWithEmailLink, m as signOut, ac as unlink, l as updateCurrentUser, a8 as updateEmail, a9 as updatePassword, a7 as updateProfile, u as useDeviceLanguage, v as validatePassword, a4 as verifyBeforeUpdateEmail, X as verifyPasswordResetCode } from './popup_redirect-
|
|
2
|
+
import { _ as _signInWithRedirect, a as _reauthenticateWithRedirect, b as _linkWithRedirect, r as registerAuth, i as initializeAuth, c as indexedDBLocalPersistence, d as cordovaPopupRedirectResolver } from './popup_redirect-400d4165.js';
|
|
3
|
+
export { A as ActionCodeOperation, a5 as ActionCodeURL, x as AuthCredential, t as AuthErrorCodes, E as EmailAuthCredential, C as EmailAuthProvider, D as FacebookAuthProvider, F as FactorId, H as GithubAuthProvider, G as GoogleAuthProvider, y as OAuthCredential, I as OAuthProvider, O as OperationType, z as PhoneAuthCredential, P as ProviderId, J as SAMLAuthProvider, S as SignInMethod, T as TwitterAuthProvider, V as applyActionCode, j as beforeAuthStateChanged, e as browserLocalPersistence, f as browserSessionPersistence, W as checkActionCode, U as confirmPasswordReset, w as connectAuthEmulator, d as cordovaPopupRedirectResolver, Y as createUserWithEmailAndPassword, p as debugErrorMap, n as deleteUser, a2 as fetchSignInMethodsForEmail, ad as getAdditionalUserInfo, aa as getIdToken, ab as getIdTokenResult, af as getMultiFactorResolver, g as getRedirectResult, B as inMemoryPersistence, c as indexedDBLocalPersistence, i as initializeAuth, h as initializeRecaptchaConfig, a0 as isSignInWithEmailLink, M as linkWithCredential, ag as multiFactor, k as onAuthStateChanged, o as onIdTokenChanged, a6 as parseActionCodeURL, q as prodErrorMap, N as reauthenticateWithCredential, ae as reload, a3 as sendEmailVerification, R as sendPasswordResetEmail, $ as sendSignInLinkToEmail, s as setPersistence, K as signInAnonymously, L as signInWithCredential, Q as signInWithCustomToken, Z as signInWithEmailAndPassword, a1 as signInWithEmailLink, m as signOut, ac as unlink, l as updateCurrentUser, a8 as updateEmail, a9 as updatePassword, a7 as updateProfile, u as useDeviceLanguage, v as validatePassword, a4 as verifyBeforeUpdateEmail, X as verifyPasswordResetCode } from './popup_redirect-400d4165.js';
|
|
4
4
|
import 'tslib';
|
|
5
5
|
import '@firebase/util';
|
|
6
6
|
import '@firebase/component';
|
package/dist/cordova/internal.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ah as _performApiRequest, ai as _addTidIfNecessary, aj as _assert, ak as Delay, al as _window, am as isV2, an as _createError, ao as _loadJS, ap as _generateCallbackName, aq as getRecaptchaParams, ar as _isHttpOrHttps, as as _isWorker, at as _castAuth, L as signInWithCredential, M as linkWithCredential, au as _assertLinkedStatus, N as reauthenticateWithCredential, av as sendPhoneVerificationCode, aw as startEnrollPhoneMfa, ax as _link, z as PhoneAuthCredential, ay as debugAssert, az as _generateEventId, aA as AbstractPopupRedirectOperation, aB as _assertInstanceOf, aC as _withDefaultResolver, aD as FederatedAuthProvider, aE as _fail, aF as _getProjectConfig, aG as _getCurrentUrl, aH as _emulatorUrl, aI as _isChromeIOS, aJ as _isFirefox, aK as _isIOSStandalone, aL as _getRedirectUrl, aM as _setWindowLocation, aN as _isMobileBrowser, aO as _isSafari, aP as _isIOS, f as browserSessionPersistence, aQ as _getRedirectResult, aR as _overrideRedirectResult, aS as AuthEventManager, aT as debugFail, aU as finalizeEnrollPhoneMfa, aV as finalizeEnrollTotpMfa, aW as startEnrollTotpMfa, r as registerAuth, i as initializeAuth, c as indexedDBLocalPersistence, e as browserLocalPersistence, j as beforeAuthStateChanged, o as onIdTokenChanged, w as connectAuthEmulator } from './popup_redirect-
|
|
2
|
-
export { A as ActionCodeOperation, a5 as ActionCodeURL, x as AuthCredential, t as AuthErrorCodes, a_ as AuthImpl, E as EmailAuthCredential, C as EmailAuthProvider, D as FacebookAuthProvider, F as FactorId, b0 as FetchProvider, H as GithubAuthProvider, G as GoogleAuthProvider, y as OAuthCredential, I as OAuthProvider, O as OperationType, z as PhoneAuthCredential, P as ProviderId, b1 as SAMLAuthCredential, J as SAMLAuthProvider, S as SignInMethod, T as TwitterAuthProvider, aY as UserImpl, aj as _assert, at as _castAuth, aE as _fail, az as _generateEventId, a$ as _getClientVersion, aZ as _getInstance, aQ as _getRedirectResult, aR as _overrideRedirectResult, aX as _persistenceKeyName, V as applyActionCode, j as beforeAuthStateChanged, e as browserLocalPersistence, f as browserSessionPersistence, W as checkActionCode, U as confirmPasswordReset, w as connectAuthEmulator, d as cordovaPopupRedirectResolver, Y as createUserWithEmailAndPassword, p as debugErrorMap, n as deleteUser, a2 as fetchSignInMethodsForEmail, ad as getAdditionalUserInfo, aa as getIdToken, ab as getIdTokenResult, af as getMultiFactorResolver, g as getRedirectResult, B as inMemoryPersistence, c as indexedDBLocalPersistence, i as initializeAuth, h as initializeRecaptchaConfig, a0 as isSignInWithEmailLink, M as linkWithCredential, b3 as linkWithRedirect, ag as multiFactor, k as onAuthStateChanged, o as onIdTokenChanged, a6 as parseActionCodeURL, q as prodErrorMap, N as reauthenticateWithCredential, b4 as reauthenticateWithRedirect, ae as reload, a3 as sendEmailVerification, R as sendPasswordResetEmail, $ as sendSignInLinkToEmail, s as setPersistence, K as signInAnonymously, L as signInWithCredential, Q as signInWithCustomToken, Z as signInWithEmailAndPassword, a1 as signInWithEmailLink, b2 as signInWithRedirect, m as signOut, ac as unlink, l as updateCurrentUser, a8 as updateEmail, a9 as updatePassword, a7 as updateProfile, u as useDeviceLanguage, v as validatePassword, a4 as verifyBeforeUpdateEmail, X as verifyPasswordResetCode } from './popup_redirect-
|
|
1
|
+
import { ah as _performApiRequest, ai as _addTidIfNecessary, aj as _assert, ak as Delay, al as _window, am as isV2, an as _createError, ao as _loadJS, ap as _generateCallbackName, aq as getRecaptchaParams, ar as _isHttpOrHttps, as as _isWorker, at as _castAuth, L as signInWithCredential, M as linkWithCredential, au as _assertLinkedStatus, N as reauthenticateWithCredential, av as sendPhoneVerificationCode, aw as startEnrollPhoneMfa, ax as _link, z as PhoneAuthCredential, ay as debugAssert, az as _generateEventId, aA as AbstractPopupRedirectOperation, aB as _assertInstanceOf, aC as _withDefaultResolver, aD as FederatedAuthProvider, aE as _fail, aF as _getProjectConfig, aG as _getCurrentUrl, aH as _emulatorUrl, aI as _isChromeIOS, aJ as _isFirefox, aK as _isIOSStandalone, aL as _getRedirectUrl, aM as _setWindowLocation, aN as _isMobileBrowser, aO as _isSafari, aP as _isIOS, f as browserSessionPersistence, aQ as _getRedirectResult, aR as _overrideRedirectResult, aS as AuthEventManager, aT as debugFail, aU as finalizeEnrollPhoneMfa, aV as finalizeEnrollTotpMfa, aW as startEnrollTotpMfa, r as registerAuth, i as initializeAuth, c as indexedDBLocalPersistence, e as browserLocalPersistence, j as beforeAuthStateChanged, o as onIdTokenChanged, w as connectAuthEmulator } from './popup_redirect-400d4165.js';
|
|
2
|
+
export { A as ActionCodeOperation, a5 as ActionCodeURL, x as AuthCredential, t as AuthErrorCodes, a_ as AuthImpl, E as EmailAuthCredential, C as EmailAuthProvider, D as FacebookAuthProvider, F as FactorId, b0 as FetchProvider, H as GithubAuthProvider, G as GoogleAuthProvider, y as OAuthCredential, I as OAuthProvider, O as OperationType, z as PhoneAuthCredential, P as ProviderId, b1 as SAMLAuthCredential, J as SAMLAuthProvider, S as SignInMethod, T as TwitterAuthProvider, aY as UserImpl, aj as _assert, at as _castAuth, aE as _fail, az as _generateEventId, a$ as _getClientVersion, aZ as _getInstance, aQ as _getRedirectResult, aR as _overrideRedirectResult, aX as _persistenceKeyName, V as applyActionCode, j as beforeAuthStateChanged, e as browserLocalPersistence, f as browserSessionPersistence, W as checkActionCode, U as confirmPasswordReset, w as connectAuthEmulator, d as cordovaPopupRedirectResolver, Y as createUserWithEmailAndPassword, p as debugErrorMap, n as deleteUser, a2 as fetchSignInMethodsForEmail, ad as getAdditionalUserInfo, aa as getIdToken, ab as getIdTokenResult, af as getMultiFactorResolver, g as getRedirectResult, B as inMemoryPersistence, c as indexedDBLocalPersistence, i as initializeAuth, h as initializeRecaptchaConfig, a0 as isSignInWithEmailLink, M as linkWithCredential, b3 as linkWithRedirect, ag as multiFactor, k as onAuthStateChanged, o as onIdTokenChanged, a6 as parseActionCodeURL, q as prodErrorMap, N as reauthenticateWithCredential, b4 as reauthenticateWithRedirect, ae as reload, a3 as sendEmailVerification, R as sendPasswordResetEmail, $ as sendSignInLinkToEmail, s as setPersistence, K as signInAnonymously, L as signInWithCredential, Q as signInWithCustomToken, Z as signInWithEmailAndPassword, a1 as signInWithEmailLink, b2 as signInWithRedirect, m as signOut, ac as unlink, l as updateCurrentUser, a8 as updateEmail, a9 as updatePassword, a7 as updateProfile, u as useDeviceLanguage, v as validatePassword, a4 as verifyBeforeUpdateEmail, X as verifyPasswordResetCode } from './popup_redirect-400d4165.js';
|
|
3
3
|
import { __awaiter, __generator, __assign, __extends, __spreadArray } from 'tslib';
|
|
4
4
|
import { querystring, getModularInstance, getUA, getExperimentalSetting, getDefaultEmulatorHost } from '@firebase/util';
|
|
5
5
|
import { SDK_VERSION, getApp, _getProvider } from '@firebase/app';
|
|
@@ -918,53 +918,6 @@ var IndexedDBLocalPersistence = /** @class */ (function () {
|
|
|
918
918
|
*/
|
|
919
919
|
var indexedDBLocalPersistence = IndexedDBLocalPersistence;
|
|
920
920
|
|
|
921
|
-
/**
|
|
922
|
-
* @license
|
|
923
|
-
* Copyright 2020 Google LLC
|
|
924
|
-
*
|
|
925
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
926
|
-
* you may not use this file except in compliance with the License.
|
|
927
|
-
* You may obtain a copy of the License at
|
|
928
|
-
*
|
|
929
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
930
|
-
*
|
|
931
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
932
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
933
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
934
|
-
* See the License for the specific language governing permissions and
|
|
935
|
-
* limitations under the License.
|
|
936
|
-
*/
|
|
937
|
-
function isV2(grecaptcha) {
|
|
938
|
-
return (grecaptcha !== undefined &&
|
|
939
|
-
grecaptcha.getResponse !== undefined);
|
|
940
|
-
}
|
|
941
|
-
function isEnterprise(grecaptcha) {
|
|
942
|
-
return (grecaptcha !== undefined &&
|
|
943
|
-
grecaptcha.enterprise !== undefined);
|
|
944
|
-
}
|
|
945
|
-
var RecaptchaConfig = /** @class */ (function () {
|
|
946
|
-
function RecaptchaConfig(response) {
|
|
947
|
-
/**
|
|
948
|
-
* The reCAPTCHA site key.
|
|
949
|
-
*/
|
|
950
|
-
this.siteKey = '';
|
|
951
|
-
/**
|
|
952
|
-
* The reCAPTCHA enablement status of the {@link EmailAuthProvider} for the current tenant.
|
|
953
|
-
*/
|
|
954
|
-
this.emailPasswordEnabled = false;
|
|
955
|
-
if (response.recaptchaKey === undefined) {
|
|
956
|
-
throw new Error('recaptchaKey undefined');
|
|
957
|
-
}
|
|
958
|
-
// Example response.recaptchaKey: "projects/proj123/keys/sitekey123"
|
|
959
|
-
this.siteKey = response.recaptchaKey.split('/')[3];
|
|
960
|
-
this.emailPasswordEnabled = response.recaptchaEnforcementState.some(function (enforcementState) {
|
|
961
|
-
return enforcementState.provider === 'EMAIL_PASSWORD_PROVIDER' &&
|
|
962
|
-
enforcementState.enforcementState !== 'OFF';
|
|
963
|
-
});
|
|
964
|
-
}
|
|
965
|
-
return RecaptchaConfig;
|
|
966
|
-
}());
|
|
967
|
-
|
|
968
921
|
/**
|
|
969
922
|
* @license
|
|
970
923
|
* Copyright 2020 Google LLC
|
|
@@ -1875,6 +1828,18 @@ function _getFinalTarget(auth, host, path, query) {
|
|
|
1875
1828
|
}
|
|
1876
1829
|
return _emulatorUrl(auth.config, base);
|
|
1877
1830
|
}
|
|
1831
|
+
function _parseEnforcementState(enforcementStateStr) {
|
|
1832
|
+
switch (enforcementStateStr) {
|
|
1833
|
+
case 'ENFORCE':
|
|
1834
|
+
return "ENFORCE" /* EnforcementState.ENFORCE */;
|
|
1835
|
+
case 'AUDIT':
|
|
1836
|
+
return "AUDIT" /* EnforcementState.AUDIT */;
|
|
1837
|
+
case 'OFF':
|
|
1838
|
+
return "OFF" /* EnforcementState.OFF */;
|
|
1839
|
+
default:
|
|
1840
|
+
return "ENFORCEMENT_STATE_UNSPECIFIED" /* EnforcementState.ENFORCEMENT_STATE_UNSPECIFIED */;
|
|
1841
|
+
}
|
|
1842
|
+
}
|
|
1878
1843
|
var NetworkTimeout = /** @class */ (function () {
|
|
1879
1844
|
function NetworkTimeout(auth) {
|
|
1880
1845
|
var _this = this;
|
|
@@ -1910,6 +1875,81 @@ function _makeTaggedError(auth, code, response) {
|
|
|
1910
1875
|
return error;
|
|
1911
1876
|
}
|
|
1912
1877
|
|
|
1878
|
+
/**
|
|
1879
|
+
* @license
|
|
1880
|
+
* Copyright 2020 Google LLC
|
|
1881
|
+
*
|
|
1882
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1883
|
+
* you may not use this file except in compliance with the License.
|
|
1884
|
+
* You may obtain a copy of the License at
|
|
1885
|
+
*
|
|
1886
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1887
|
+
*
|
|
1888
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1889
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1890
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1891
|
+
* See the License for the specific language governing permissions and
|
|
1892
|
+
* limitations under the License.
|
|
1893
|
+
*/
|
|
1894
|
+
function isV2(grecaptcha) {
|
|
1895
|
+
return (grecaptcha !== undefined &&
|
|
1896
|
+
grecaptcha.getResponse !== undefined);
|
|
1897
|
+
}
|
|
1898
|
+
function isEnterprise(grecaptcha) {
|
|
1899
|
+
return (grecaptcha !== undefined &&
|
|
1900
|
+
grecaptcha.enterprise !== undefined);
|
|
1901
|
+
}
|
|
1902
|
+
var RecaptchaConfig = /** @class */ (function () {
|
|
1903
|
+
function RecaptchaConfig(response) {
|
|
1904
|
+
/**
|
|
1905
|
+
* The reCAPTCHA site key.
|
|
1906
|
+
*/
|
|
1907
|
+
this.siteKey = '';
|
|
1908
|
+
/**
|
|
1909
|
+
* The list of providers and their enablement status for reCAPTCHA Enterprise.
|
|
1910
|
+
*/
|
|
1911
|
+
this.recaptchaEnforcementState = [];
|
|
1912
|
+
if (response.recaptchaKey === undefined) {
|
|
1913
|
+
throw new Error('recaptchaKey undefined');
|
|
1914
|
+
}
|
|
1915
|
+
// Example response.recaptchaKey: "projects/proj123/keys/sitekey123"
|
|
1916
|
+
this.siteKey = response.recaptchaKey.split('/')[3];
|
|
1917
|
+
this.recaptchaEnforcementState = response.recaptchaEnforcementState;
|
|
1918
|
+
}
|
|
1919
|
+
/**
|
|
1920
|
+
* Returns the reCAPTCHA Enterprise enforcement state for the given provider.
|
|
1921
|
+
*
|
|
1922
|
+
* @param providerStr - The provider whose enforcement state is to be returned.
|
|
1923
|
+
* @returns The reCAPTCHA Enterprise enforcement state for the given provider.
|
|
1924
|
+
*/
|
|
1925
|
+
RecaptchaConfig.prototype.getProviderEnforcementState = function (providerStr) {
|
|
1926
|
+
if (!this.recaptchaEnforcementState ||
|
|
1927
|
+
this.recaptchaEnforcementState.length === 0) {
|
|
1928
|
+
return null;
|
|
1929
|
+
}
|
|
1930
|
+
for (var _i = 0, _a = this.recaptchaEnforcementState; _i < _a.length; _i++) {
|
|
1931
|
+
var recaptchaEnforcementState = _a[_i];
|
|
1932
|
+
if (recaptchaEnforcementState.provider &&
|
|
1933
|
+
recaptchaEnforcementState.provider === providerStr) {
|
|
1934
|
+
return _parseEnforcementState(recaptchaEnforcementState.enforcementState);
|
|
1935
|
+
}
|
|
1936
|
+
}
|
|
1937
|
+
return null;
|
|
1938
|
+
};
|
|
1939
|
+
/**
|
|
1940
|
+
* Returns true if the reCAPTCHA Enterprise enforcement state for the provider is set to ENFORCE or AUDIT.
|
|
1941
|
+
*
|
|
1942
|
+
* @param providerStr - The provider whose enablement state is to be returned.
|
|
1943
|
+
* @returns Whether or not reCAPTCHA Enterprise protection is enabled for the given provider.
|
|
1944
|
+
*/
|
|
1945
|
+
RecaptchaConfig.prototype.isProviderEnabled = function (providerStr) {
|
|
1946
|
+
return (this.getProviderEnforcementState(providerStr) ===
|
|
1947
|
+
"ENFORCE" /* EnforcementState.ENFORCE */ ||
|
|
1948
|
+
this.getProviderEnforcementState(providerStr) === "AUDIT" /* EnforcementState.AUDIT */);
|
|
1949
|
+
};
|
|
1950
|
+
return RecaptchaConfig;
|
|
1951
|
+
}());
|
|
1952
|
+
|
|
1913
1953
|
/**
|
|
1914
1954
|
* @license
|
|
1915
1955
|
* Copyright 2020 Google LLC
|
|
@@ -4592,6 +4632,39 @@ function injectRecaptchaFields(auth, request, action, captchaResp) {
|
|
|
4592
4632
|
});
|
|
4593
4633
|
});
|
|
4594
4634
|
}
|
|
4635
|
+
function handleRecaptchaFlow(authInstance, request, actionName, actionMethod) {
|
|
4636
|
+
var _a;
|
|
4637
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
4638
|
+
var requestWithRecaptcha;
|
|
4639
|
+
var _this = this;
|
|
4640
|
+
return __generator(this, function (_b) {
|
|
4641
|
+
switch (_b.label) {
|
|
4642
|
+
case 0:
|
|
4643
|
+
if (!((_a = authInstance
|
|
4644
|
+
._getRecaptchaConfig()) === null || _a === void 0 ? void 0 : _a.isProviderEnabled("EMAIL_PASSWORD_PROVIDER" /* RecaptchaProvider.EMAIL_PASSWORD_PROVIDER */))) return [3 /*break*/, 2];
|
|
4645
|
+
return [4 /*yield*/, injectRecaptchaFields(authInstance, request, actionName, actionName === "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */)];
|
|
4646
|
+
case 1:
|
|
4647
|
+
requestWithRecaptcha = _b.sent();
|
|
4648
|
+
return [2 /*return*/, actionMethod(authInstance, requestWithRecaptcha)];
|
|
4649
|
+
case 2: return [2 /*return*/, actionMethod(authInstance, request).catch(function (error) { return __awaiter(_this, void 0, void 0, function () {
|
|
4650
|
+
var requestWithRecaptcha;
|
|
4651
|
+
return __generator(this, function (_a) {
|
|
4652
|
+
switch (_a.label) {
|
|
4653
|
+
case 0:
|
|
4654
|
+
if (!(error.code === "auth/".concat("missing-recaptcha-token" /* AuthErrorCode.MISSING_RECAPTCHA_TOKEN */))) return [3 /*break*/, 2];
|
|
4655
|
+
console.log("".concat(actionName, " is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow."));
|
|
4656
|
+
return [4 /*yield*/, injectRecaptchaFields(authInstance, request, actionName, actionName === "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */)];
|
|
4657
|
+
case 1:
|
|
4658
|
+
requestWithRecaptcha = _a.sent();
|
|
4659
|
+
return [2 /*return*/, actionMethod(authInstance, requestWithRecaptcha)];
|
|
4660
|
+
case 2: return [2 /*return*/, Promise.reject(error)];
|
|
4661
|
+
}
|
|
4662
|
+
});
|
|
4663
|
+
}); })];
|
|
4664
|
+
}
|
|
4665
|
+
});
|
|
4666
|
+
});
|
|
4667
|
+
}
|
|
4595
4668
|
function _initializeRecaptchaConfig(auth) {
|
|
4596
4669
|
return __awaiter(this, void 0, void 0, function () {
|
|
4597
4670
|
var authInternal, response, config, verifier;
|
|
@@ -4612,7 +4685,7 @@ function _initializeRecaptchaConfig(auth) {
|
|
|
4612
4685
|
else {
|
|
4613
4686
|
authInternal._tenantRecaptchaConfigs[authInternal.tenantId] = config;
|
|
4614
4687
|
}
|
|
4615
|
-
if (config.
|
|
4688
|
+
if (config.isProviderEnabled("EMAIL_PASSWORD_PROVIDER" /* RecaptchaProvider.EMAIL_PASSWORD_PROVIDER */)) {
|
|
4616
4689
|
verifier = new RecaptchaEnterpriseVerifier(authInternal);
|
|
4617
4690
|
void verifier.verify();
|
|
4618
4691
|
}
|
|
@@ -5078,55 +5151,27 @@ var EmailAuthCredential = /** @class */ (function (_super) {
|
|
|
5078
5151
|
};
|
|
5079
5152
|
/** @internal */
|
|
5080
5153
|
EmailAuthCredential.prototype._getIdTokenResponse = function (auth) {
|
|
5081
|
-
var _a;
|
|
5082
5154
|
return __awaiter(this, void 0, void 0, function () {
|
|
5083
|
-
var
|
|
5084
|
-
|
|
5085
|
-
|
|
5086
|
-
|
|
5087
|
-
|
|
5088
|
-
_b = this.signInMethod;
|
|
5089
|
-
switch (_b) {
|
|
5090
|
-
case "password" /* SignInMethod.EMAIL_PASSWORD */: return [3 /*break*/, 1];
|
|
5091
|
-
case "emailLink" /* SignInMethod.EMAIL_LINK */: return [3 /*break*/, 4];
|
|
5092
|
-
}
|
|
5093
|
-
return [3 /*break*/, 5];
|
|
5094
|
-
case 1:
|
|
5095
|
-
request_1 = {
|
|
5155
|
+
var request;
|
|
5156
|
+
return __generator(this, function (_a) {
|
|
5157
|
+
switch (this.signInMethod) {
|
|
5158
|
+
case "password" /* SignInMethod.EMAIL_PASSWORD */:
|
|
5159
|
+
request = {
|
|
5096
5160
|
returnSecureToken: true,
|
|
5097
5161
|
email: this._email,
|
|
5098
5162
|
password: this._password,
|
|
5099
5163
|
clientType: "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */
|
|
5100
5164
|
};
|
|
5101
|
-
|
|
5102
|
-
|
|
5103
|
-
|
|
5104
|
-
|
|
5105
|
-
|
|
5106
|
-
|
|
5107
|
-
|
|
5108
|
-
return __generator(this, function (_a) {
|
|
5109
|
-
switch (_a.label) {
|
|
5110
|
-
case 0:
|
|
5111
|
-
if (!(error.code === "auth/".concat("missing-recaptcha-token" /* AuthErrorCode.MISSING_RECAPTCHA_TOKEN */))) return [3 /*break*/, 2];
|
|
5112
|
-
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.');
|
|
5113
|
-
return [4 /*yield*/, injectRecaptchaFields(auth, request_1, "signInWithPassword" /* RecaptchaActionName.SIGN_IN_WITH_PASSWORD */)];
|
|
5114
|
-
case 1:
|
|
5115
|
-
requestWithRecaptcha = _a.sent();
|
|
5116
|
-
return [2 /*return*/, signInWithPassword(auth, requestWithRecaptcha)];
|
|
5117
|
-
case 2: return [2 /*return*/, Promise.reject(error)];
|
|
5118
|
-
}
|
|
5119
|
-
});
|
|
5120
|
-
}); })];
|
|
5121
|
-
case 4: return [2 /*return*/, signInWithEmailLink$1(auth, {
|
|
5122
|
-
email: this._email,
|
|
5123
|
-
oobCode: this._password
|
|
5124
|
-
})];
|
|
5125
|
-
case 5:
|
|
5165
|
+
return [2 /*return*/, handleRecaptchaFlow(auth, request, "signInWithPassword" /* RecaptchaActionName.SIGN_IN_WITH_PASSWORD */, signInWithPassword)];
|
|
5166
|
+
case "emailLink" /* SignInMethod.EMAIL_LINK */:
|
|
5167
|
+
return [2 /*return*/, signInWithEmailLink$1(auth, {
|
|
5168
|
+
email: this._email,
|
|
5169
|
+
oobCode: this._password
|
|
5170
|
+
})];
|
|
5171
|
+
default:
|
|
5126
5172
|
_fail(auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
5127
|
-
_c.label = 6;
|
|
5128
|
-
case 6: return [2 /*return*/];
|
|
5129
5173
|
}
|
|
5174
|
+
return [2 /*return*/];
|
|
5130
5175
|
});
|
|
5131
5176
|
});
|
|
5132
5177
|
};
|
|
@@ -7343,12 +7388,10 @@ function recachePasswordPolicy(auth) {
|
|
|
7343
7388
|
* @public
|
|
7344
7389
|
*/
|
|
7345
7390
|
function sendPasswordResetEmail(auth, email, actionCodeSettings) {
|
|
7346
|
-
var _a;
|
|
7347
7391
|
return __awaiter(this, void 0, void 0, function () {
|
|
7348
|
-
var authInternal, request
|
|
7349
|
-
|
|
7350
|
-
|
|
7351
|
-
switch (_b.label) {
|
|
7392
|
+
var authInternal, request;
|
|
7393
|
+
return __generator(this, function (_a) {
|
|
7394
|
+
switch (_a.label) {
|
|
7352
7395
|
case 0:
|
|
7353
7396
|
authInternal = _castAuth(auth);
|
|
7354
7397
|
request = {
|
|
@@ -7356,48 +7399,13 @@ function sendPasswordResetEmail(auth, email, actionCodeSettings) {
|
|
|
7356
7399
|
email: email,
|
|
7357
7400
|
clientType: "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */
|
|
7358
7401
|
};
|
|
7359
|
-
if (!((_a = authInternal._getRecaptchaConfig()) === null || _a === void 0 ? void 0 : _a.emailPasswordEnabled)) return [3 /*break*/, 3];
|
|
7360
|
-
return [4 /*yield*/, injectRecaptchaFields(authInternal, request, "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */, true)];
|
|
7361
|
-
case 1:
|
|
7362
|
-
requestWithRecaptcha = _b.sent();
|
|
7363
|
-
if (actionCodeSettings) {
|
|
7364
|
-
_setActionCodeSettingsOnRequest(authInternal, requestWithRecaptcha, actionCodeSettings);
|
|
7365
|
-
}
|
|
7366
|
-
return [4 /*yield*/, sendPasswordResetEmail$1(authInternal, requestWithRecaptcha)];
|
|
7367
|
-
case 2:
|
|
7368
|
-
_b.sent();
|
|
7369
|
-
return [3 /*break*/, 5];
|
|
7370
|
-
case 3:
|
|
7371
7402
|
if (actionCodeSettings) {
|
|
7372
7403
|
_setActionCodeSettingsOnRequest(authInternal, request, actionCodeSettings);
|
|
7373
7404
|
}
|
|
7374
|
-
return [4 /*yield*/,
|
|
7375
|
-
|
|
7376
|
-
|
|
7377
|
-
|
|
7378
|
-
switch (_a.label) {
|
|
7379
|
-
case 0:
|
|
7380
|
-
if (!(error.code === "auth/".concat("missing-recaptcha-token" /* AuthErrorCode.MISSING_RECAPTCHA_TOKEN */))) return [3 /*break*/, 3];
|
|
7381
|
-
console.log('Password resets are protected by reCAPTCHA for this project. Automatically triggering the reCAPTCHA flow and restarting the password reset flow.');
|
|
7382
|
-
return [4 /*yield*/, injectRecaptchaFields(authInternal, request, "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */, true)];
|
|
7383
|
-
case 1:
|
|
7384
|
-
requestWithRecaptcha = _a.sent();
|
|
7385
|
-
if (actionCodeSettings) {
|
|
7386
|
-
_setActionCodeSettingsOnRequest(authInternal, requestWithRecaptcha, actionCodeSettings);
|
|
7387
|
-
}
|
|
7388
|
-
return [4 /*yield*/, sendPasswordResetEmail$1(authInternal, requestWithRecaptcha)];
|
|
7389
|
-
case 2:
|
|
7390
|
-
_a.sent();
|
|
7391
|
-
return [3 /*break*/, 4];
|
|
7392
|
-
case 3: return [2 /*return*/, Promise.reject(error)];
|
|
7393
|
-
case 4: return [2 /*return*/];
|
|
7394
|
-
}
|
|
7395
|
-
});
|
|
7396
|
-
}); })];
|
|
7397
|
-
case 4:
|
|
7398
|
-
_b.sent();
|
|
7399
|
-
_b.label = 5;
|
|
7400
|
-
case 5: return [2 /*return*/];
|
|
7405
|
+
return [4 /*yield*/, handleRecaptchaFlow(authInternal, request, "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */, sendPasswordResetEmail$1)];
|
|
7406
|
+
case 1:
|
|
7407
|
+
_a.sent();
|
|
7408
|
+
return [2 /*return*/];
|
|
7401
7409
|
}
|
|
7402
7410
|
});
|
|
7403
7411
|
});
|
|
@@ -7552,12 +7560,10 @@ function verifyPasswordResetCode(auth, code) {
|
|
|
7552
7560
|
* @public
|
|
7553
7561
|
*/
|
|
7554
7562
|
function createUserWithEmailAndPassword(auth, email, password) {
|
|
7555
|
-
var _a;
|
|
7556
7563
|
return __awaiter(this, void 0, void 0, function () {
|
|
7557
|
-
var authInternal, request, signUpResponse,
|
|
7558
|
-
|
|
7559
|
-
|
|
7560
|
-
switch (_b.label) {
|
|
7564
|
+
var authInternal, request, signUpResponse, response, userCredential;
|
|
7565
|
+
return __generator(this, function (_a) {
|
|
7566
|
+
switch (_a.label) {
|
|
7561
7567
|
case 0:
|
|
7562
7568
|
authInternal = _castAuth(auth);
|
|
7563
7569
|
request = {
|
|
@@ -7566,43 +7572,21 @@ function createUserWithEmailAndPassword(auth, email, password) {
|
|
|
7566
7572
|
password: password,
|
|
7567
7573
|
clientType: "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */
|
|
7568
7574
|
};
|
|
7569
|
-
|
|
7570
|
-
return [4 /*yield*/,
|
|
7571
|
-
|
|
7572
|
-
|
|
7573
|
-
signUpResponse = signUp(authInternal, requestWithRecaptcha);
|
|
7574
|
-
return [3 /*break*/, 3];
|
|
7575
|
-
case 2:
|
|
7576
|
-
signUpResponse = signUp(authInternal, request).catch(function (error) { return __awaiter(_this, void 0, void 0, function () {
|
|
7577
|
-
var requestWithRecaptcha;
|
|
7578
|
-
return __generator(this, function (_a) {
|
|
7579
|
-
switch (_a.label) {
|
|
7580
|
-
case 0:
|
|
7581
|
-
if (!(error.code === "auth/".concat("missing-recaptcha-token" /* AuthErrorCode.MISSING_RECAPTCHA_TOKEN */))) return [3 /*break*/, 2];
|
|
7582
|
-
console.log('Sign-up is protected by reCAPTCHA for this project. Automatically triggering the reCAPTCHA flow and restarting the sign-up flow.');
|
|
7583
|
-
return [4 /*yield*/, injectRecaptchaFields(authInternal, request, "signUpPassword" /* RecaptchaActionName.SIGN_UP_PASSWORD */)];
|
|
7584
|
-
case 1:
|
|
7585
|
-
requestWithRecaptcha = _a.sent();
|
|
7586
|
-
return [2 /*return*/, signUp(authInternal, requestWithRecaptcha)];
|
|
7587
|
-
case 2: throw error;
|
|
7575
|
+
signUpResponse = handleRecaptchaFlow(authInternal, request, "signUpPassword" /* RecaptchaActionName.SIGN_UP_PASSWORD */, signUp);
|
|
7576
|
+
return [4 /*yield*/, signUpResponse.catch(function (error) {
|
|
7577
|
+
if (error.code === "auth/".concat("password-does-not-meet-requirements" /* AuthErrorCode.PASSWORD_DOES_NOT_MEET_REQUIREMENTS */)) {
|
|
7578
|
+
void recachePasswordPolicy(auth);
|
|
7588
7579
|
}
|
|
7589
|
-
|
|
7590
|
-
|
|
7591
|
-
|
|
7592
|
-
|
|
7593
|
-
if (error.code === "auth/".concat("password-does-not-meet-requirements" /* AuthErrorCode.PASSWORD_DOES_NOT_MEET_REQUIREMENTS */)) {
|
|
7594
|
-
void recachePasswordPolicy(auth);
|
|
7595
|
-
}
|
|
7596
|
-
throw error;
|
|
7597
|
-
})];
|
|
7598
|
-
case 4:
|
|
7599
|
-
response = _b.sent();
|
|
7580
|
+
throw error;
|
|
7581
|
+
})];
|
|
7582
|
+
case 1:
|
|
7583
|
+
response = _a.sent();
|
|
7600
7584
|
return [4 /*yield*/, UserCredentialImpl._fromIdTokenResponse(authInternal, "signIn" /* OperationType.SIGN_IN */, response)];
|
|
7601
|
-
case
|
|
7602
|
-
userCredential =
|
|
7585
|
+
case 2:
|
|
7586
|
+
userCredential = _a.sent();
|
|
7603
7587
|
return [4 /*yield*/, authInternal._updateCurrentUser(userCredential.user)];
|
|
7604
|
-
case
|
|
7605
|
-
|
|
7588
|
+
case 3:
|
|
7589
|
+
_a.sent();
|
|
7606
7590
|
return [2 /*return*/, userCredential];
|
|
7607
7591
|
}
|
|
7608
7592
|
});
|
|
@@ -7691,7 +7675,6 @@ function signInWithEmailAndPassword(auth, email, password) {
|
|
|
7691
7675
|
* @public
|
|
7692
7676
|
*/
|
|
7693
7677
|
function sendSignInLinkToEmail(auth, email, actionCodeSettings) {
|
|
7694
|
-
var _a;
|
|
7695
7678
|
return __awaiter(this, void 0, void 0, function () {
|
|
7696
7679
|
function setActionCodeSettings(request, actionCodeSettings) {
|
|
7697
7680
|
_assert(actionCodeSettings.handleCodeInApp, authInternal, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
@@ -7699,10 +7682,9 @@ function sendSignInLinkToEmail(auth, email, actionCodeSettings) {
|
|
|
7699
7682
|
_setActionCodeSettingsOnRequest(authInternal, request, actionCodeSettings);
|
|
7700
7683
|
}
|
|
7701
7684
|
}
|
|
7702
|
-
var authInternal, request
|
|
7703
|
-
|
|
7704
|
-
|
|
7705
|
-
switch (_b.label) {
|
|
7685
|
+
var authInternal, request;
|
|
7686
|
+
return __generator(this, function (_a) {
|
|
7687
|
+
switch (_a.label) {
|
|
7706
7688
|
case 0:
|
|
7707
7689
|
authInternal = _castAuth(auth);
|
|
7708
7690
|
request = {
|
|
@@ -7710,42 +7692,11 @@ function sendSignInLinkToEmail(auth, email, actionCodeSettings) {
|
|
|
7710
7692
|
email: email,
|
|
7711
7693
|
clientType: "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */
|
|
7712
7694
|
};
|
|
7713
|
-
if (!((_a = authInternal._getRecaptchaConfig()) === null || _a === void 0 ? void 0 : _a.emailPasswordEnabled)) return [3 /*break*/, 3];
|
|
7714
|
-
return [4 /*yield*/, injectRecaptchaFields(authInternal, request, "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */, true)];
|
|
7715
|
-
case 1:
|
|
7716
|
-
requestWithRecaptcha = _b.sent();
|
|
7717
|
-
setActionCodeSettings(requestWithRecaptcha, actionCodeSettings);
|
|
7718
|
-
return [4 /*yield*/, sendSignInLinkToEmail$1(authInternal, requestWithRecaptcha)];
|
|
7719
|
-
case 2:
|
|
7720
|
-
_b.sent();
|
|
7721
|
-
return [3 /*break*/, 5];
|
|
7722
|
-
case 3:
|
|
7723
7695
|
setActionCodeSettings(request, actionCodeSettings);
|
|
7724
|
-
return [4 /*yield*/,
|
|
7725
|
-
|
|
7726
|
-
|
|
7727
|
-
|
|
7728
|
-
switch (_a.label) {
|
|
7729
|
-
case 0:
|
|
7730
|
-
if (!(error.code === "auth/".concat("missing-recaptcha-token" /* AuthErrorCode.MISSING_RECAPTCHA_TOKEN */))) return [3 /*break*/, 3];
|
|
7731
|
-
console.log('Email link sign-in is protected by reCAPTCHA for this project. Automatically triggering the reCAPTCHA flow and restarting the sign-in flow.');
|
|
7732
|
-
return [4 /*yield*/, injectRecaptchaFields(authInternal, request, "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */, true)];
|
|
7733
|
-
case 1:
|
|
7734
|
-
requestWithRecaptcha = _a.sent();
|
|
7735
|
-
setActionCodeSettings(requestWithRecaptcha, actionCodeSettings);
|
|
7736
|
-
return [4 /*yield*/, sendSignInLinkToEmail$1(authInternal, requestWithRecaptcha)];
|
|
7737
|
-
case 2:
|
|
7738
|
-
_a.sent();
|
|
7739
|
-
return [3 /*break*/, 4];
|
|
7740
|
-
case 3: return [2 /*return*/, Promise.reject(error)];
|
|
7741
|
-
case 4: return [2 /*return*/];
|
|
7742
|
-
}
|
|
7743
|
-
});
|
|
7744
|
-
}); })];
|
|
7745
|
-
case 4:
|
|
7746
|
-
_b.sent();
|
|
7747
|
-
_b.label = 5;
|
|
7748
|
-
case 5: return [2 /*return*/];
|
|
7696
|
+
return [4 /*yield*/, handleRecaptchaFlow(authInternal, request, "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */, sendSignInLinkToEmail$1)];
|
|
7697
|
+
case 1:
|
|
7698
|
+
_a.sent();
|
|
7699
|
+
return [2 /*return*/];
|
|
7749
7700
|
}
|
|
7750
7701
|
});
|
|
7751
7702
|
});
|
|
@@ -8825,7 +8776,7 @@ function multiFactor(user) {
|
|
|
8825
8776
|
}
|
|
8826
8777
|
|
|
8827
8778
|
var name = "@firebase/auth";
|
|
8828
|
-
var version = "1.3.0-canary.
|
|
8779
|
+
var version = "1.3.0-canary.bd073b26a";
|
|
8829
8780
|
|
|
8830
8781
|
/**
|
|
8831
8782
|
* @license
|
|
@@ -11029,4 +10980,4 @@ function generateNoEvent() {
|
|
|
11029
10980
|
}
|
|
11030
10981
|
|
|
11031
10982
|
export { sendSignInLinkToEmail as $, ActionCodeOperation as A, inMemoryPersistence as B, EmailAuthProvider as C, FacebookAuthProvider as D, EmailAuthCredential as E, FactorId as F, GoogleAuthProvider as G, GithubAuthProvider as H, OAuthProvider as I, SAMLAuthProvider as J, signInAnonymously as K, signInWithCredential as L, linkWithCredential as M, reauthenticateWithCredential as N, OperationType as O, ProviderId as P, signInWithCustomToken as Q, sendPasswordResetEmail as R, SignInMethod as S, TwitterAuthProvider as T, confirmPasswordReset as U, applyActionCode as V, checkActionCode as W, verifyPasswordResetCode as X, createUserWithEmailAndPassword as Y, signInWithEmailAndPassword as Z, _signInWithRedirect as _, _reauthenticateWithRedirect as a, _getClientVersion as a$, isSignInWithEmailLink as a0, signInWithEmailLink as a1, fetchSignInMethodsForEmail as a2, sendEmailVerification as a3, verifyBeforeUpdateEmail as a4, ActionCodeURL as a5, parseActionCodeURL as a6, updateProfile as a7, updateEmail as a8, updatePassword as a9, AbstractPopupRedirectOperation as aA, _assertInstanceOf as aB, _withDefaultResolver as aC, FederatedAuthProvider as aD, _fail as aE, _getProjectConfig as aF, _getCurrentUrl as aG, _emulatorUrl as aH, _isChromeIOS as aI, _isFirefox as aJ, _isIOSStandalone as aK, _getRedirectUrl as aL, _setWindowLocation as aM, _isMobileBrowser as aN, _isSafari as aO, _isIOS as aP, _getRedirectResult as aQ, _overrideRedirectResult as aR, AuthEventManager as aS, debugFail as aT, finalizeEnrollPhoneMfa as aU, finalizeEnrollTotpMfa as aV, startEnrollTotpMfa as aW, _persistenceKeyName as aX, UserImpl as aY, _getInstance as aZ, AuthImpl as a_, getIdToken as aa, getIdTokenResult as ab, unlink as ac, getAdditionalUserInfo as ad, reload as ae, getMultiFactorResolver as af, multiFactor as ag, _performApiRequest as ah, _addTidIfNecessary as ai, _assert as aj, Delay as ak, _window as al, isV2 as am, _createError as an, _loadJS as ao, _generateCallbackName as ap, getRecaptchaParams as aq, _isHttpOrHttps as ar, _isWorker as as, _castAuth as at, _assertLinkedStatus as au, sendPhoneVerificationCode as av, startEnrollPhoneMfa as aw, _link$1 as ax, debugAssert as ay, _generateEventId as az, _linkWithRedirect as b, FetchProvider as b0, SAMLAuthCredential as b1, signInWithRedirect as b2, linkWithRedirect as b3, reauthenticateWithRedirect as b4, indexedDBLocalPersistence as c, cordovaPopupRedirectResolver as d, browserLocalPersistence as e, browserSessionPersistence as f, getRedirectResult as g, initializeRecaptchaConfig as h, initializeAuth as i, beforeAuthStateChanged as j, onAuthStateChanged as k, updateCurrentUser as l, signOut as m, deleteUser as n, onIdTokenChanged as o, debugErrorMap as p, prodErrorMap as q, registerAuth as r, setPersistence as s, AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY as t, useDeviceLanguage as u, validatePassword as v, connectAuthEmulator as w, AuthCredential as x, OAuthCredential as y, PhoneAuthCredential as z };
|
|
11032
|
-
//# sourceMappingURL=popup_redirect-
|
|
10983
|
+
//# sourceMappingURL=popup_redirect-400d4165.js.map
|