@absolutejs/auth 0.65.0 → 0.65.2

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.
@@ -1,6 +1,6 @@
1
1
  import { Elysia } from 'elysia';
2
2
  import { type CredentialRouteProps } from './config';
3
- export declare const credentialsRegister: <UserType>({ authSessionStore, cookieSecure, credentialStore, enforceTrustedOrigins, onCreateCredentialUser, onCredentialsLoginSuccess, onExistingAccount, onRegistrationSuccess, onSendEmail, onUntrustedOrigin, passwordPolicy, registerRoute, requireEmailVerification, revealRegistrationConflicts, sessionDurationMs, trustedOrigins, verificationTokenDurationMs }: CredentialRouteProps<UserType>) => Elysia<"", {
3
+ export declare const credentialsRegister: <UserType>({ authSessionStore, cookieSecure, credentialStore, enforceTrustedOrigins, getUserByEmail, onCreateCredentialUser, onCredentialsLoginSuccess, onExistingAccount, onRegistrationSuccess, onSendEmail, onUntrustedOrigin, passwordPolicy, registerRoute, requireEmailVerification, revealRegistrationConflicts, sessionDurationMs, trustedOrigins, verificationTokenDurationMs }: CredentialRouteProps<UserType>) => Elysia<"", {
4
4
  decorator: {};
5
5
  store: {
6
6
  session: import("..").SessionRecord<UserType>;
package/dist/index.js CHANGED
@@ -5547,6 +5547,7 @@ var credentialsRegister = ({
5547
5547
  cookieSecure,
5548
5548
  credentialStore,
5549
5549
  enforceTrustedOrigins,
5550
+ getUserByEmail,
5550
5551
  onCreateCredentialUser,
5551
5552
  onCredentialsLoginSuccess,
5552
5553
  onExistingAccount,
@@ -5586,8 +5587,11 @@ var credentialsRegister = ({
5586
5587
  violations: policy.violations
5587
5588
  });
5588
5589
  }
5589
- const existing = await credentialStore.getCredentialByEmail(normalizedEmail);
5590
- if (existing) {
5590
+ const [existingCredential, existingUser] = await Promise.all([
5591
+ credentialStore.getCredentialByEmail(normalizedEmail),
5592
+ getUserByEmail(normalizedEmail)
5593
+ ]);
5594
+ if (existingCredential || existingUser) {
5591
5595
  if (revealRegistrationConflicts) {
5592
5596
  return status("Conflict", "Email is already registered");
5593
5597
  }
@@ -38147,5 +38151,5 @@ export {
38147
38151
  AGENT_CLAIM_GRANT_TYPE
38148
38152
  };
38149
38153
 
38150
- //# debugId=1D72B0CC5FBF9E2F64756E2164756E21
38154
+ //# debugId=0ABB16F4AD8BF1CD64756E2164756E21
38151
38155
  //# sourceMappingURL=index.js.map