@eaccess/auth 0.1.9 → 0.1.10

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);
@@ -2682,6 +2690,7 @@ function createAuthContext(config) {
2682
2690
  initiatePasswordResetForUserBy: (identifier, expiresAfter, callback) => initiatePasswordResetForUserBy(config, identifier, expiresAfter, callback),
2683
2691
  resetPassword: (email, expiresAfter, maxOpenRequests, callback) => resetPassword(config, email, expiresAfter, maxOpenRequests, callback),
2684
2692
  confirmResetPassword: (token, password) => confirmResetPassword(config, token, password),
2693
+ userExistsByEmail: (email) => userExistsByEmail(config, email),
2685
2694
  forceLogoutForUserBy: (identifier) => forceLogoutForUserBy(config, identifier)
2686
2695
  };
2687
2696
  }
@@ -2783,6 +2792,7 @@ async function getUserRoles(config, identifier) {
2783
2792
  resetPassword,
2784
2793
  setStatusForUserBy,
2785
2794
  setUserRoles,
2795
+ userExistsByEmail,
2786
2796
  validateEmail
2787
2797
  });
2788
2798
  //# sourceMappingURL=index.cjs.map