@firebase/auth 1.1.0 → 1.2.0-canary.78d2738c2
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/README.md +28 -1
- package/dist/auth-public.d.ts +119 -0
- package/dist/auth.d.ts +179 -2
- package/dist/browser-cjs/{index-0b2238be.js → index-86319583.js} +566 -278
- package/dist/browser-cjs/index-86319583.js.map +1 -0
- package/dist/browser-cjs/index.js +3 -2
- package/dist/browser-cjs/index.js.map +1 -1
- package/dist/browser-cjs/internal.js +3 -2
- package/dist/browser-cjs/internal.js.map +1 -1
- package/dist/browser-cjs/src/api/errors.d.ts +2 -1
- package/dist/browser-cjs/src/api/index.d.ts +2 -1
- package/dist/browser-cjs/src/api/password_policy/get_password_policy.d.ts +48 -0
- package/dist/browser-cjs/src/api/password_policy/get_password_policy.test.d.ts +17 -0
- package/dist/browser-cjs/src/core/auth/auth_impl.d.ts +8 -2
- package/dist/browser-cjs/src/core/auth/password_policy_impl.d.ts +59 -0
- package/dist/browser-cjs/src/core/auth/password_policy_impl.test.d.ts +17 -0
- package/dist/browser-cjs/src/core/errors.d.ts +3 -1
- package/dist/browser-cjs/src/core/index.d.ts +25 -1
- package/dist/browser-cjs/src/model/auth.d.ts +7 -2
- package/dist/browser-cjs/src/model/password_policy.d.ts +111 -0
- package/dist/browser-cjs/src/model/public_types.d.ts +88 -0
- package/dist/browser-cjs/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +1 -0
- package/dist/browser-cjs/src/platform_node/index.d.ts +1 -0
- package/dist/browser-cjs/test/helpers/integration/helpers.d.ts +7 -1
- package/dist/browser-cjs/test/integration/flows/password_policy.test.d.ts +17 -0
- package/dist/cordova/index.js +2 -2
- package/dist/cordova/internal.js +2 -2
- package/dist/cordova/{popup_redirect-71c1ff0a.js → popup_redirect-4fa20060.js} +754 -416
- package/dist/cordova/popup_redirect-4fa20060.js.map +1 -0
- package/dist/cordova/src/api/errors.d.ts +2 -1
- package/dist/cordova/src/api/index.d.ts +2 -1
- package/dist/cordova/src/api/password_policy/get_password_policy.d.ts +48 -0
- package/dist/cordova/src/api/password_policy/get_password_policy.test.d.ts +17 -0
- package/dist/cordova/src/core/auth/auth_impl.d.ts +8 -2
- package/dist/cordova/src/core/auth/password_policy_impl.d.ts +59 -0
- package/dist/cordova/src/core/auth/password_policy_impl.test.d.ts +17 -0
- package/dist/cordova/src/core/errors.d.ts +3 -1
- package/dist/cordova/src/core/index.d.ts +25 -1
- package/dist/cordova/src/model/auth.d.ts +7 -2
- package/dist/cordova/src/model/password_policy.d.ts +111 -0
- package/dist/cordova/src/model/public_types.d.ts +88 -0
- package/dist/cordova/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +1 -0
- package/dist/cordova/src/platform_node/index.d.ts +1 -0
- package/dist/cordova/test/helpers/integration/helpers.d.ts +7 -1
- package/dist/cordova/test/integration/flows/password_policy.test.d.ts +17 -0
- package/dist/esm2017/{index-e24386e7.js → index-0a61cd84.js} +566 -279
- package/dist/esm2017/index-0a61cd84.js.map +1 -0
- package/dist/esm2017/index.js +2 -2
- package/dist/esm2017/internal.js +3 -3
- package/dist/esm2017/src/api/errors.d.ts +2 -1
- package/dist/esm2017/src/api/index.d.ts +2 -1
- package/dist/esm2017/src/api/password_policy/get_password_policy.d.ts +48 -0
- package/dist/esm2017/src/api/password_policy/get_password_policy.test.d.ts +17 -0
- package/dist/esm2017/src/core/auth/auth_impl.d.ts +8 -2
- package/dist/esm2017/src/core/auth/password_policy_impl.d.ts +59 -0
- package/dist/esm2017/src/core/auth/password_policy_impl.test.d.ts +17 -0
- package/dist/esm2017/src/core/errors.d.ts +3 -1
- package/dist/esm2017/src/core/index.d.ts +25 -1
- package/dist/esm2017/src/model/auth.d.ts +7 -2
- package/dist/esm2017/src/model/password_policy.d.ts +111 -0
- package/dist/esm2017/src/model/public_types.d.ts +88 -0
- package/dist/esm2017/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +1 -0
- package/dist/esm2017/src/platform_node/index.d.ts +1 -0
- package/dist/esm2017/test/helpers/integration/helpers.d.ts +7 -1
- package/dist/esm2017/test/integration/flows/password_policy.test.d.ts +17 -0
- package/dist/esm5/{index-be7bff78.js → index-e3004618.js} +754 -416
- package/dist/esm5/index-e3004618.js.map +1 -0
- package/dist/esm5/index.js +1 -1
- package/dist/esm5/internal.js +2 -2
- package/dist/esm5/src/api/errors.d.ts +2 -1
- package/dist/esm5/src/api/index.d.ts +2 -1
- package/dist/esm5/src/api/password_policy/get_password_policy.d.ts +48 -0
- package/dist/esm5/src/api/password_policy/get_password_policy.test.d.ts +17 -0
- package/dist/esm5/src/core/auth/auth_impl.d.ts +8 -2
- package/dist/esm5/src/core/auth/password_policy_impl.d.ts +59 -0
- package/dist/esm5/src/core/auth/password_policy_impl.test.d.ts +17 -0
- package/dist/esm5/src/core/errors.d.ts +3 -1
- package/dist/esm5/src/core/index.d.ts +25 -1
- package/dist/esm5/src/model/auth.d.ts +7 -2
- package/dist/esm5/src/model/password_policy.d.ts +111 -0
- package/dist/esm5/src/model/public_types.d.ts +88 -0
- package/dist/esm5/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +1 -0
- package/dist/esm5/src/platform_node/index.d.ts +1 -0
- package/dist/esm5/test/helpers/integration/helpers.d.ts +7 -1
- package/dist/esm5/test/integration/flows/password_policy.test.d.ts +17 -0
- package/dist/index.webworker.esm5.js +828 -490
- package/dist/index.webworker.esm5.js.map +1 -1
- package/dist/node/index.js +2 -1
- package/dist/node/index.js.map +1 -1
- package/dist/node/internal.js +2 -1
- package/dist/node/internal.js.map +1 -1
- package/dist/node/src/api/errors.d.ts +2 -1
- package/dist/node/src/api/index.d.ts +2 -1
- package/dist/node/src/api/password_policy/get_password_policy.d.ts +48 -0
- package/dist/node/src/api/password_policy/get_password_policy.test.d.ts +17 -0
- package/dist/node/src/core/auth/auth_impl.d.ts +8 -2
- package/dist/node/src/core/auth/password_policy_impl.d.ts +59 -0
- package/dist/node/src/core/auth/password_policy_impl.test.d.ts +17 -0
- package/dist/node/src/core/errors.d.ts +3 -1
- package/dist/node/src/core/index.d.ts +25 -1
- package/dist/node/src/model/auth.d.ts +7 -2
- package/dist/node/src/model/password_policy.d.ts +111 -0
- package/dist/node/src/model/public_types.d.ts +88 -0
- package/dist/node/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +1 -0
- package/dist/node/src/platform_node/index.d.ts +1 -0
- package/dist/node/test/helpers/integration/helpers.d.ts +7 -1
- package/dist/node/test/integration/flows/password_policy.test.d.ts +17 -0
- package/dist/node/{totp-8a876b1a.js → totp-6f13b95f.js} +717 -378
- package/dist/node/totp-6f13b95f.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/errors.d.ts +2 -1
- package/dist/node-esm/src/api/index.d.ts +2 -1
- package/dist/node-esm/src/api/password_policy/get_password_policy.d.ts +48 -0
- package/dist/node-esm/src/api/password_policy/get_password_policy.test.d.ts +17 -0
- package/dist/node-esm/src/core/auth/auth_impl.d.ts +8 -2
- package/dist/node-esm/src/core/auth/password_policy_impl.d.ts +59 -0
- package/dist/node-esm/src/core/auth/password_policy_impl.test.d.ts +17 -0
- package/dist/node-esm/src/core/errors.d.ts +3 -1
- package/dist/node-esm/src/core/index.d.ts +25 -1
- package/dist/node-esm/src/model/auth.d.ts +7 -2
- package/dist/node-esm/src/model/password_policy.d.ts +111 -0
- package/dist/node-esm/src/model/public_types.d.ts +88 -0
- package/dist/node-esm/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +1 -0
- package/dist/node-esm/src/platform_node/index.d.ts +1 -0
- package/dist/node-esm/test/helpers/integration/helpers.d.ts +7 -1
- package/dist/node-esm/test/integration/flows/password_policy.test.d.ts +17 -0
- package/dist/node-esm/{totp-04ac595e.js → totp-3d18bd9e.js} +554 -267
- package/dist/node-esm/totp-3d18bd9e.js.map +1 -0
- package/dist/rn/index.js +2 -1
- package/dist/rn/index.js.map +1 -1
- package/dist/rn/internal.js +2 -1
- package/dist/rn/internal.js.map +1 -1
- package/dist/rn/{phone-2132481b.js → phone-e617de09.js} +734 -395
- package/dist/rn/phone-e617de09.js.map +1 -0
- package/dist/rn/src/api/errors.d.ts +2 -1
- package/dist/rn/src/api/index.d.ts +2 -1
- package/dist/rn/src/api/password_policy/get_password_policy.d.ts +48 -0
- package/dist/rn/src/api/password_policy/get_password_policy.test.d.ts +17 -0
- package/dist/rn/src/core/auth/auth_impl.d.ts +8 -2
- package/dist/rn/src/core/auth/password_policy_impl.d.ts +59 -0
- package/dist/rn/src/core/auth/password_policy_impl.test.d.ts +17 -0
- package/dist/rn/src/core/errors.d.ts +3 -1
- package/dist/rn/src/core/index.d.ts +25 -1
- package/dist/rn/src/model/auth.d.ts +7 -2
- package/dist/rn/src/model/password_policy.d.ts +111 -0
- package/dist/rn/src/model/public_types.d.ts +88 -0
- package/dist/rn/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +1 -0
- package/dist/rn/src/platform_node/index.d.ts +1 -0
- package/dist/rn/test/helpers/integration/helpers.d.ts +7 -1
- package/dist/rn/test/integration/flows/password_policy.test.d.ts +17 -0
- package/dist/src/api/errors.d.ts +2 -1
- package/dist/src/api/index.d.ts +2 -1
- package/dist/src/api/password_policy/get_password_policy.d.ts +48 -0
- package/dist/src/api/password_policy/get_password_policy.test.d.ts +17 -0
- package/dist/src/core/auth/auth_impl.d.ts +8 -2
- package/dist/src/core/auth/password_policy_impl.d.ts +59 -0
- package/dist/src/core/auth/password_policy_impl.test.d.ts +17 -0
- package/dist/src/core/errors.d.ts +3 -1
- package/dist/src/core/index.d.ts +25 -1
- package/dist/src/model/auth.d.ts +7 -2
- package/dist/src/model/password_policy.d.ts +111 -0
- package/dist/src/model/public_types.d.ts +88 -0
- package/dist/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +1 -0
- package/dist/src/platform_node/index.d.ts +1 -0
- package/dist/test/helpers/integration/helpers.d.ts +7 -1
- package/dist/test/integration/flows/password_policy.test.d.ts +17 -0
- package/package.json +6 -6
- package/dist/browser-cjs/index-0b2238be.js.map +0 -1
- package/dist/cordova/popup_redirect-71c1ff0a.js.map +0 -1
- package/dist/esm2017/index-e24386e7.js.map +0 -1
- package/dist/esm5/index-be7bff78.js.map +0 -1
- package/dist/node/totp-8a876b1a.js.map +0 -1
- package/dist/node-esm/totp-04ac595e.js.map +0 -1
- package/dist/rn/phone-2132481b.js.map +0 -1
|
@@ -176,6 +176,8 @@ function _debugErrorMap() {
|
|
|
176
176
|
_a["missing-recaptcha-version" /* AuthErrorCode.MISSING_RECAPTCHA_VERSION */] = 'The reCAPTCHA version is missing when sending request to the backend.',
|
|
177
177
|
_a["invalid-req-type" /* AuthErrorCode.INVALID_REQ_TYPE */] = 'Invalid request parameters.',
|
|
178
178
|
_a["invalid-recaptcha-version" /* AuthErrorCode.INVALID_RECAPTCHA_VERSION */] = 'The reCAPTCHA version is invalid when sending request to the backend.',
|
|
179
|
+
_a["unsupported-password-policy-schema-version" /* AuthErrorCode.UNSUPPORTED_PASSWORD_POLICY_SCHEMA_VERSION */] = 'The password policy received from the backend uses a schema version that is not supported by this version of the Firebase SDK.',
|
|
180
|
+
_a["password-does-not-meet-requirements" /* AuthErrorCode.PASSWORD_DOES_NOT_MEET_REQUIREMENTS */] = 'The password does not meet the requirements.',
|
|
179
181
|
_a;
|
|
180
182
|
}
|
|
181
183
|
function _prodErrorMap() {
|
|
@@ -549,7 +551,7 @@ function _initializeAuthInstance(auth, deps) {
|
|
|
549
551
|
}
|
|
550
552
|
|
|
551
553
|
var name = "@firebase/auth";
|
|
552
|
-
var version = "1.
|
|
554
|
+
var version = "1.2.0-canary.78d2738c2";
|
|
553
555
|
|
|
554
556
|
/**
|
|
555
557
|
* @license
|
|
@@ -955,6 +957,7 @@ var SERVER_ERROR_MAP = (_a$1 = {},
|
|
|
955
957
|
_a$1["USER_NOT_FOUND" /* ServerError.USER_NOT_FOUND */] = "user-token-expired" /* AuthErrorCode.TOKEN_EXPIRED */,
|
|
956
958
|
// Other errors.
|
|
957
959
|
_a$1["TOO_MANY_ATTEMPTS_TRY_LATER" /* ServerError.TOO_MANY_ATTEMPTS_TRY_LATER */] = "too-many-requests" /* AuthErrorCode.TOO_MANY_ATTEMPTS_TRY_LATER */,
|
|
960
|
+
_a$1["PASSWORD_DOES_NOT_MEET_REQUIREMENTS" /* ServerError.PASSWORD_DOES_NOT_MEET_REQUIREMENTS */] = "password-does-not-meet-requirements" /* AuthErrorCode.PASSWORD_DOES_NOT_MEET_REQUIREMENTS */,
|
|
958
961
|
// Phone Auth related errors.
|
|
959
962
|
_a$1["INVALID_CODE" /* ServerError.INVALID_CODE */] = "invalid-verification-code" /* AuthErrorCode.INVALID_CODE */,
|
|
960
963
|
_a$1["INVALID_SESSION_INFO" /* ServerError.INVALID_SESSION_INFO */] = "invalid-verification-id" /* AuthErrorCode.INVALID_SESSION_INFO */,
|
|
@@ -2367,7 +2370,7 @@ var PersistenceUserManager = /** @class */ (function () {
|
|
|
2367
2370
|
|
|
2368
2371
|
/**
|
|
2369
2372
|
* @license
|
|
2370
|
-
* Copyright
|
|
2373
|
+
* Copyright 2022 Google LLC
|
|
2371
2374
|
*
|
|
2372
2375
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2373
2376
|
* you may not use this file except in compliance with the License.
|
|
@@ -2381,17 +2384,97 @@ var PersistenceUserManager = /** @class */ (function () {
|
|
|
2381
2384
|
* See the License for the specific language governing permissions and
|
|
2382
2385
|
* limitations under the License.
|
|
2383
2386
|
*/
|
|
2384
|
-
function
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2387
|
+
var AuthMiddlewareQueue = /** @class */ (function () {
|
|
2388
|
+
function AuthMiddlewareQueue(auth) {
|
|
2389
|
+
this.auth = auth;
|
|
2390
|
+
this.queue = [];
|
|
2391
|
+
}
|
|
2392
|
+
AuthMiddlewareQueue.prototype.pushCallback = function (callback, onAbort) {
|
|
2393
|
+
var _this = this;
|
|
2394
|
+
// The callback could be sync or async. Wrap it into a
|
|
2395
|
+
// function that is always async.
|
|
2396
|
+
var wrappedCallback = function (user) {
|
|
2397
|
+
return new Promise(function (resolve, reject) {
|
|
2398
|
+
try {
|
|
2399
|
+
var result = callback(user);
|
|
2400
|
+
// Either resolve with existing promise or wrap a non-promise
|
|
2401
|
+
// return value into a promise.
|
|
2402
|
+
resolve(result);
|
|
2403
|
+
}
|
|
2404
|
+
catch (e) {
|
|
2405
|
+
// Sync callback throws.
|
|
2406
|
+
reject(e);
|
|
2407
|
+
}
|
|
2408
|
+
});
|
|
2409
|
+
};
|
|
2410
|
+
// Attach the onAbort if present
|
|
2411
|
+
wrappedCallback.onAbort = onAbort;
|
|
2412
|
+
this.queue.push(wrappedCallback);
|
|
2413
|
+
var index = this.queue.length - 1;
|
|
2414
|
+
return function () {
|
|
2415
|
+
// Unsubscribe. Replace with no-op. Do not remove from array, or it will disturb
|
|
2416
|
+
// indexing of other elements.
|
|
2417
|
+
_this.queue[index] = function () { return Promise.resolve(); };
|
|
2418
|
+
};
|
|
2419
|
+
};
|
|
2420
|
+
AuthMiddlewareQueue.prototype.runMiddleware = function (nextUser) {
|
|
2421
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2422
|
+
var onAbortStack, _i, _a, beforeStateCallback, e_1, _b, onAbortStack_1, onAbort;
|
|
2423
|
+
return __generator(this, function (_c) {
|
|
2424
|
+
switch (_c.label) {
|
|
2425
|
+
case 0:
|
|
2426
|
+
if (this.auth.currentUser === nextUser) {
|
|
2427
|
+
return [2 /*return*/];
|
|
2428
|
+
}
|
|
2429
|
+
onAbortStack = [];
|
|
2430
|
+
_c.label = 1;
|
|
2431
|
+
case 1:
|
|
2432
|
+
_c.trys.push([1, 6, , 7]);
|
|
2433
|
+
_i = 0, _a = this.queue;
|
|
2434
|
+
_c.label = 2;
|
|
2435
|
+
case 2:
|
|
2436
|
+
if (!(_i < _a.length)) return [3 /*break*/, 5];
|
|
2437
|
+
beforeStateCallback = _a[_i];
|
|
2438
|
+
return [4 /*yield*/, beforeStateCallback(nextUser)];
|
|
2439
|
+
case 3:
|
|
2440
|
+
_c.sent();
|
|
2441
|
+
// Only push the onAbort if the callback succeeds
|
|
2442
|
+
if (beforeStateCallback.onAbort) {
|
|
2443
|
+
onAbortStack.push(beforeStateCallback.onAbort);
|
|
2444
|
+
}
|
|
2445
|
+
_c.label = 4;
|
|
2446
|
+
case 4:
|
|
2447
|
+
_i++;
|
|
2448
|
+
return [3 /*break*/, 2];
|
|
2449
|
+
case 5: return [3 /*break*/, 7];
|
|
2450
|
+
case 6:
|
|
2451
|
+
e_1 = _c.sent();
|
|
2452
|
+
// Run all onAbort, with separate try/catch to ignore any errors and
|
|
2453
|
+
// continue
|
|
2454
|
+
onAbortStack.reverse();
|
|
2455
|
+
for (_b = 0, onAbortStack_1 = onAbortStack; _b < onAbortStack_1.length; _b++) {
|
|
2456
|
+
onAbort = onAbortStack_1[_b];
|
|
2457
|
+
try {
|
|
2458
|
+
onAbort();
|
|
2459
|
+
}
|
|
2460
|
+
catch (_) {
|
|
2461
|
+
/* swallow error */
|
|
2462
|
+
}
|
|
2463
|
+
}
|
|
2464
|
+
throw this.auth._errorFactory.create("login-blocked" /* AuthErrorCode.LOGIN_BLOCKED */, {
|
|
2465
|
+
originalMessage: e_1 === null || e_1 === void 0 ? void 0 : e_1.message
|
|
2466
|
+
});
|
|
2467
|
+
case 7: return [2 /*return*/];
|
|
2468
|
+
}
|
|
2469
|
+
});
|
|
2388
2470
|
});
|
|
2389
|
-
}
|
|
2390
|
-
|
|
2471
|
+
};
|
|
2472
|
+
return AuthMiddlewareQueue;
|
|
2473
|
+
}());
|
|
2391
2474
|
|
|
2392
2475
|
/**
|
|
2393
2476
|
* @license
|
|
2394
|
-
* Copyright
|
|
2477
|
+
* Copyright 2023 Google LLC
|
|
2395
2478
|
*
|
|
2396
2479
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2397
2480
|
* you may not use this file except in compliance with the License.
|
|
@@ -2405,36 +2488,25 @@ function getRecaptchaConfig(auth, request) {
|
|
|
2405
2488
|
* See the License for the specific language governing permissions and
|
|
2406
2489
|
* limitations under the License.
|
|
2407
2490
|
*/
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
*/
|
|
2421
|
-
this.emailPasswordEnabled = false;
|
|
2422
|
-
if (response.recaptchaKey === undefined) {
|
|
2423
|
-
throw new Error('recaptchaKey undefined');
|
|
2424
|
-
}
|
|
2425
|
-
// Example response.recaptchaKey: "projects/proj123/keys/sitekey123"
|
|
2426
|
-
this.siteKey = response.recaptchaKey.split('/')[3];
|
|
2427
|
-
this.emailPasswordEnabled = response.recaptchaEnforcementState.some(function (enforcementState) {
|
|
2428
|
-
return enforcementState.provider === 'EMAIL_PASSWORD_PROVIDER' &&
|
|
2429
|
-
enforcementState.enforcementState !== 'OFF';
|
|
2491
|
+
/**
|
|
2492
|
+
* Fetches the password policy for the currently set tenant or the project if no tenant is set.
|
|
2493
|
+
*
|
|
2494
|
+
* @param auth Auth object.
|
|
2495
|
+
* @param request Password policy request.
|
|
2496
|
+
* @returns Password policy response.
|
|
2497
|
+
*/
|
|
2498
|
+
function _getPasswordPolicy(auth, request) {
|
|
2499
|
+
if (request === void 0) { request = {}; }
|
|
2500
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2501
|
+
return __generator(this, function (_a) {
|
|
2502
|
+
return [2 /*return*/, _performApiRequest(auth, "GET" /* HttpMethod.GET */, "/v2/passwordPolicy" /* Endpoint.GET_PASSWORD_POLICY */, _addTidIfNecessary(auth, request))];
|
|
2430
2503
|
});
|
|
2431
|
-
}
|
|
2432
|
-
|
|
2433
|
-
}());
|
|
2504
|
+
});
|
|
2505
|
+
}
|
|
2434
2506
|
|
|
2435
2507
|
/**
|
|
2436
2508
|
* @license
|
|
2437
|
-
* Copyright
|
|
2509
|
+
* Copyright 2023 Google LLC
|
|
2438
2510
|
*
|
|
2439
2511
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2440
2512
|
* you may not use this file except in compliance with the License.
|
|
@@ -2448,286 +2520,138 @@ var RecaptchaConfig = /** @class */ (function () {
|
|
|
2448
2520
|
* See the License for the specific language governing permissions and
|
|
2449
2521
|
* limitations under the License.
|
|
2450
2522
|
*/
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2523
|
+
// Minimum min password length enforced by the backend, even if no minimum length is set.
|
|
2524
|
+
var MINIMUM_MIN_PASSWORD_LENGTH = 6;
|
|
2525
|
+
/**
|
|
2526
|
+
* Stores password policy requirements and provides password validation against the policy.
|
|
2527
|
+
*
|
|
2528
|
+
* @internal
|
|
2529
|
+
*/
|
|
2530
|
+
var PasswordPolicyImpl = /** @class */ (function () {
|
|
2531
|
+
function PasswordPolicyImpl(response) {
|
|
2532
|
+
var _a, _b, _c, _d;
|
|
2533
|
+
// Only include custom strength options defined in the response.
|
|
2534
|
+
var responseOptions = response.customStrengthOptions;
|
|
2535
|
+
this.customStrengthOptions = {};
|
|
2536
|
+
// TODO: Remove once the backend is updated to include the minimum min password length instead of undefined when there is no minimum length set.
|
|
2537
|
+
this.customStrengthOptions.minPasswordLength =
|
|
2538
|
+
(_a = responseOptions.minPasswordLength) !== null && _a !== void 0 ? _a : MINIMUM_MIN_PASSWORD_LENGTH;
|
|
2539
|
+
if (responseOptions.maxPasswordLength) {
|
|
2540
|
+
this.customStrengthOptions.maxPasswordLength =
|
|
2541
|
+
responseOptions.maxPasswordLength;
|
|
2542
|
+
}
|
|
2543
|
+
if (responseOptions.containsLowercaseCharacter !== undefined) {
|
|
2544
|
+
this.customStrengthOptions.containsLowercaseLetter =
|
|
2545
|
+
responseOptions.containsLowercaseCharacter;
|
|
2546
|
+
}
|
|
2547
|
+
if (responseOptions.containsUppercaseCharacter !== undefined) {
|
|
2548
|
+
this.customStrengthOptions.containsUppercaseLetter =
|
|
2549
|
+
responseOptions.containsUppercaseCharacter;
|
|
2550
|
+
}
|
|
2551
|
+
if (responseOptions.containsNumericCharacter !== undefined) {
|
|
2552
|
+
this.customStrengthOptions.containsNumericCharacter =
|
|
2553
|
+
responseOptions.containsNumericCharacter;
|
|
2554
|
+
}
|
|
2555
|
+
if (responseOptions.containsNonAlphanumericCharacter !== undefined) {
|
|
2556
|
+
this.customStrengthOptions.containsNonAlphanumericCharacter =
|
|
2557
|
+
responseOptions.containsNonAlphanumericCharacter;
|
|
2558
|
+
}
|
|
2559
|
+
this.enforcementState = response.enforcementState;
|
|
2560
|
+
if (this.enforcementState === 'ENFORCEMENT_STATE_UNSPECIFIED') {
|
|
2561
|
+
this.enforcementState = 'OFF';
|
|
2562
|
+
}
|
|
2563
|
+
// Use an empty string if no non-alphanumeric characters are specified in the response.
|
|
2564
|
+
this.allowedNonAlphanumericCharacters =
|
|
2565
|
+
(_c = (_b = response.allowedNonAlphanumericCharacters) === null || _b === void 0 ? void 0 : _b.join('')) !== null && _c !== void 0 ? _c : '';
|
|
2566
|
+
this.forceUpgradeOnSignin = (_d = response.forceUpgradeOnSignin) !== null && _d !== void 0 ? _d : false;
|
|
2567
|
+
this.schemaVersion = response.schemaVersion;
|
|
2568
|
+
}
|
|
2569
|
+
PasswordPolicyImpl.prototype.validatePassword = function (password) {
|
|
2570
|
+
var _a, _b, _c, _d, _e, _f;
|
|
2571
|
+
var status = {
|
|
2572
|
+
isValid: true,
|
|
2573
|
+
passwordPolicy: this
|
|
2465
2574
|
};
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2575
|
+
// Check the password length and character options.
|
|
2576
|
+
this.validatePasswordLengthOptions(password, status);
|
|
2577
|
+
this.validatePasswordCharacterOptions(password, status);
|
|
2578
|
+
// Combine the status into single isValid property.
|
|
2579
|
+
status.isValid && (status.isValid = (_a = status.meetsMinPasswordLength) !== null && _a !== void 0 ? _a : true);
|
|
2580
|
+
status.isValid && (status.isValid = (_b = status.meetsMaxPasswordLength) !== null && _b !== void 0 ? _b : true);
|
|
2581
|
+
status.isValid && (status.isValid = (_c = status.containsLowercaseLetter) !== null && _c !== void 0 ? _c : true);
|
|
2582
|
+
status.isValid && (status.isValid = (_d = status.containsUppercaseLetter) !== null && _d !== void 0 ? _d : true);
|
|
2583
|
+
status.isValid && (status.isValid = (_e = status.containsNumericCharacter) !== null && _e !== void 0 ? _e : true);
|
|
2584
|
+
status.isValid && (status.isValid = (_f = status.containsNonAlphanumericCharacter) !== null && _f !== void 0 ? _f : true);
|
|
2585
|
+
return status;
|
|
2586
|
+
};
|
|
2477
2587
|
/**
|
|
2588
|
+
* Validates that the password meets the length options for the policy.
|
|
2478
2589
|
*
|
|
2479
|
-
* @param
|
|
2590
|
+
* @param password Password to validate.
|
|
2591
|
+
* @param status Validation status.
|
|
2592
|
+
*/
|
|
2593
|
+
PasswordPolicyImpl.prototype.validatePasswordLengthOptions = function (password, status) {
|
|
2594
|
+
var minPasswordLength = this.customStrengthOptions.minPasswordLength;
|
|
2595
|
+
var maxPasswordLength = this.customStrengthOptions.maxPasswordLength;
|
|
2596
|
+
if (minPasswordLength) {
|
|
2597
|
+
status.meetsMinPasswordLength = password.length >= minPasswordLength;
|
|
2598
|
+
}
|
|
2599
|
+
if (maxPasswordLength) {
|
|
2600
|
+
status.meetsMaxPasswordLength = password.length <= maxPasswordLength;
|
|
2601
|
+
}
|
|
2602
|
+
};
|
|
2603
|
+
/**
|
|
2604
|
+
* Validates that the password meets the character options for the policy.
|
|
2480
2605
|
*
|
|
2606
|
+
* @param password Password to validate.
|
|
2607
|
+
* @param status Validation status.
|
|
2481
2608
|
*/
|
|
2482
|
-
function
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2609
|
+
PasswordPolicyImpl.prototype.validatePasswordCharacterOptions = function (password, status) {
|
|
2610
|
+
// Assign statuses for requirements even if the password is an empty string.
|
|
2611
|
+
this.updatePasswordCharacterOptionsStatuses(status,
|
|
2612
|
+
/* containsLowercaseCharacter= */ false,
|
|
2613
|
+
/* containsUppercaseCharacter= */ false,
|
|
2614
|
+
/* containsNumericCharacter= */ false,
|
|
2615
|
+
/* containsNonAlphanumericCharacter= */ false);
|
|
2616
|
+
var passwordChar;
|
|
2617
|
+
for (var i = 0; i < password.length; i++) {
|
|
2618
|
+
passwordChar = password.charAt(i);
|
|
2619
|
+
this.updatePasswordCharacterOptionsStatuses(status,
|
|
2620
|
+
/* containsLowercaseCharacter= */ passwordChar >= 'a' &&
|
|
2621
|
+
passwordChar <= 'z',
|
|
2622
|
+
/* containsUppercaseCharacter= */ passwordChar >= 'A' &&
|
|
2623
|
+
passwordChar <= 'Z',
|
|
2624
|
+
/* containsNumericCharacter= */ passwordChar >= '0' &&
|
|
2625
|
+
passwordChar <= '9',
|
|
2626
|
+
/* containsNonAlphanumericCharacter= */ this.allowedNonAlphanumericCharacters.includes(passwordChar));
|
|
2627
|
+
}
|
|
2628
|
+
};
|
|
2489
2629
|
/**
|
|
2490
|
-
*
|
|
2630
|
+
* Updates the running validation status with the statuses for the character options.
|
|
2631
|
+
* Expected to be called each time a character is processed to update each option status
|
|
2632
|
+
* based on the current character.
|
|
2491
2633
|
*
|
|
2492
|
-
* @
|
|
2634
|
+
* @param status Validation status.
|
|
2635
|
+
* @param containsLowercaseCharacter Whether the character is a lowercase letter.
|
|
2636
|
+
* @param containsUppercaseCharacter Whether the character is an uppercase letter.
|
|
2637
|
+
* @param containsNumericCharacter Whether the character is a numeric character.
|
|
2638
|
+
* @param containsNonAlphanumericCharacter Whether the character is a non-alphanumeric character.
|
|
2493
2639
|
*/
|
|
2494
|
-
|
|
2495
|
-
if (
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
auth._tenantRecaptchaConfigs[auth.tenantId] !== undefined) {
|
|
2508
|
-
return [2 /*return*/, auth._tenantRecaptchaConfigs[auth.tenantId].siteKey];
|
|
2509
|
-
}
|
|
2510
|
-
}
|
|
2511
|
-
return [2 /*return*/, new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
|
|
2512
|
-
return __generator(this, function (_a) {
|
|
2513
|
-
getRecaptchaConfig(auth, {
|
|
2514
|
-
clientType: "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */,
|
|
2515
|
-
version: "RECAPTCHA_ENTERPRISE" /* RecaptchaVersion.ENTERPRISE */
|
|
2516
|
-
})
|
|
2517
|
-
.then(function (response) {
|
|
2518
|
-
if (response.recaptchaKey === undefined) {
|
|
2519
|
-
reject(new Error('recaptcha Enterprise site key undefined'));
|
|
2520
|
-
}
|
|
2521
|
-
else {
|
|
2522
|
-
var config = new RecaptchaConfig(response);
|
|
2523
|
-
if (auth.tenantId == null) {
|
|
2524
|
-
auth._agentRecaptchaConfig = config;
|
|
2525
|
-
}
|
|
2526
|
-
else {
|
|
2527
|
-
auth._tenantRecaptchaConfigs[auth.tenantId] = config;
|
|
2528
|
-
}
|
|
2529
|
-
return resolve(config.siteKey);
|
|
2530
|
-
}
|
|
2531
|
-
})
|
|
2532
|
-
.catch(function (error) {
|
|
2533
|
-
reject(error);
|
|
2534
|
-
});
|
|
2535
|
-
return [2 /*return*/];
|
|
2536
|
-
});
|
|
2537
|
-
}); })];
|
|
2538
|
-
});
|
|
2539
|
-
});
|
|
2540
|
-
}
|
|
2541
|
-
function retrieveRecaptchaToken(siteKey, resolve, reject) {
|
|
2542
|
-
var grecaptcha = window.grecaptcha;
|
|
2543
|
-
if (isEnterprise(grecaptcha)) {
|
|
2544
|
-
grecaptcha.enterprise.ready(function () {
|
|
2545
|
-
grecaptcha.enterprise
|
|
2546
|
-
.execute(siteKey, { action: action })
|
|
2547
|
-
.then(function (token) {
|
|
2548
|
-
resolve(token);
|
|
2549
|
-
})
|
|
2550
|
-
.catch(function () {
|
|
2551
|
-
resolve(FAKE_TOKEN);
|
|
2552
|
-
});
|
|
2553
|
-
});
|
|
2554
|
-
}
|
|
2555
|
-
else {
|
|
2556
|
-
reject(Error('No reCAPTCHA enterprise script loaded.'));
|
|
2557
|
-
}
|
|
2558
|
-
}
|
|
2559
|
-
var _this = this;
|
|
2560
|
-
return __generator(this, function (_a) {
|
|
2561
|
-
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
2562
|
-
retrieveSiteKey(_this.auth)
|
|
2563
|
-
.then(function (siteKey) {
|
|
2564
|
-
if (!forceRefresh && isEnterprise(window.grecaptcha)) {
|
|
2565
|
-
retrieveRecaptchaToken(siteKey, resolve, reject);
|
|
2566
|
-
}
|
|
2567
|
-
else {
|
|
2568
|
-
if (typeof window === 'undefined') {
|
|
2569
|
-
reject(new Error('RecaptchaVerifier is only supported in browser'));
|
|
2570
|
-
return;
|
|
2571
|
-
}
|
|
2572
|
-
_loadJS(RECAPTCHA_ENTERPRISE_URL + siteKey)
|
|
2573
|
-
.then(function () {
|
|
2574
|
-
retrieveRecaptchaToken(siteKey, resolve, reject);
|
|
2575
|
-
})
|
|
2576
|
-
.catch(function (error) {
|
|
2577
|
-
reject(error);
|
|
2578
|
-
});
|
|
2579
|
-
}
|
|
2580
|
-
})
|
|
2581
|
-
.catch(function (error) {
|
|
2582
|
-
reject(error);
|
|
2583
|
-
});
|
|
2584
|
-
})];
|
|
2585
|
-
});
|
|
2586
|
-
});
|
|
2587
|
-
};
|
|
2588
|
-
return RecaptchaEnterpriseVerifier;
|
|
2589
|
-
}());
|
|
2590
|
-
function injectRecaptchaFields(auth, request, action, captchaResp) {
|
|
2591
|
-
if (captchaResp === void 0) { captchaResp = false; }
|
|
2592
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
2593
|
-
var verifier, captchaResponse, newRequest;
|
|
2594
|
-
return __generator(this, function (_a) {
|
|
2595
|
-
switch (_a.label) {
|
|
2596
|
-
case 0:
|
|
2597
|
-
verifier = new RecaptchaEnterpriseVerifier(auth);
|
|
2598
|
-
_a.label = 1;
|
|
2599
|
-
case 1:
|
|
2600
|
-
_a.trys.push([1, 3, , 5]);
|
|
2601
|
-
return [4 /*yield*/, verifier.verify(action)];
|
|
2602
|
-
case 2:
|
|
2603
|
-
captchaResponse = _a.sent();
|
|
2604
|
-
return [3 /*break*/, 5];
|
|
2605
|
-
case 3:
|
|
2606
|
-
_a.sent();
|
|
2607
|
-
return [4 /*yield*/, verifier.verify(action, true)];
|
|
2608
|
-
case 4:
|
|
2609
|
-
captchaResponse = _a.sent();
|
|
2610
|
-
return [3 /*break*/, 5];
|
|
2611
|
-
case 5:
|
|
2612
|
-
newRequest = __assign({}, request);
|
|
2613
|
-
if (!captchaResp) {
|
|
2614
|
-
Object.assign(newRequest, { captchaResponse: captchaResponse });
|
|
2615
|
-
}
|
|
2616
|
-
else {
|
|
2617
|
-
Object.assign(newRequest, { 'captchaResp': captchaResponse });
|
|
2618
|
-
}
|
|
2619
|
-
Object.assign(newRequest, { 'clientType': "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */ });
|
|
2620
|
-
Object.assign(newRequest, {
|
|
2621
|
-
'recaptchaVersion': "RECAPTCHA_ENTERPRISE" /* RecaptchaVersion.ENTERPRISE */
|
|
2622
|
-
});
|
|
2623
|
-
return [2 /*return*/, newRequest];
|
|
2624
|
-
}
|
|
2625
|
-
});
|
|
2626
|
-
});
|
|
2627
|
-
}
|
|
2628
|
-
|
|
2629
|
-
/**
|
|
2630
|
-
* @license
|
|
2631
|
-
* Copyright 2022 Google LLC
|
|
2632
|
-
*
|
|
2633
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2634
|
-
* you may not use this file except in compliance with the License.
|
|
2635
|
-
* You may obtain a copy of the License at
|
|
2636
|
-
*
|
|
2637
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2638
|
-
*
|
|
2639
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2640
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2641
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2642
|
-
* See the License for the specific language governing permissions and
|
|
2643
|
-
* limitations under the License.
|
|
2644
|
-
*/
|
|
2645
|
-
var AuthMiddlewareQueue = /** @class */ (function () {
|
|
2646
|
-
function AuthMiddlewareQueue(auth) {
|
|
2647
|
-
this.auth = auth;
|
|
2648
|
-
this.queue = [];
|
|
2649
|
-
}
|
|
2650
|
-
AuthMiddlewareQueue.prototype.pushCallback = function (callback, onAbort) {
|
|
2651
|
-
var _this = this;
|
|
2652
|
-
// The callback could be sync or async. Wrap it into a
|
|
2653
|
-
// function that is always async.
|
|
2654
|
-
var wrappedCallback = function (user) {
|
|
2655
|
-
return new Promise(function (resolve, reject) {
|
|
2656
|
-
try {
|
|
2657
|
-
var result = callback(user);
|
|
2658
|
-
// Either resolve with existing promise or wrap a non-promise
|
|
2659
|
-
// return value into a promise.
|
|
2660
|
-
resolve(result);
|
|
2661
|
-
}
|
|
2662
|
-
catch (e) {
|
|
2663
|
-
// Sync callback throws.
|
|
2664
|
-
reject(e);
|
|
2665
|
-
}
|
|
2666
|
-
});
|
|
2667
|
-
};
|
|
2668
|
-
// Attach the onAbort if present
|
|
2669
|
-
wrappedCallback.onAbort = onAbort;
|
|
2670
|
-
this.queue.push(wrappedCallback);
|
|
2671
|
-
var index = this.queue.length - 1;
|
|
2672
|
-
return function () {
|
|
2673
|
-
// Unsubscribe. Replace with no-op. Do not remove from array, or it will disturb
|
|
2674
|
-
// indexing of other elements.
|
|
2675
|
-
_this.queue[index] = function () { return Promise.resolve(); };
|
|
2676
|
-
};
|
|
2677
|
-
};
|
|
2678
|
-
AuthMiddlewareQueue.prototype.runMiddleware = function (nextUser) {
|
|
2679
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
2680
|
-
var onAbortStack, _i, _a, beforeStateCallback, e_1, _b, onAbortStack_1, onAbort;
|
|
2681
|
-
return __generator(this, function (_c) {
|
|
2682
|
-
switch (_c.label) {
|
|
2683
|
-
case 0:
|
|
2684
|
-
if (this.auth.currentUser === nextUser) {
|
|
2685
|
-
return [2 /*return*/];
|
|
2686
|
-
}
|
|
2687
|
-
onAbortStack = [];
|
|
2688
|
-
_c.label = 1;
|
|
2689
|
-
case 1:
|
|
2690
|
-
_c.trys.push([1, 6, , 7]);
|
|
2691
|
-
_i = 0, _a = this.queue;
|
|
2692
|
-
_c.label = 2;
|
|
2693
|
-
case 2:
|
|
2694
|
-
if (!(_i < _a.length)) return [3 /*break*/, 5];
|
|
2695
|
-
beforeStateCallback = _a[_i];
|
|
2696
|
-
return [4 /*yield*/, beforeStateCallback(nextUser)];
|
|
2697
|
-
case 3:
|
|
2698
|
-
_c.sent();
|
|
2699
|
-
// Only push the onAbort if the callback succeeds
|
|
2700
|
-
if (beforeStateCallback.onAbort) {
|
|
2701
|
-
onAbortStack.push(beforeStateCallback.onAbort);
|
|
2702
|
-
}
|
|
2703
|
-
_c.label = 4;
|
|
2704
|
-
case 4:
|
|
2705
|
-
_i++;
|
|
2706
|
-
return [3 /*break*/, 2];
|
|
2707
|
-
case 5: return [3 /*break*/, 7];
|
|
2708
|
-
case 6:
|
|
2709
|
-
e_1 = _c.sent();
|
|
2710
|
-
// Run all onAbort, with separate try/catch to ignore any errors and
|
|
2711
|
-
// continue
|
|
2712
|
-
onAbortStack.reverse();
|
|
2713
|
-
for (_b = 0, onAbortStack_1 = onAbortStack; _b < onAbortStack_1.length; _b++) {
|
|
2714
|
-
onAbort = onAbortStack_1[_b];
|
|
2715
|
-
try {
|
|
2716
|
-
onAbort();
|
|
2717
|
-
}
|
|
2718
|
-
catch (_) {
|
|
2719
|
-
/* swallow error */
|
|
2720
|
-
}
|
|
2721
|
-
}
|
|
2722
|
-
throw this.auth._errorFactory.create("login-blocked" /* AuthErrorCode.LOGIN_BLOCKED */, {
|
|
2723
|
-
originalMessage: e_1 === null || e_1 === void 0 ? void 0 : e_1.message
|
|
2724
|
-
});
|
|
2725
|
-
case 7: return [2 /*return*/];
|
|
2726
|
-
}
|
|
2727
|
-
});
|
|
2728
|
-
});
|
|
2640
|
+
PasswordPolicyImpl.prototype.updatePasswordCharacterOptionsStatuses = function (status, containsLowercaseCharacter, containsUppercaseCharacter, containsNumericCharacter, containsNonAlphanumericCharacter) {
|
|
2641
|
+
if (this.customStrengthOptions.containsLowercaseLetter) {
|
|
2642
|
+
status.containsLowercaseLetter || (status.containsLowercaseLetter = containsLowercaseCharacter);
|
|
2643
|
+
}
|
|
2644
|
+
if (this.customStrengthOptions.containsUppercaseLetter) {
|
|
2645
|
+
status.containsUppercaseLetter || (status.containsUppercaseLetter = containsUppercaseCharacter);
|
|
2646
|
+
}
|
|
2647
|
+
if (this.customStrengthOptions.containsNumericCharacter) {
|
|
2648
|
+
status.containsNumericCharacter || (status.containsNumericCharacter = containsNumericCharacter);
|
|
2649
|
+
}
|
|
2650
|
+
if (this.customStrengthOptions.containsNonAlphanumericCharacter) {
|
|
2651
|
+
status.containsNonAlphanumericCharacter || (status.containsNonAlphanumericCharacter = containsNonAlphanumericCharacter);
|
|
2652
|
+
}
|
|
2729
2653
|
};
|
|
2730
|
-
return
|
|
2654
|
+
return PasswordPolicyImpl;
|
|
2731
2655
|
}());
|
|
2732
2656
|
|
|
2733
2657
|
/**
|
|
@@ -2760,6 +2684,7 @@ var AuthImpl = /** @class */ (function () {
|
|
|
2760
2684
|
this.beforeStateQueue = new AuthMiddlewareQueue(this);
|
|
2761
2685
|
this.redirectUser = null;
|
|
2762
2686
|
this.isProactiveRefreshEnabled = false;
|
|
2687
|
+
this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION = 1;
|
|
2763
2688
|
// Any network calls will set this to true and prevent subsequent emulator
|
|
2764
2689
|
// initialization
|
|
2765
2690
|
this._canInitEmulator = true;
|
|
@@ -2770,6 +2695,8 @@ var AuthImpl = /** @class */ (function () {
|
|
|
2770
2695
|
this._errorFactory = _DEFAULT_AUTH_ERROR_FACTORY;
|
|
2771
2696
|
this._agentRecaptchaConfig = null;
|
|
2772
2697
|
this._tenantRecaptchaConfigs = {};
|
|
2698
|
+
this._projectPasswordPolicy = null;
|
|
2699
|
+
this._tenantPasswordPolicies = {};
|
|
2773
2700
|
// Tracks the last notified UID for state change listeners to prevent
|
|
2774
2701
|
// repeated calls to the callbacks. Undefined means it's never been
|
|
2775
2702
|
// called, whereas null means it's been called with a signed out user
|
|
@@ -3099,41 +3026,66 @@ var AuthImpl = /** @class */ (function () {
|
|
|
3099
3026
|
});
|
|
3100
3027
|
}); });
|
|
3101
3028
|
};
|
|
3102
|
-
AuthImpl.prototype.
|
|
3029
|
+
AuthImpl.prototype._getRecaptchaConfig = function () {
|
|
3030
|
+
if (this.tenantId == null) {
|
|
3031
|
+
return this._agentRecaptchaConfig;
|
|
3032
|
+
}
|
|
3033
|
+
else {
|
|
3034
|
+
return this._tenantRecaptchaConfigs[this.tenantId];
|
|
3035
|
+
}
|
|
3036
|
+
};
|
|
3037
|
+
AuthImpl.prototype.validatePassword = function (password) {
|
|
3103
3038
|
return __awaiter(this, void 0, void 0, function () {
|
|
3104
|
-
var
|
|
3039
|
+
var passwordPolicy;
|
|
3105
3040
|
return __generator(this, function (_a) {
|
|
3106
3041
|
switch (_a.label) {
|
|
3107
|
-
case 0:
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
})];
|
|
3042
|
+
case 0:
|
|
3043
|
+
if (!!this._getPasswordPolicyInternal()) return [3 /*break*/, 2];
|
|
3044
|
+
return [4 /*yield*/, this._updatePasswordPolicy()];
|
|
3111
3045
|
case 1:
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
verifier = new RecaptchaEnterpriseVerifier(this);
|
|
3122
|
-
void verifier.verify();
|
|
3046
|
+
_a.sent();
|
|
3047
|
+
_a.label = 2;
|
|
3048
|
+
case 2:
|
|
3049
|
+
passwordPolicy = this._getPasswordPolicyInternal();
|
|
3050
|
+
// Check that the policy schema version is supported by the SDK.
|
|
3051
|
+
// TODO: Update this logic to use a max supported policy schema version once we have multiple schema versions.
|
|
3052
|
+
if (passwordPolicy.schemaVersion !==
|
|
3053
|
+
this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION) {
|
|
3054
|
+
return [2 /*return*/, Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version" /* AuthErrorCode.UNSUPPORTED_PASSWORD_POLICY_SCHEMA_VERSION */, {}))];
|
|
3123
3055
|
}
|
|
3124
|
-
return [2 /*return
|
|
3056
|
+
return [2 /*return*/, passwordPolicy.validatePassword(password)];
|
|
3125
3057
|
}
|
|
3126
3058
|
});
|
|
3127
3059
|
});
|
|
3128
3060
|
};
|
|
3129
|
-
AuthImpl.prototype.
|
|
3130
|
-
if (this.tenantId
|
|
3131
|
-
return this.
|
|
3061
|
+
AuthImpl.prototype._getPasswordPolicyInternal = function () {
|
|
3062
|
+
if (this.tenantId === null) {
|
|
3063
|
+
return this._projectPasswordPolicy;
|
|
3132
3064
|
}
|
|
3133
3065
|
else {
|
|
3134
|
-
return this.
|
|
3066
|
+
return this._tenantPasswordPolicies[this.tenantId];
|
|
3135
3067
|
}
|
|
3136
3068
|
};
|
|
3069
|
+
AuthImpl.prototype._updatePasswordPolicy = function () {
|
|
3070
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
3071
|
+
var response, passwordPolicy;
|
|
3072
|
+
return __generator(this, function (_a) {
|
|
3073
|
+
switch (_a.label) {
|
|
3074
|
+
case 0: return [4 /*yield*/, _getPasswordPolicy(this)];
|
|
3075
|
+
case 1:
|
|
3076
|
+
response = _a.sent();
|
|
3077
|
+
passwordPolicy = new PasswordPolicyImpl(response);
|
|
3078
|
+
if (this.tenantId === null) {
|
|
3079
|
+
this._projectPasswordPolicy = passwordPolicy;
|
|
3080
|
+
}
|
|
3081
|
+
else {
|
|
3082
|
+
this._tenantPasswordPolicies[this.tenantId] = passwordPolicy;
|
|
3083
|
+
}
|
|
3084
|
+
return [2 /*return*/];
|
|
3085
|
+
}
|
|
3086
|
+
});
|
|
3087
|
+
});
|
|
3088
|
+
};
|
|
3137
3089
|
AuthImpl.prototype._getPersistence = function () {
|
|
3138
3090
|
return this.assertedPersistence.persistence.type;
|
|
3139
3091
|
};
|
|
@@ -3300,18 +3252,32 @@ var AuthImpl = /** @class */ (function () {
|
|
|
3300
3252
|
var cb = typeof nextOrObserver === 'function'
|
|
3301
3253
|
? nextOrObserver
|
|
3302
3254
|
: nextOrObserver.next.bind(nextOrObserver);
|
|
3255
|
+
var isUnsubscribed = false;
|
|
3303
3256
|
var promise = this._isInitialized
|
|
3304
3257
|
? Promise.resolve()
|
|
3305
3258
|
: this._initializationPromise;
|
|
3306
3259
|
_assert(promise, this, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
3307
3260
|
// The callback needs to be called asynchronously per the spec.
|
|
3308
3261
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
3309
|
-
promise.then(function () {
|
|
3262
|
+
promise.then(function () {
|
|
3263
|
+
if (isUnsubscribed) {
|
|
3264
|
+
return;
|
|
3265
|
+
}
|
|
3266
|
+
cb(_this.currentUser);
|
|
3267
|
+
});
|
|
3310
3268
|
if (typeof nextOrObserver === 'function') {
|
|
3311
|
-
|
|
3269
|
+
var unsubscribe_2 = subscription.addObserver(nextOrObserver, error, completed);
|
|
3270
|
+
return function () {
|
|
3271
|
+
isUnsubscribed = true;
|
|
3272
|
+
unsubscribe_2();
|
|
3273
|
+
};
|
|
3312
3274
|
}
|
|
3313
3275
|
else {
|
|
3314
|
-
|
|
3276
|
+
var unsubscribe_3 = subscription.addObserver(nextOrObserver);
|
|
3277
|
+
return function () {
|
|
3278
|
+
isUnsubscribed = true;
|
|
3279
|
+
unsubscribe_3();
|
|
3280
|
+
};
|
|
3315
3281
|
}
|
|
3316
3282
|
};
|
|
3317
3283
|
/**
|
|
@@ -4469,160 +4435,450 @@ var IndexedDBLocalPersistence = /** @class */ (function () {
|
|
|
4469
4435
|
});
|
|
4470
4436
|
});
|
|
4471
4437
|
};
|
|
4472
|
-
IndexedDBLocalPersistence.prototype.notifyListeners = function (key, newValue) {
|
|
4473
|
-
this.localCache[key] = newValue;
|
|
4474
|
-
var listeners = this.listeners[key];
|
|
4475
|
-
if (listeners) {
|
|
4476
|
-
for (var _i = 0, _a = Array.from(listeners); _i < _a.length; _i++) {
|
|
4477
|
-
var listener = _a[_i];
|
|
4478
|
-
listener(newValue);
|
|
4438
|
+
IndexedDBLocalPersistence.prototype.notifyListeners = function (key, newValue) {
|
|
4439
|
+
this.localCache[key] = newValue;
|
|
4440
|
+
var listeners = this.listeners[key];
|
|
4441
|
+
if (listeners) {
|
|
4442
|
+
for (var _i = 0, _a = Array.from(listeners); _i < _a.length; _i++) {
|
|
4443
|
+
var listener = _a[_i];
|
|
4444
|
+
listener(newValue);
|
|
4445
|
+
}
|
|
4446
|
+
}
|
|
4447
|
+
};
|
|
4448
|
+
IndexedDBLocalPersistence.prototype.startPolling = function () {
|
|
4449
|
+
var _this = this;
|
|
4450
|
+
this.stopPolling();
|
|
4451
|
+
this.pollTimer = setInterval(function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
4452
|
+
return [2 /*return*/, this._poll()];
|
|
4453
|
+
}); }); }, _POLLING_INTERVAL_MS);
|
|
4454
|
+
};
|
|
4455
|
+
IndexedDBLocalPersistence.prototype.stopPolling = function () {
|
|
4456
|
+
if (this.pollTimer) {
|
|
4457
|
+
clearInterval(this.pollTimer);
|
|
4458
|
+
this.pollTimer = null;
|
|
4459
|
+
}
|
|
4460
|
+
};
|
|
4461
|
+
IndexedDBLocalPersistence.prototype._addListener = function (key, listener) {
|
|
4462
|
+
if (Object.keys(this.listeners).length === 0) {
|
|
4463
|
+
this.startPolling();
|
|
4464
|
+
}
|
|
4465
|
+
if (!this.listeners[key]) {
|
|
4466
|
+
this.listeners[key] = new Set();
|
|
4467
|
+
// Populate the cache to avoid spuriously triggering on first poll.
|
|
4468
|
+
void this._get(key); // This can happen in the background async and we can return immediately.
|
|
4469
|
+
}
|
|
4470
|
+
this.listeners[key].add(listener);
|
|
4471
|
+
};
|
|
4472
|
+
IndexedDBLocalPersistence.prototype._removeListener = function (key, listener) {
|
|
4473
|
+
if (this.listeners[key]) {
|
|
4474
|
+
this.listeners[key].delete(listener);
|
|
4475
|
+
if (this.listeners[key].size === 0) {
|
|
4476
|
+
delete this.listeners[key];
|
|
4477
|
+
}
|
|
4478
|
+
}
|
|
4479
|
+
if (Object.keys(this.listeners).length === 0) {
|
|
4480
|
+
this.stopPolling();
|
|
4481
|
+
}
|
|
4482
|
+
};
|
|
4483
|
+
IndexedDBLocalPersistence.type = 'LOCAL';
|
|
4484
|
+
return IndexedDBLocalPersistence;
|
|
4485
|
+
}());
|
|
4486
|
+
/**
|
|
4487
|
+
* An implementation of {@link Persistence} of type `LOCAL` using `indexedDB`
|
|
4488
|
+
* for the underlying storage.
|
|
4489
|
+
*
|
|
4490
|
+
* @public
|
|
4491
|
+
*/
|
|
4492
|
+
var indexedDBLocalPersistence = IndexedDBLocalPersistence;
|
|
4493
|
+
|
|
4494
|
+
/**
|
|
4495
|
+
* @license
|
|
4496
|
+
* Copyright 2021 Google LLC
|
|
4497
|
+
*
|
|
4498
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4499
|
+
* you may not use this file except in compliance with the License.
|
|
4500
|
+
* You may obtain a copy of the License at
|
|
4501
|
+
*
|
|
4502
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
4503
|
+
*
|
|
4504
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
4505
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
4506
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4507
|
+
* See the License for the specific language governing permissions and
|
|
4508
|
+
* limitations under the License.
|
|
4509
|
+
*/
|
|
4510
|
+
/**
|
|
4511
|
+
* An enum of factors that may be used for multifactor authentication.
|
|
4512
|
+
*
|
|
4513
|
+
* @public
|
|
4514
|
+
*/
|
|
4515
|
+
var FactorId = {
|
|
4516
|
+
/** Phone as second factor */
|
|
4517
|
+
PHONE: 'phone',
|
|
4518
|
+
TOTP: 'totp'
|
|
4519
|
+
};
|
|
4520
|
+
/**
|
|
4521
|
+
* Enumeration of supported providers.
|
|
4522
|
+
*
|
|
4523
|
+
* @public
|
|
4524
|
+
*/
|
|
4525
|
+
var ProviderId = {
|
|
4526
|
+
/** Facebook provider ID */
|
|
4527
|
+
FACEBOOK: 'facebook.com',
|
|
4528
|
+
/** GitHub provider ID */
|
|
4529
|
+
GITHUB: 'github.com',
|
|
4530
|
+
/** Google provider ID */
|
|
4531
|
+
GOOGLE: 'google.com',
|
|
4532
|
+
/** Password provider */
|
|
4533
|
+
PASSWORD: 'password',
|
|
4534
|
+
/** Phone provider */
|
|
4535
|
+
PHONE: 'phone',
|
|
4536
|
+
/** Twitter provider ID */
|
|
4537
|
+
TWITTER: 'twitter.com'
|
|
4538
|
+
};
|
|
4539
|
+
/**
|
|
4540
|
+
* Enumeration of supported sign-in methods.
|
|
4541
|
+
*
|
|
4542
|
+
* @public
|
|
4543
|
+
*/
|
|
4544
|
+
var SignInMethod = {
|
|
4545
|
+
/** Email link sign in method */
|
|
4546
|
+
EMAIL_LINK: 'emailLink',
|
|
4547
|
+
/** Email/password sign in method */
|
|
4548
|
+
EMAIL_PASSWORD: 'password',
|
|
4549
|
+
/** Facebook sign in method */
|
|
4550
|
+
FACEBOOK: 'facebook.com',
|
|
4551
|
+
/** GitHub sign in method */
|
|
4552
|
+
GITHUB: 'github.com',
|
|
4553
|
+
/** Google sign in method */
|
|
4554
|
+
GOOGLE: 'google.com',
|
|
4555
|
+
/** Phone sign in method */
|
|
4556
|
+
PHONE: 'phone',
|
|
4557
|
+
/** Twitter sign in method */
|
|
4558
|
+
TWITTER: 'twitter.com'
|
|
4559
|
+
};
|
|
4560
|
+
/**
|
|
4561
|
+
* Enumeration of supported operation types.
|
|
4562
|
+
*
|
|
4563
|
+
* @public
|
|
4564
|
+
*/
|
|
4565
|
+
var OperationType = {
|
|
4566
|
+
/** Operation involving linking an additional provider to an already signed-in user. */
|
|
4567
|
+
LINK: 'link',
|
|
4568
|
+
/** Operation involving using a provider to reauthenticate an already signed-in user. */
|
|
4569
|
+
REAUTHENTICATE: 'reauthenticate',
|
|
4570
|
+
/** Operation involving signing in a user. */
|
|
4571
|
+
SIGN_IN: 'signIn'
|
|
4572
|
+
};
|
|
4573
|
+
/**
|
|
4574
|
+
* An enumeration of the possible email action types.
|
|
4575
|
+
*
|
|
4576
|
+
* @public
|
|
4577
|
+
*/
|
|
4578
|
+
var ActionCodeOperation = {
|
|
4579
|
+
/** The email link sign-in action. */
|
|
4580
|
+
EMAIL_SIGNIN: 'EMAIL_SIGNIN',
|
|
4581
|
+
/** The password reset action. */
|
|
4582
|
+
PASSWORD_RESET: 'PASSWORD_RESET',
|
|
4583
|
+
/** The email revocation action. */
|
|
4584
|
+
RECOVER_EMAIL: 'RECOVER_EMAIL',
|
|
4585
|
+
/** The revert second factor addition email action. */
|
|
4586
|
+
REVERT_SECOND_FACTOR_ADDITION: 'REVERT_SECOND_FACTOR_ADDITION',
|
|
4587
|
+
/** The revert second factor addition email action. */
|
|
4588
|
+
VERIFY_AND_CHANGE_EMAIL: 'VERIFY_AND_CHANGE_EMAIL',
|
|
4589
|
+
/** The email verification action. */
|
|
4590
|
+
VERIFY_EMAIL: 'VERIFY_EMAIL'
|
|
4591
|
+
};
|
|
4592
|
+
|
|
4593
|
+
/**
|
|
4594
|
+
* @license
|
|
4595
|
+
* Copyright 2020 Google LLC
|
|
4596
|
+
*
|
|
4597
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4598
|
+
* you may not use this file except in compliance with the License.
|
|
4599
|
+
* You may obtain a copy of the License at
|
|
4600
|
+
*
|
|
4601
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
4602
|
+
*
|
|
4603
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
4604
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
4605
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4606
|
+
* See the License for the specific language governing permissions and
|
|
4607
|
+
* limitations under the License.
|
|
4608
|
+
*/
|
|
4609
|
+
function isEnterprise(grecaptcha) {
|
|
4610
|
+
return (grecaptcha !== undefined &&
|
|
4611
|
+
grecaptcha.enterprise !== undefined);
|
|
4612
|
+
}
|
|
4613
|
+
var RecaptchaConfig = /** @class */ (function () {
|
|
4614
|
+
function RecaptchaConfig(response) {
|
|
4615
|
+
/**
|
|
4616
|
+
* The reCAPTCHA site key.
|
|
4617
|
+
*/
|
|
4618
|
+
this.siteKey = '';
|
|
4619
|
+
/**
|
|
4620
|
+
* The reCAPTCHA enablement status of the {@link EmailAuthProvider} for the current tenant.
|
|
4621
|
+
*/
|
|
4622
|
+
this.emailPasswordEnabled = false;
|
|
4623
|
+
if (response.recaptchaKey === undefined) {
|
|
4624
|
+
throw new Error('recaptchaKey undefined');
|
|
4625
|
+
}
|
|
4626
|
+
// Example response.recaptchaKey: "projects/proj123/keys/sitekey123"
|
|
4627
|
+
this.siteKey = response.recaptchaKey.split('/')[3];
|
|
4628
|
+
this.emailPasswordEnabled = response.recaptchaEnforcementState.some(function (enforcementState) {
|
|
4629
|
+
return enforcementState.provider === 'EMAIL_PASSWORD_PROVIDER' &&
|
|
4630
|
+
enforcementState.enforcementState !== 'OFF';
|
|
4631
|
+
});
|
|
4632
|
+
}
|
|
4633
|
+
return RecaptchaConfig;
|
|
4634
|
+
}());
|
|
4635
|
+
|
|
4636
|
+
/**
|
|
4637
|
+
* @license
|
|
4638
|
+
* Copyright 2020 Google LLC
|
|
4639
|
+
*
|
|
4640
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4641
|
+
* you may not use this file except in compliance with the License.
|
|
4642
|
+
* You may obtain a copy of the License at
|
|
4643
|
+
*
|
|
4644
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
4645
|
+
*
|
|
4646
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
4647
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
4648
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4649
|
+
* See the License for the specific language governing permissions and
|
|
4650
|
+
* limitations under the License.
|
|
4651
|
+
*/
|
|
4652
|
+
function getRecaptchaConfig(auth, request) {
|
|
4653
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
4654
|
+
return __generator(this, function (_a) {
|
|
4655
|
+
return [2 /*return*/, _performApiRequest(auth, "GET" /* HttpMethod.GET */, "/v2/recaptchaConfig" /* Endpoint.GET_RECAPTCHA_CONFIG */, _addTidIfNecessary(auth, request))];
|
|
4656
|
+
});
|
|
4657
|
+
});
|
|
4658
|
+
}
|
|
4659
|
+
|
|
4660
|
+
/**
|
|
4661
|
+
* @license
|
|
4662
|
+
* Copyright 2020 Google LLC
|
|
4663
|
+
*
|
|
4664
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4665
|
+
* you may not use this file except in compliance with the License.
|
|
4666
|
+
* You may obtain a copy of the License at
|
|
4667
|
+
*
|
|
4668
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
4669
|
+
*
|
|
4670
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
4671
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
4672
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4673
|
+
* See the License for the specific language governing permissions and
|
|
4674
|
+
* limitations under the License.
|
|
4675
|
+
*/
|
|
4676
|
+
function getScriptParentElement() {
|
|
4677
|
+
var _a, _b;
|
|
4678
|
+
return (_b = (_a = document.getElementsByTagName('head')) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : document;
|
|
4679
|
+
}
|
|
4680
|
+
function _loadJS(url) {
|
|
4681
|
+
// TODO: consider adding timeout support & cancellation
|
|
4682
|
+
return new Promise(function (resolve, reject) {
|
|
4683
|
+
var el = document.createElement('script');
|
|
4684
|
+
el.setAttribute('src', url);
|
|
4685
|
+
el.onload = resolve;
|
|
4686
|
+
el.onerror = function (e) {
|
|
4687
|
+
var error = _createError("internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
4688
|
+
error.customData = e;
|
|
4689
|
+
reject(error);
|
|
4690
|
+
};
|
|
4691
|
+
el.type = 'text/javascript';
|
|
4692
|
+
el.charset = 'UTF-8';
|
|
4693
|
+
getScriptParentElement().appendChild(el);
|
|
4694
|
+
});
|
|
4695
|
+
}
|
|
4696
|
+
|
|
4697
|
+
/* eslint-disable @typescript-eslint/no-require-imports */
|
|
4698
|
+
var RECAPTCHA_ENTERPRISE_URL = 'https://www.google.com/recaptcha/enterprise.js?render=';
|
|
4699
|
+
var RECAPTCHA_ENTERPRISE_VERIFIER_TYPE = 'recaptcha-enterprise';
|
|
4700
|
+
var FAKE_TOKEN = 'NO_RECAPTCHA';
|
|
4701
|
+
var RecaptchaEnterpriseVerifier = /** @class */ (function () {
|
|
4702
|
+
/**
|
|
4703
|
+
*
|
|
4704
|
+
* @param authExtern - The corresponding Firebase {@link Auth} instance.
|
|
4705
|
+
*
|
|
4706
|
+
*/
|
|
4707
|
+
function RecaptchaEnterpriseVerifier(authExtern) {
|
|
4708
|
+
/**
|
|
4709
|
+
* Identifies the type of application verifier (e.g. "recaptcha-enterprise").
|
|
4710
|
+
*/
|
|
4711
|
+
this.type = RECAPTCHA_ENTERPRISE_VERIFIER_TYPE;
|
|
4712
|
+
this.auth = _castAuth(authExtern);
|
|
4713
|
+
}
|
|
4714
|
+
/**
|
|
4715
|
+
* Executes the verification process.
|
|
4716
|
+
*
|
|
4717
|
+
* @returns A Promise for a token that can be used to assert the validity of a request.
|
|
4718
|
+
*/
|
|
4719
|
+
RecaptchaEnterpriseVerifier.prototype.verify = function (action, forceRefresh) {
|
|
4720
|
+
if (action === void 0) { action = 'verify'; }
|
|
4721
|
+
if (forceRefresh === void 0) { forceRefresh = false; }
|
|
4722
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
4723
|
+
function retrieveSiteKey(auth) {
|
|
4724
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
4725
|
+
var _this = this;
|
|
4726
|
+
return __generator(this, function (_a) {
|
|
4727
|
+
if (!forceRefresh) {
|
|
4728
|
+
if (auth.tenantId == null && auth._agentRecaptchaConfig != null) {
|
|
4729
|
+
return [2 /*return*/, auth._agentRecaptchaConfig.siteKey];
|
|
4730
|
+
}
|
|
4731
|
+
if (auth.tenantId != null &&
|
|
4732
|
+
auth._tenantRecaptchaConfigs[auth.tenantId] !== undefined) {
|
|
4733
|
+
return [2 /*return*/, auth._tenantRecaptchaConfigs[auth.tenantId].siteKey];
|
|
4734
|
+
}
|
|
4735
|
+
}
|
|
4736
|
+
return [2 /*return*/, new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
|
|
4737
|
+
return __generator(this, function (_a) {
|
|
4738
|
+
getRecaptchaConfig(auth, {
|
|
4739
|
+
clientType: "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */,
|
|
4740
|
+
version: "RECAPTCHA_ENTERPRISE" /* RecaptchaVersion.ENTERPRISE */
|
|
4741
|
+
})
|
|
4742
|
+
.then(function (response) {
|
|
4743
|
+
if (response.recaptchaKey === undefined) {
|
|
4744
|
+
reject(new Error('recaptcha Enterprise site key undefined'));
|
|
4745
|
+
}
|
|
4746
|
+
else {
|
|
4747
|
+
var config = new RecaptchaConfig(response);
|
|
4748
|
+
if (auth.tenantId == null) {
|
|
4749
|
+
auth._agentRecaptchaConfig = config;
|
|
4750
|
+
}
|
|
4751
|
+
else {
|
|
4752
|
+
auth._tenantRecaptchaConfigs[auth.tenantId] = config;
|
|
4753
|
+
}
|
|
4754
|
+
return resolve(config.siteKey);
|
|
4755
|
+
}
|
|
4756
|
+
})
|
|
4757
|
+
.catch(function (error) {
|
|
4758
|
+
reject(error);
|
|
4759
|
+
});
|
|
4760
|
+
return [2 /*return*/];
|
|
4761
|
+
});
|
|
4762
|
+
}); })];
|
|
4763
|
+
});
|
|
4764
|
+
});
|
|
4765
|
+
}
|
|
4766
|
+
function retrieveRecaptchaToken(siteKey, resolve, reject) {
|
|
4767
|
+
var grecaptcha = window.grecaptcha;
|
|
4768
|
+
if (isEnterprise(grecaptcha)) {
|
|
4769
|
+
grecaptcha.enterprise.ready(function () {
|
|
4770
|
+
grecaptcha.enterprise
|
|
4771
|
+
.execute(siteKey, { action: action })
|
|
4772
|
+
.then(function (token) {
|
|
4773
|
+
resolve(token);
|
|
4774
|
+
})
|
|
4775
|
+
.catch(function () {
|
|
4776
|
+
resolve(FAKE_TOKEN);
|
|
4777
|
+
});
|
|
4778
|
+
});
|
|
4779
|
+
}
|
|
4780
|
+
else {
|
|
4781
|
+
reject(Error('No reCAPTCHA enterprise script loaded.'));
|
|
4782
|
+
}
|
|
4783
|
+
}
|
|
4784
|
+
var _this = this;
|
|
4785
|
+
return __generator(this, function (_a) {
|
|
4786
|
+
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
4787
|
+
retrieveSiteKey(_this.auth)
|
|
4788
|
+
.then(function (siteKey) {
|
|
4789
|
+
if (!forceRefresh && isEnterprise(window.grecaptcha)) {
|
|
4790
|
+
retrieveRecaptchaToken(siteKey, resolve, reject);
|
|
4791
|
+
}
|
|
4792
|
+
else {
|
|
4793
|
+
if (typeof window === 'undefined') {
|
|
4794
|
+
reject(new Error('RecaptchaVerifier is only supported in browser'));
|
|
4795
|
+
return;
|
|
4796
|
+
}
|
|
4797
|
+
_loadJS(RECAPTCHA_ENTERPRISE_URL + siteKey)
|
|
4798
|
+
.then(function () {
|
|
4799
|
+
retrieveRecaptchaToken(siteKey, resolve, reject);
|
|
4800
|
+
})
|
|
4801
|
+
.catch(function (error) {
|
|
4802
|
+
reject(error);
|
|
4803
|
+
});
|
|
4804
|
+
}
|
|
4805
|
+
})
|
|
4806
|
+
.catch(function (error) {
|
|
4807
|
+
reject(error);
|
|
4808
|
+
});
|
|
4809
|
+
})];
|
|
4810
|
+
});
|
|
4811
|
+
});
|
|
4812
|
+
};
|
|
4813
|
+
return RecaptchaEnterpriseVerifier;
|
|
4814
|
+
}());
|
|
4815
|
+
function injectRecaptchaFields(auth, request, action, captchaResp) {
|
|
4816
|
+
if (captchaResp === void 0) { captchaResp = false; }
|
|
4817
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
4818
|
+
var verifier, captchaResponse, newRequest;
|
|
4819
|
+
return __generator(this, function (_a) {
|
|
4820
|
+
switch (_a.label) {
|
|
4821
|
+
case 0:
|
|
4822
|
+
verifier = new RecaptchaEnterpriseVerifier(auth);
|
|
4823
|
+
_a.label = 1;
|
|
4824
|
+
case 1:
|
|
4825
|
+
_a.trys.push([1, 3, , 5]);
|
|
4826
|
+
return [4 /*yield*/, verifier.verify(action)];
|
|
4827
|
+
case 2:
|
|
4828
|
+
captchaResponse = _a.sent();
|
|
4829
|
+
return [3 /*break*/, 5];
|
|
4830
|
+
case 3:
|
|
4831
|
+
_a.sent();
|
|
4832
|
+
return [4 /*yield*/, verifier.verify(action, true)];
|
|
4833
|
+
case 4:
|
|
4834
|
+
captchaResponse = _a.sent();
|
|
4835
|
+
return [3 /*break*/, 5];
|
|
4836
|
+
case 5:
|
|
4837
|
+
newRequest = __assign({}, request);
|
|
4838
|
+
if (!captchaResp) {
|
|
4839
|
+
Object.assign(newRequest, { captchaResponse: captchaResponse });
|
|
4840
|
+
}
|
|
4841
|
+
else {
|
|
4842
|
+
Object.assign(newRequest, { 'captchaResp': captchaResponse });
|
|
4843
|
+
}
|
|
4844
|
+
Object.assign(newRequest, { 'clientType': "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */ });
|
|
4845
|
+
Object.assign(newRequest, {
|
|
4846
|
+
'recaptchaVersion': "RECAPTCHA_ENTERPRISE" /* RecaptchaVersion.ENTERPRISE */
|
|
4847
|
+
});
|
|
4848
|
+
return [2 /*return*/, newRequest];
|
|
4479
4849
|
}
|
|
4480
|
-
}
|
|
4481
|
-
};
|
|
4482
|
-
|
|
4483
|
-
|
|
4484
|
-
|
|
4485
|
-
|
|
4486
|
-
|
|
4487
|
-
|
|
4488
|
-
|
|
4489
|
-
|
|
4490
|
-
|
|
4491
|
-
|
|
4492
|
-
|
|
4493
|
-
|
|
4494
|
-
|
|
4495
|
-
|
|
4496
|
-
|
|
4497
|
-
|
|
4498
|
-
|
|
4499
|
-
|
|
4500
|
-
|
|
4501
|
-
|
|
4502
|
-
|
|
4503
|
-
|
|
4504
|
-
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
this.listeners[key].delete(listener);
|
|
4509
|
-
if (this.listeners[key].size === 0) {
|
|
4510
|
-
delete this.listeners[key];
|
|
4850
|
+
});
|
|
4851
|
+
});
|
|
4852
|
+
}
|
|
4853
|
+
function _initializeRecaptchaConfig(auth) {
|
|
4854
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
4855
|
+
var authInternal, response, config, verifier;
|
|
4856
|
+
return __generator(this, function (_a) {
|
|
4857
|
+
switch (_a.label) {
|
|
4858
|
+
case 0:
|
|
4859
|
+
authInternal = _castAuth(auth);
|
|
4860
|
+
return [4 /*yield*/, getRecaptchaConfig(authInternal, {
|
|
4861
|
+
clientType: "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */,
|
|
4862
|
+
version: "RECAPTCHA_ENTERPRISE" /* RecaptchaVersion.ENTERPRISE */
|
|
4863
|
+
})];
|
|
4864
|
+
case 1:
|
|
4865
|
+
response = _a.sent();
|
|
4866
|
+
config = new RecaptchaConfig(response);
|
|
4867
|
+
if (authInternal.tenantId == null) {
|
|
4868
|
+
authInternal._agentRecaptchaConfig = config;
|
|
4869
|
+
}
|
|
4870
|
+
else {
|
|
4871
|
+
authInternal._tenantRecaptchaConfigs[authInternal.tenantId] = config;
|
|
4872
|
+
}
|
|
4873
|
+
if (config.emailPasswordEnabled) {
|
|
4874
|
+
verifier = new RecaptchaEnterpriseVerifier(authInternal);
|
|
4875
|
+
void verifier.verify();
|
|
4876
|
+
}
|
|
4877
|
+
return [2 /*return*/];
|
|
4511
4878
|
}
|
|
4512
|
-
}
|
|
4513
|
-
|
|
4514
|
-
|
|
4515
|
-
}
|
|
4516
|
-
};
|
|
4517
|
-
IndexedDBLocalPersistence.type = 'LOCAL';
|
|
4518
|
-
return IndexedDBLocalPersistence;
|
|
4519
|
-
}());
|
|
4520
|
-
/**
|
|
4521
|
-
* An implementation of {@link Persistence} of type `LOCAL` using `indexedDB`
|
|
4522
|
-
* for the underlying storage.
|
|
4523
|
-
*
|
|
4524
|
-
* @public
|
|
4525
|
-
*/
|
|
4526
|
-
var indexedDBLocalPersistence = IndexedDBLocalPersistence;
|
|
4527
|
-
|
|
4528
|
-
/**
|
|
4529
|
-
* @license
|
|
4530
|
-
* Copyright 2021 Google LLC
|
|
4531
|
-
*
|
|
4532
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4533
|
-
* you may not use this file except in compliance with the License.
|
|
4534
|
-
* You may obtain a copy of the License at
|
|
4535
|
-
*
|
|
4536
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
4537
|
-
*
|
|
4538
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
4539
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
4540
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4541
|
-
* See the License for the specific language governing permissions and
|
|
4542
|
-
* limitations under the License.
|
|
4543
|
-
*/
|
|
4544
|
-
/**
|
|
4545
|
-
* An enum of factors that may be used for multifactor authentication.
|
|
4546
|
-
*
|
|
4547
|
-
* @public
|
|
4548
|
-
*/
|
|
4549
|
-
var FactorId = {
|
|
4550
|
-
/** Phone as second factor */
|
|
4551
|
-
PHONE: 'phone',
|
|
4552
|
-
TOTP: 'totp'
|
|
4553
|
-
};
|
|
4554
|
-
/**
|
|
4555
|
-
* Enumeration of supported providers.
|
|
4556
|
-
*
|
|
4557
|
-
* @public
|
|
4558
|
-
*/
|
|
4559
|
-
var ProviderId = {
|
|
4560
|
-
/** Facebook provider ID */
|
|
4561
|
-
FACEBOOK: 'facebook.com',
|
|
4562
|
-
/** GitHub provider ID */
|
|
4563
|
-
GITHUB: 'github.com',
|
|
4564
|
-
/** Google provider ID */
|
|
4565
|
-
GOOGLE: 'google.com',
|
|
4566
|
-
/** Password provider */
|
|
4567
|
-
PASSWORD: 'password',
|
|
4568
|
-
/** Phone provider */
|
|
4569
|
-
PHONE: 'phone',
|
|
4570
|
-
/** Twitter provider ID */
|
|
4571
|
-
TWITTER: 'twitter.com'
|
|
4572
|
-
};
|
|
4573
|
-
/**
|
|
4574
|
-
* Enumeration of supported sign-in methods.
|
|
4575
|
-
*
|
|
4576
|
-
* @public
|
|
4577
|
-
*/
|
|
4578
|
-
var SignInMethod = {
|
|
4579
|
-
/** Email link sign in method */
|
|
4580
|
-
EMAIL_LINK: 'emailLink',
|
|
4581
|
-
/** Email/password sign in method */
|
|
4582
|
-
EMAIL_PASSWORD: 'password',
|
|
4583
|
-
/** Facebook sign in method */
|
|
4584
|
-
FACEBOOK: 'facebook.com',
|
|
4585
|
-
/** GitHub sign in method */
|
|
4586
|
-
GITHUB: 'github.com',
|
|
4587
|
-
/** Google sign in method */
|
|
4588
|
-
GOOGLE: 'google.com',
|
|
4589
|
-
/** Phone sign in method */
|
|
4590
|
-
PHONE: 'phone',
|
|
4591
|
-
/** Twitter sign in method */
|
|
4592
|
-
TWITTER: 'twitter.com'
|
|
4593
|
-
};
|
|
4594
|
-
/**
|
|
4595
|
-
* Enumeration of supported operation types.
|
|
4596
|
-
*
|
|
4597
|
-
* @public
|
|
4598
|
-
*/
|
|
4599
|
-
var OperationType = {
|
|
4600
|
-
/** Operation involving linking an additional provider to an already signed-in user. */
|
|
4601
|
-
LINK: 'link',
|
|
4602
|
-
/** Operation involving using a provider to reauthenticate an already signed-in user. */
|
|
4603
|
-
REAUTHENTICATE: 'reauthenticate',
|
|
4604
|
-
/** Operation involving signing in a user. */
|
|
4605
|
-
SIGN_IN: 'signIn'
|
|
4606
|
-
};
|
|
4607
|
-
/**
|
|
4608
|
-
* An enumeration of the possible email action types.
|
|
4609
|
-
*
|
|
4610
|
-
* @public
|
|
4611
|
-
*/
|
|
4612
|
-
var ActionCodeOperation = {
|
|
4613
|
-
/** The email link sign-in action. */
|
|
4614
|
-
EMAIL_SIGNIN: 'EMAIL_SIGNIN',
|
|
4615
|
-
/** The password reset action. */
|
|
4616
|
-
PASSWORD_RESET: 'PASSWORD_RESET',
|
|
4617
|
-
/** The email revocation action. */
|
|
4618
|
-
RECOVER_EMAIL: 'RECOVER_EMAIL',
|
|
4619
|
-
/** The revert second factor addition email action. */
|
|
4620
|
-
REVERT_SECOND_FACTOR_ADDITION: 'REVERT_SECOND_FACTOR_ADDITION',
|
|
4621
|
-
/** The revert second factor addition email action. */
|
|
4622
|
-
VERIFY_AND_CHANGE_EMAIL: 'VERIFY_AND_CHANGE_EMAIL',
|
|
4623
|
-
/** The email verification action. */
|
|
4624
|
-
VERIFY_EMAIL: 'VERIFY_EMAIL'
|
|
4625
|
-
};
|
|
4879
|
+
});
|
|
4880
|
+
});
|
|
4881
|
+
}
|
|
4626
4882
|
|
|
4627
4883
|
/**
|
|
4628
4884
|
* Changes the {@link Auth} instance to communicate with the Firebase Auth Emulator, instead of production
|
|
@@ -7207,6 +7463,36 @@ function _setActionCodeSettingsOnRequest(auth, request, actionCodeSettings) {
|
|
|
7207
7463
|
* See the License for the specific language governing permissions and
|
|
7208
7464
|
* limitations under the License.
|
|
7209
7465
|
*/
|
|
7466
|
+
/**
|
|
7467
|
+
* Updates the password policy cached in the {@link Auth} instance if a policy is already
|
|
7468
|
+
* cached for the project or tenant.
|
|
7469
|
+
*
|
|
7470
|
+
* @remarks
|
|
7471
|
+
* We only fetch the password policy if the password did not meet policy requirements and
|
|
7472
|
+
* there is an existing policy cached. A developer must call validatePassword at least
|
|
7473
|
+
* once for the cache to be automatically updated.
|
|
7474
|
+
*
|
|
7475
|
+
* @param auth - The {@link Auth} instance.
|
|
7476
|
+
*
|
|
7477
|
+
* @private
|
|
7478
|
+
*/
|
|
7479
|
+
function recachePasswordPolicy(auth) {
|
|
7480
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
7481
|
+
var authInternal;
|
|
7482
|
+
return __generator(this, function (_a) {
|
|
7483
|
+
switch (_a.label) {
|
|
7484
|
+
case 0:
|
|
7485
|
+
authInternal = _castAuth(auth);
|
|
7486
|
+
if (!authInternal._getPasswordPolicyInternal()) return [3 /*break*/, 2];
|
|
7487
|
+
return [4 /*yield*/, authInternal._updatePasswordPolicy()];
|
|
7488
|
+
case 1:
|
|
7489
|
+
_a.sent();
|
|
7490
|
+
_a.label = 2;
|
|
7491
|
+
case 2: return [2 /*return*/];
|
|
7492
|
+
}
|
|
7493
|
+
});
|
|
7494
|
+
});
|
|
7495
|
+
}
|
|
7210
7496
|
/**
|
|
7211
7497
|
* Sends a password reset email to the given email address.
|
|
7212
7498
|
*
|
|
@@ -7310,12 +7596,22 @@ function sendPasswordResetEmail(auth, email, actionCodeSettings) {
|
|
|
7310
7596
|
*/
|
|
7311
7597
|
function confirmPasswordReset(auth, oobCode, newPassword) {
|
|
7312
7598
|
return __awaiter(this, void 0, void 0, function () {
|
|
7599
|
+
var _this = this;
|
|
7313
7600
|
return __generator(this, function (_a) {
|
|
7314
7601
|
switch (_a.label) {
|
|
7315
7602
|
case 0: return [4 /*yield*/, resetPassword(getModularInstance(auth), {
|
|
7316
7603
|
oobCode: oobCode,
|
|
7317
7604
|
newPassword: newPassword
|
|
7318
|
-
})
|
|
7605
|
+
})
|
|
7606
|
+
.catch(function (error) { return __awaiter(_this, void 0, void 0, function () {
|
|
7607
|
+
return __generator(this, function (_a) {
|
|
7608
|
+
if (error.code ===
|
|
7609
|
+
"auth/".concat("password-does-not-meet-requirements" /* AuthErrorCode.PASSWORD_DOES_NOT_MEET_REQUIREMENTS */)) {
|
|
7610
|
+
void recachePasswordPolicy(auth);
|
|
7611
|
+
}
|
|
7612
|
+
throw error;
|
|
7613
|
+
});
|
|
7614
|
+
}); })];
|
|
7319
7615
|
case 1:
|
|
7320
7616
|
_a.sent();
|
|
7321
7617
|
return [2 /*return*/];
|
|
@@ -7471,13 +7767,16 @@ function createUserWithEmailAndPassword(auth, email, password) {
|
|
|
7471
7767
|
case 1:
|
|
7472
7768
|
requestWithRecaptcha = _a.sent();
|
|
7473
7769
|
return [2 /*return*/, signUp(authInternal, requestWithRecaptcha)];
|
|
7474
|
-
case 2:
|
|
7770
|
+
case 2: throw error;
|
|
7475
7771
|
}
|
|
7476
7772
|
});
|
|
7477
7773
|
}); });
|
|
7478
7774
|
_b.label = 3;
|
|
7479
7775
|
case 3: return [4 /*yield*/, signUpResponse.catch(function (error) {
|
|
7480
|
-
|
|
7776
|
+
if (error.code === "auth/".concat("password-does-not-meet-requirements" /* AuthErrorCode.PASSWORD_DOES_NOT_MEET_REQUIREMENTS */)) {
|
|
7777
|
+
void recachePasswordPolicy(auth);
|
|
7778
|
+
}
|
|
7779
|
+
throw error;
|
|
7481
7780
|
})];
|
|
7482
7781
|
case 4:
|
|
7483
7782
|
response = _b.sent();
|
|
@@ -7509,7 +7808,15 @@ function createUserWithEmailAndPassword(auth, email, password) {
|
|
|
7509
7808
|
* @public
|
|
7510
7809
|
*/
|
|
7511
7810
|
function signInWithEmailAndPassword(auth, email, password) {
|
|
7512
|
-
|
|
7811
|
+
var _this = this;
|
|
7812
|
+
return signInWithCredential(getModularInstance(auth), EmailAuthProvider.credential(email, password)).catch(function (error) { return __awaiter(_this, void 0, void 0, function () {
|
|
7813
|
+
return __generator(this, function (_a) {
|
|
7814
|
+
if (error.code === "auth/".concat("password-does-not-meet-requirements" /* AuthErrorCode.PASSWORD_DOES_NOT_MEET_REQUIREMENTS */)) {
|
|
7815
|
+
void recachePasswordPolicy(auth);
|
|
7816
|
+
}
|
|
7817
|
+
throw error;
|
|
7818
|
+
});
|
|
7819
|
+
}); });
|
|
7513
7820
|
}
|
|
7514
7821
|
|
|
7515
7822
|
/**
|
|
@@ -8247,8 +8554,39 @@ function setPersistence(auth, persistence) {
|
|
|
8247
8554
|
* @public
|
|
8248
8555
|
*/
|
|
8249
8556
|
function initializeRecaptchaConfig(auth) {
|
|
8250
|
-
|
|
8251
|
-
|
|
8557
|
+
return _initializeRecaptchaConfig(auth);
|
|
8558
|
+
}
|
|
8559
|
+
/**
|
|
8560
|
+
* Validates the password against the password policy configured for the project or tenant.
|
|
8561
|
+
*
|
|
8562
|
+
* @remarks
|
|
8563
|
+
* If no tenant ID is set on the `Auth` instance, then this method will use the password
|
|
8564
|
+
* policy configured for the project. Otherwise, this method will use the policy configured
|
|
8565
|
+
* for the tenant. If a password policy has not been configured, then the default policy
|
|
8566
|
+
* configured for all projects will be used.
|
|
8567
|
+
*
|
|
8568
|
+
* If an auth flow fails because a submitted password does not meet the password policy
|
|
8569
|
+
* requirements and this method has previously been called, then this method will use the
|
|
8570
|
+
* most recent policy available when called again.
|
|
8571
|
+
*
|
|
8572
|
+
* @example
|
|
8573
|
+
* ```javascript
|
|
8574
|
+
* validatePassword(auth, 'some-password');
|
|
8575
|
+
* ```
|
|
8576
|
+
*
|
|
8577
|
+
* @param auth The {@link Auth} instance.
|
|
8578
|
+
* @param password The password to validate.
|
|
8579
|
+
*
|
|
8580
|
+
* @public
|
|
8581
|
+
*/
|
|
8582
|
+
function validatePassword(auth, password) {
|
|
8583
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
8584
|
+
var authInternal;
|
|
8585
|
+
return __generator(this, function (_a) {
|
|
8586
|
+
authInternal = _castAuth(auth);
|
|
8587
|
+
return [2 /*return*/, authInternal.validatePassword(password)];
|
|
8588
|
+
});
|
|
8589
|
+
});
|
|
8252
8590
|
}
|
|
8253
8591
|
/**
|
|
8254
8592
|
* Adds an observer for changes to the signed-in user's ID token.
|
|
@@ -8691,5 +9029,5 @@ function getAuth(app) {
|
|
|
8691
9029
|
return auth;
|
|
8692
9030
|
}
|
|
8693
9031
|
|
|
8694
|
-
export { ActionCodeOperation, ActionCodeURL, AuthCredential, AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY as AuthErrorCodes, EmailAuthCredential, EmailAuthProvider, FacebookAuthProvider, FactorId, GithubAuthProvider, GoogleAuthProvider, OAuthCredential, OAuthProvider, OperationType, PhoneAuthCredential, ProviderId, SAMLAuthProvider, SignInMethod, TwitterAuthProvider, applyActionCode, beforeAuthStateChanged, checkActionCode, confirmPasswordReset, connectAuthEmulator, createUserWithEmailAndPassword, debugErrorMap, deleteUser, fetchSignInMethodsForEmail, getAdditionalUserInfo, getAuth, getIdToken, getIdTokenResult, getMultiFactorResolver, inMemoryPersistence, indexedDBLocalPersistence, initializeAuth, initializeRecaptchaConfig, isSignInWithEmailLink, linkWithCredential, multiFactor, onAuthStateChanged, onIdTokenChanged, parseActionCodeURL, prodErrorMap, reauthenticateWithCredential, reload, sendEmailVerification, sendPasswordResetEmail, sendSignInLinkToEmail, setPersistence, signInAnonymously, signInWithCredential, signInWithCustomToken, signInWithEmailAndPassword, signInWithEmailLink, signOut, unlink, updateCurrentUser, updateEmail, updatePassword, updateProfile, useDeviceLanguage, verifyBeforeUpdateEmail, verifyPasswordResetCode };
|
|
9032
|
+
export { ActionCodeOperation, ActionCodeURL, AuthCredential, AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY as AuthErrorCodes, EmailAuthCredential, EmailAuthProvider, FacebookAuthProvider, FactorId, GithubAuthProvider, GoogleAuthProvider, OAuthCredential, OAuthProvider, OperationType, PhoneAuthCredential, ProviderId, SAMLAuthProvider, SignInMethod, TwitterAuthProvider, applyActionCode, beforeAuthStateChanged, checkActionCode, confirmPasswordReset, connectAuthEmulator, createUserWithEmailAndPassword, debugErrorMap, deleteUser, fetchSignInMethodsForEmail, getAdditionalUserInfo, getAuth, getIdToken, getIdTokenResult, getMultiFactorResolver, inMemoryPersistence, indexedDBLocalPersistence, initializeAuth, initializeRecaptchaConfig, isSignInWithEmailLink, linkWithCredential, multiFactor, onAuthStateChanged, onIdTokenChanged, parseActionCodeURL, prodErrorMap, reauthenticateWithCredential, reload, sendEmailVerification, sendPasswordResetEmail, sendSignInLinkToEmail, setPersistence, signInAnonymously, signInWithCredential, signInWithCustomToken, signInWithEmailAndPassword, signInWithEmailLink, signOut, unlink, updateCurrentUser, updateEmail, updatePassword, updateProfile, useDeviceLanguage, validatePassword, verifyBeforeUpdateEmail, verifyPasswordResetCode };
|
|
8695
9033
|
//# sourceMappingURL=index.webworker.esm5.js.map
|