@eaccess/auth 0.1.9 → 0.1.11

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/index.cjs CHANGED
@@ -88,6 +88,7 @@ __export(index_exports, {
88
88
  resetPassword: () => resetPassword,
89
89
  setStatusForUserBy: () => setStatusForUserBy,
90
90
  setUserRoles: () => setUserRoles,
91
+ userExistsByEmail: () => userExistsByEmail,
91
92
  validateEmail: () => validateEmail
92
93
  });
93
94
  module.exports = __toCommonJS(index_exports);
@@ -1468,7 +1469,8 @@ __export(auth_functions_exports, {
1468
1469
  register: () => register,
1469
1470
  removeRoleForUserBy: () => removeRoleForUserBy,
1470
1471
  resetPassword: () => resetPassword,
1471
- setStatusForUserBy: () => setStatusForUserBy
1472
+ setStatusForUserBy: () => setStatusForUserBy,
1473
+ userExistsByEmail: () => userExistsByEmail
1472
1474
  });
1473
1475
  var import_hash3 = require("@prsm/hash");
1474
1476
  var import_ms2 = __toESM(require("@prsm/ms"), 1);
@@ -1686,6 +1688,12 @@ async function confirmResetPassword(config, token, password) {
1686
1688
  await queries.deleteResetToken(token);
1687
1689
  return { accountId: account.id, email: account.email };
1688
1690
  }
1691
+ async function userExistsByEmail(config, email) {
1692
+ validateEmail(email);
1693
+ const queries = new AuthQueries(config);
1694
+ const account = await queries.findAccountByEmail(email);
1695
+ return account !== null;
1696
+ }
1689
1697
  async function forceLogoutForUserBy(config, identifier) {
1690
1698
  const queries = new AuthQueries(config);
1691
1699
  const account = await findAccountByIdentifier(queries, identifier);
@@ -2432,6 +2440,9 @@ var AuthManager = class {
2432
2440
  async initiatePasswordResetForUserBy(identifier, expiresAfter, callback) {
2433
2441
  return initiatePasswordResetForUserBy(this.config, identifier, expiresAfter, callback);
2434
2442
  }
2443
+ async userExistsByEmail(email) {
2444
+ return userExistsByEmail(this.config, email);
2445
+ }
2435
2446
  async forceLogoutForUserBy(identifier) {
2436
2447
  const result = await forceLogoutForUserBy(this.config, identifier);
2437
2448
  if (this.getId() === result.accountId) {
@@ -2682,6 +2693,7 @@ function createAuthContext(config) {
2682
2693
  initiatePasswordResetForUserBy: (identifier, expiresAfter, callback) => initiatePasswordResetForUserBy(config, identifier, expiresAfter, callback),
2683
2694
  resetPassword: (email, expiresAfter, maxOpenRequests, callback) => resetPassword(config, email, expiresAfter, maxOpenRequests, callback),
2684
2695
  confirmResetPassword: (token, password) => confirmResetPassword(config, token, password),
2696
+ userExistsByEmail: (email) => userExistsByEmail(config, email),
2685
2697
  forceLogoutForUserBy: (identifier) => forceLogoutForUserBy(config, identifier)
2686
2698
  };
2687
2699
  }
@@ -2783,6 +2795,7 @@ async function getUserRoles(config, identifier) {
2783
2795
  resetPassword,
2784
2796
  setStatusForUserBy,
2785
2797
  setUserRoles,
2798
+ userExistsByEmail,
2786
2799
  validateEmail
2787
2800
  });
2788
2801
  //# sourceMappingURL=index.cjs.map