@firebase/auth 1.3.0-canary.320e58cc5 → 1.3.0-canary.3533b32b1
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/browser-cjs/{index-d99af397.js → index-b307b714.js} +28 -82
- package/dist/browser-cjs/index-b307b714.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/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-916d0fbe.js → popup_redirect-4839de8e.js} +76 -166
- package/dist/cordova/popup_redirect-4839de8e.js.map +1 -0
- package/dist/cordova/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +3 -0
- package/dist/esm2017/{index-c252646d.js → index-be7e4b8e.js} +28 -82
- package/dist/esm2017/index-be7e4b8e.js.map +1 -0
- package/dist/esm2017/index.js +1 -1
- package/dist/esm2017/internal.js +2 -2
- package/dist/esm2017/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +3 -0
- package/dist/esm5/{index-ed836b28.js → index-573d9edf.js} +76 -166
- package/dist/esm5/index-573d9edf.js.map +1 -0
- package/dist/esm5/index.js +1 -1
- package/dist/esm5/internal.js +2 -2
- package/dist/esm5/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +3 -0
- package/dist/index.webworker.esm5.js +75 -165
- 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/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +3 -0
- package/dist/node/{totp-7b78dce5.js → totp-875b7ace.js} +76 -166
- package/dist/node/totp-875b7ace.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/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +3 -0
- package/dist/node-esm/{totp-c677c59f.js → totp-28dfaa72.js} +28 -82
- package/dist/node-esm/totp-28dfaa72.js.map +1 -0
- package/dist/rn/{index-c6a05ba9.js → index-85a65bfb.js} +76 -166
- package/dist/rn/index-85a65bfb.js.map +1 -0
- package/dist/rn/index.js +1 -1
- package/dist/rn/internal.js +1 -1
- package/dist/rn/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +3 -0
- package/dist/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +3 -0
- package/package.json +12 -12
- package/dist/browser-cjs/index-d99af397.js.map +0 -1
- package/dist/cordova/popup_redirect-916d0fbe.js.map +0 -1
- package/dist/esm2017/index-c252646d.js.map +0 -1
- package/dist/esm5/index-ed836b28.js.map +0 -1
- package/dist/node/totp-7b78dce5.js.map +0 -1
- package/dist/node-esm/totp-c677c59f.js.map +0 -1
- package/dist/rn/index-c6a05ba9.js.map +0 -1
|
@@ -3135,6 +3135,25 @@ async function injectRecaptchaFields(auth, request, action, captchaResp = false)
|
|
|
3135
3135
|
});
|
|
3136
3136
|
return newRequest;
|
|
3137
3137
|
}
|
|
3138
|
+
async function handleRecaptchaFlow(authInstance, request, actionName, actionMethod) {
|
|
3139
|
+
var _a;
|
|
3140
|
+
if ((_a = authInstance._getRecaptchaConfig()) === null || _a === void 0 ? void 0 : _a.emailPasswordEnabled) {
|
|
3141
|
+
const requestWithRecaptcha = await injectRecaptchaFields(authInstance, request, actionName, actionName === "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */);
|
|
3142
|
+
return actionMethod(authInstance, requestWithRecaptcha);
|
|
3143
|
+
}
|
|
3144
|
+
else {
|
|
3145
|
+
return actionMethod(authInstance, request).catch(async (error) => {
|
|
3146
|
+
if (error.code === `auth/${"missing-recaptcha-token" /* AuthErrorCode.MISSING_RECAPTCHA_TOKEN */}`) {
|
|
3147
|
+
console.log(`${actionName} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);
|
|
3148
|
+
const requestWithRecaptcha = await injectRecaptchaFields(authInstance, request, actionName, actionName === "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */);
|
|
3149
|
+
return actionMethod(authInstance, requestWithRecaptcha);
|
|
3150
|
+
}
|
|
3151
|
+
else {
|
|
3152
|
+
return Promise.reject(error);
|
|
3153
|
+
}
|
|
3154
|
+
});
|
|
3155
|
+
}
|
|
3156
|
+
}
|
|
3138
3157
|
async function _initializeRecaptchaConfig(auth) {
|
|
3139
3158
|
const authInternal = _castAuth(auth);
|
|
3140
3159
|
const response = await getRecaptchaConfig(authInternal, {
|
|
@@ -3561,7 +3580,6 @@ class EmailAuthCredential extends AuthCredential {
|
|
|
3561
3580
|
}
|
|
3562
3581
|
/** @internal */
|
|
3563
3582
|
async _getIdTokenResponse(auth) {
|
|
3564
|
-
var _a;
|
|
3565
3583
|
switch (this.signInMethod) {
|
|
3566
3584
|
case "password" /* SignInMethod.EMAIL_PASSWORD */:
|
|
3567
3585
|
const request = {
|
|
@@ -3570,22 +3588,7 @@ class EmailAuthCredential extends AuthCredential {
|
|
|
3570
3588
|
password: this._password,
|
|
3571
3589
|
clientType: "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */
|
|
3572
3590
|
};
|
|
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
|
-
}
|
|
3591
|
+
return handleRecaptchaFlow(auth, request, "signInWithPassword" /* RecaptchaActionName.SIGN_IN_WITH_PASSWORD */, signInWithPassword);
|
|
3589
3592
|
case "emailLink" /* SignInMethod.EMAIL_LINK */:
|
|
3590
3593
|
return signInWithEmailLink$1(auth, {
|
|
3591
3594
|
email: this._email,
|
|
@@ -5563,39 +5566,16 @@ async function recachePasswordPolicy(auth) {
|
|
|
5563
5566
|
* @public
|
|
5564
5567
|
*/
|
|
5565
5568
|
async function sendPasswordResetEmail(auth, email, actionCodeSettings) {
|
|
5566
|
-
var _a;
|
|
5567
5569
|
const authInternal = _castAuth(auth);
|
|
5568
5570
|
const request = {
|
|
5569
5571
|
requestType: "PASSWORD_RESET" /* ActionCodeOperation.PASSWORD_RESET */,
|
|
5570
5572
|
email,
|
|
5571
5573
|
clientType: "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */
|
|
5572
5574
|
};
|
|
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
|
-
});
|
|
5575
|
+
if (actionCodeSettings) {
|
|
5576
|
+
_setActionCodeSettingsOnRequest(authInternal, request, actionCodeSettings);
|
|
5598
5577
|
}
|
|
5578
|
+
await handleRecaptchaFlow(authInternal, request, "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */, sendPasswordResetEmail$1);
|
|
5599
5579
|
}
|
|
5600
5580
|
/**
|
|
5601
5581
|
* Completes the password reset process, given a confirmation code and new password.
|
|
@@ -5715,7 +5695,6 @@ async function verifyPasswordResetCode(auth, code) {
|
|
|
5715
5695
|
* @public
|
|
5716
5696
|
*/
|
|
5717
5697
|
async function createUserWithEmailAndPassword(auth, email, password) {
|
|
5718
|
-
var _a;
|
|
5719
5698
|
const authInternal = _castAuth(auth);
|
|
5720
5699
|
const request = {
|
|
5721
5700
|
returnSecureToken: true,
|
|
@@ -5723,21 +5702,7 @@ async function createUserWithEmailAndPassword(auth, email, password) {
|
|
|
5723
5702
|
password,
|
|
5724
5703
|
clientType: "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */
|
|
5725
5704
|
};
|
|
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
|
-
}
|
|
5705
|
+
const signUpResponse = handleRecaptchaFlow(authInternal, request, "signUpPassword" /* RecaptchaActionName.SIGN_UP_PASSWORD */, signUp);
|
|
5741
5706
|
const response = await signUpResponse.catch(error => {
|
|
5742
5707
|
if (error.code === `auth/${"password-does-not-meet-requirements" /* AuthErrorCode.PASSWORD_DOES_NOT_MEET_REQUIREMENTS */}`) {
|
|
5743
5708
|
void recachePasswordPolicy(auth);
|
|
@@ -5828,7 +5793,6 @@ function signInWithEmailAndPassword(auth, email, password) {
|
|
|
5828
5793
|
* @public
|
|
5829
5794
|
*/
|
|
5830
5795
|
async function sendSignInLinkToEmail(auth, email, actionCodeSettings) {
|
|
5831
|
-
var _a;
|
|
5832
5796
|
const authInternal = _castAuth(auth);
|
|
5833
5797
|
const request = {
|
|
5834
5798
|
requestType: "EMAIL_SIGNIN" /* ActionCodeOperation.EMAIL_SIGNIN */,
|
|
@@ -5841,26 +5805,8 @@ async function sendSignInLinkToEmail(auth, email, actionCodeSettings) {
|
|
|
5841
5805
|
_setActionCodeSettingsOnRequest(authInternal, request, actionCodeSettings);
|
|
5842
5806
|
}
|
|
5843
5807
|
}
|
|
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
|
-
}
|
|
5808
|
+
setActionCodeSettings(request, actionCodeSettings);
|
|
5809
|
+
await handleRecaptchaFlow(authInternal, request, "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */, sendSignInLinkToEmail$1);
|
|
5864
5810
|
}
|
|
5865
5811
|
/**
|
|
5866
5812
|
* Checks if an incoming link is a sign-in with email link suitable for {@link signInWithEmailLink}.
|
|
@@ -10220,7 +10166,7 @@ function _isEmptyString(input) {
|
|
|
10220
10166
|
}
|
|
10221
10167
|
|
|
10222
10168
|
var name = "@firebase/auth";
|
|
10223
|
-
var version = "1.3.0-canary.
|
|
10169
|
+
var version = "1.3.0-canary.3533b32b1";
|
|
10224
10170
|
|
|
10225
10171
|
/**
|
|
10226
10172
|
* @license
|
|
@@ -10546,4 +10492,4 @@ exports.useDeviceLanguage = useDeviceLanguage;
|
|
|
10546
10492
|
exports.validatePassword = validatePassword;
|
|
10547
10493
|
exports.verifyBeforeUpdateEmail = verifyBeforeUpdateEmail;
|
|
10548
10494
|
exports.verifyPasswordResetCode = verifyPasswordResetCode;
|
|
10549
|
-
//# sourceMappingURL=index-
|
|
10495
|
+
//# sourceMappingURL=index-b307b714.js.map
|