payload-auth 1.1.2 → 1.3.0
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/authjs/index.d.ts.map +1 -1
- package/dist/authjs/index.js +2 -2
- package/dist/better-auth/adapter/generate-schema/generate-schema-builder.d.ts +1 -1
- package/dist/better-auth/adapter/generate-schema/generate-schema-builder.d.ts.map +1 -1
- package/dist/better-auth/adapter/generate-schema/generate-schema-builder.js +3 -3
- package/dist/better-auth/adapter/generate-schema/get-payload-schema.d.ts.map +1 -1
- package/dist/better-auth/adapter/generate-schema/get-payload-schema.js +4 -4
- package/dist/better-auth/adapter/generate-schema/index.js +5 -5
- package/dist/better-auth/adapter/generate-schema/utils.js +1 -1
- package/dist/better-auth/adapter/index.d.ts +2 -2
- package/dist/better-auth/adapter/index.d.ts.map +1 -1
- package/dist/better-auth/adapter/index.js +53 -53
- package/dist/better-auth/adapter/transform/index.d.ts +5 -5
- package/dist/better-auth/adapter/transform/index.d.ts.map +1 -1
- package/dist/better-auth/adapter/transform/index.js +69 -69
- package/dist/better-auth/adapter/types.d.ts +3 -3
- package/dist/better-auth/adapter/types.d.ts.map +1 -1
- package/dist/better-auth/adapter/types.js +1 -1
- package/dist/better-auth/index.js +4 -4
- package/dist/better-auth/plugin/{lib/constants.d.ts → constants.d.ts} +14 -6
- package/dist/better-auth/plugin/constants.d.ts.map +1 -0
- package/dist/better-auth/plugin/constants.js +91 -0
- package/dist/better-auth/plugin/helpers/check-passkey-plugin.d.ts +1 -1
- package/dist/better-auth/plugin/helpers/check-passkey-plugin.d.ts.map +1 -1
- package/dist/better-auth/plugin/helpers/check-passkey-plugin.js +2 -2
- package/dist/better-auth/plugin/helpers/check-username-plugin.d.ts +1 -1
- package/dist/better-auth/plugin/helpers/check-username-plugin.d.ts.map +1 -1
- package/dist/better-auth/plugin/helpers/check-username-plugin.js +2 -2
- package/dist/better-auth/plugin/helpers/generate-verify-email-url.d.ts +1 -1
- package/dist/better-auth/plugin/helpers/generate-verify-email-url.d.ts.map +1 -1
- package/dist/better-auth/plugin/helpers/generate-verify-email-url.js +7 -7
- package/dist/better-auth/plugin/helpers/get-admin-access.d.ts +1 -1
- package/dist/better-auth/plugin/helpers/get-admin-access.d.ts.map +1 -1
- package/dist/better-auth/plugin/helpers/get-admin-access.js +2 -2
- package/dist/better-auth/plugin/helpers/get-all-roles.d.ts +1 -1
- package/dist/better-auth/plugin/helpers/get-all-roles.d.ts.map +1 -1
- package/dist/better-auth/plugin/helpers/get-all-roles.js +4 -4
- package/dist/better-auth/plugin/helpers/get-ip.d.ts +1 -1
- package/dist/better-auth/plugin/helpers/get-ip.d.ts.map +1 -1
- package/dist/better-auth/plugin/helpers/get-ip.js +14 -14
- package/dist/better-auth/plugin/helpers/get-requst-collection.d.ts +1 -1
- package/dist/better-auth/plugin/helpers/get-requst-collection.d.ts.map +1 -1
- package/dist/better-auth/plugin/helpers/get-requst-collection.js +2 -2
- package/dist/better-auth/plugin/helpers/index.d.ts +1 -1
- package/dist/better-auth/plugin/helpers/index.d.ts.map +1 -1
- package/dist/better-auth/plugin/helpers/index.js +1 -1
- package/dist/better-auth/plugin/helpers/prepare-session-data.d.ts +3 -3
- package/dist/better-auth/plugin/helpers/prepare-session-data.d.ts.map +1 -1
- package/dist/better-auth/plugin/helpers/prepare-session-data.js +1 -1
- package/dist/better-auth/plugin/helpers/serialize-cookie.d.ts +2 -2
- package/dist/better-auth/plugin/helpers/serialize-cookie.d.ts.map +1 -1
- package/dist/better-auth/plugin/helpers/serialize-cookie.js +33 -33
- package/dist/better-auth/plugin/index.d.ts +6 -6
- package/dist/better-auth/plugin/index.d.ts.map +1 -1
- package/dist/better-auth/plugin/index.js +27 -57
- package/dist/better-auth/plugin/lib/build-collections/accounts/hooks/sync-password-to-user.d.ts +1 -1
- package/dist/better-auth/plugin/lib/build-collections/accounts/hooks/sync-password-to-user.d.ts.map +1 -1
- package/dist/better-auth/plugin/lib/build-collections/accounts/hooks/sync-password-to-user.js +6 -6
- package/dist/better-auth/plugin/lib/build-collections/accounts/index.d.ts +3 -3
- package/dist/better-auth/plugin/lib/build-collections/accounts/index.d.ts.map +1 -1
- package/dist/better-auth/plugin/lib/build-collections/accounts/index.js +47 -47
- package/dist/better-auth/plugin/lib/build-collections/admin-invitations/hooks/get-url-after-read.d.ts +3 -3
- package/dist/better-auth/plugin/lib/build-collections/admin-invitations/hooks/get-url-after-read.d.ts.map +1 -1
- package/dist/better-auth/plugin/lib/build-collections/admin-invitations/hooks/get-url-after-read.js +1 -1
- package/dist/better-auth/plugin/lib/build-collections/admin-invitations/hooks/get-url-before-change.d.ts +1 -1
- package/dist/better-auth/plugin/lib/build-collections/admin-invitations/hooks/get-url-before-change.d.ts.map +1 -1
- package/dist/better-auth/plugin/lib/build-collections/admin-invitations/hooks/get-url-before-change.js +2 -2
- package/dist/better-auth/plugin/lib/build-collections/admin-invitations/index.d.ts +3 -3
- package/dist/better-auth/plugin/lib/build-collections/admin-invitations/index.d.ts.map +1 -1
- package/dist/better-auth/plugin/lib/build-collections/admin-invitations/index.js +33 -24
- package/dist/better-auth/plugin/lib/build-collections/api-keys.d.ts +3 -3
- package/dist/better-auth/plugin/lib/build-collections/api-keys.d.ts.map +1 -1
- package/dist/better-auth/plugin/lib/build-collections/api-keys.js +77 -80
- package/dist/better-auth/plugin/lib/build-collections/index.d.ts +3 -3
- package/dist/better-auth/plugin/lib/build-collections/index.d.ts.map +1 -1
- package/dist/better-auth/plugin/lib/build-collections/index.js +2 -2
- package/dist/better-auth/plugin/lib/build-collections/invitations.d.ts +3 -3
- package/dist/better-auth/plugin/lib/build-collections/invitations.d.ts.map +1 -1
- package/dist/better-auth/plugin/lib/build-collections/invitations.js +30 -30
- package/dist/better-auth/plugin/lib/build-collections/jwks.d.ts +3 -3
- package/dist/better-auth/plugin/lib/build-collections/jwks.d.ts.map +1 -1
- package/dist/better-auth/plugin/lib/build-collections/jwks.js +13 -13
- package/dist/better-auth/plugin/lib/build-collections/members.d.ts +3 -3
- package/dist/better-auth/plugin/lib/build-collections/members.d.ts.map +1 -1
- package/dist/better-auth/plugin/lib/build-collections/members.js +22 -22
- package/dist/better-auth/plugin/lib/build-collections/oauth-access-tokens.d.ts +3 -3
- package/dist/better-auth/plugin/lib/build-collections/oauth-access-tokens.d.ts.map +1 -1
- package/dist/better-auth/plugin/lib/build-collections/oauth-access-tokens.js +33 -33
- package/dist/better-auth/plugin/lib/build-collections/oauth-applications.d.ts +3 -3
- package/dist/better-auth/plugin/lib/build-collections/oauth-applications.d.ts.map +1 -1
- package/dist/better-auth/plugin/lib/build-collections/oauth-applications.js +40 -40
- package/dist/better-auth/plugin/lib/build-collections/oauth-consents.d.ts +3 -3
- package/dist/better-auth/plugin/lib/build-collections/oauth-consents.d.ts.map +1 -1
- package/dist/better-auth/plugin/lib/build-collections/oauth-consents.js +20 -20
- package/dist/better-auth/plugin/lib/build-collections/organizations.d.ts +3 -3
- package/dist/better-auth/plugin/lib/build-collections/organizations.d.ts.map +1 -1
- package/dist/better-auth/plugin/lib/build-collections/organizations.js +21 -21
- package/dist/better-auth/plugin/lib/build-collections/passkeys.d.ts +3 -3
- package/dist/better-auth/plugin/lib/build-collections/passkeys.d.ts.map +1 -1
- package/dist/better-auth/plugin/lib/build-collections/passkeys.js +37 -37
- package/dist/better-auth/plugin/lib/build-collections/sessions.d.ts +3 -3
- package/dist/better-auth/plugin/lib/build-collections/sessions.d.ts.map +1 -1
- package/dist/better-auth/plugin/lib/build-collections/sessions.js +33 -33
- package/dist/better-auth/plugin/lib/build-collections/sso-providers.d.ts +3 -3
- package/dist/better-auth/plugin/lib/build-collections/sso-providers.d.ts.map +1 -1
- package/dist/better-auth/plugin/lib/build-collections/sso-providers.js +29 -29
- package/dist/better-auth/plugin/lib/build-collections/teams.d.ts +3 -3
- package/dist/better-auth/plugin/lib/build-collections/teams.d.ts.map +1 -1
- package/dist/better-auth/plugin/lib/build-collections/teams.js +13 -13
- package/dist/better-auth/plugin/lib/build-collections/two-factors.d.ts +3 -3
- package/dist/better-auth/plugin/lib/build-collections/two-factors.d.ts.map +1 -1
- package/dist/better-auth/plugin/lib/build-collections/two-factors.js +17 -17
- package/dist/better-auth/plugin/lib/build-collections/users/better-auth-strategy.d.ts +1 -1
- package/dist/better-auth/plugin/lib/build-collections/users/better-auth-strategy.d.ts.map +1 -1
- package/dist/better-auth/plugin/lib/build-collections/users/better-auth-strategy.js +8 -8
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/generate-invite-url.d.ts +3 -4
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/generate-invite-url.d.ts.map +1 -1
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/generate-invite-url.js +12 -11
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/refresh-token.d.ts +1 -1
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/refresh-token.d.ts.map +1 -1
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/refresh-token.js +19 -18
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/send-invite-url.d.ts +3 -2
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/send-invite-url.d.ts.map +1 -1
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/send-invite-url.js +28 -6
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/set-admin-role.d.ts +2 -2
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/set-admin-role.d.ts.map +1 -1
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/set-admin-role.js +9 -8
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/signup.d.ts +2 -2
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/signup.d.ts.map +1 -1
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/signup.js +34 -30
- package/dist/better-auth/plugin/lib/build-collections/users/hooks/after-login.d.ts +1 -1
- package/dist/better-auth/plugin/lib/build-collections/users/hooks/after-login.d.ts.map +1 -1
- package/dist/better-auth/plugin/lib/build-collections/users/hooks/after-login.js +7 -6
- package/dist/better-auth/plugin/lib/build-collections/users/hooks/after-logout.d.ts +1 -1
- package/dist/better-auth/plugin/lib/build-collections/users/hooks/after-logout.d.ts.map +1 -1
- package/dist/better-auth/plugin/lib/build-collections/users/hooks/after-logout.js +11 -11
- package/dist/better-auth/plugin/lib/build-collections/users/hooks/before-delete.d.ts +2 -2
- package/dist/better-auth/plugin/lib/build-collections/users/hooks/before-delete.d.ts.map +1 -1
- package/dist/better-auth/plugin/lib/build-collections/users/hooks/before-delete.js +2 -2
- package/dist/better-auth/plugin/lib/build-collections/users/hooks/before-login.d.ts +1 -1
- package/dist/better-auth/plugin/lib/build-collections/users/hooks/before-login.d.ts.map +1 -1
- package/dist/better-auth/plugin/lib/build-collections/users/hooks/before-login.js +3 -3
- package/dist/better-auth/plugin/lib/build-collections/users/hooks/on-verified-change.d.ts +1 -1
- package/dist/better-auth/plugin/lib/build-collections/users/hooks/on-verified-change.d.ts.map +1 -1
- package/dist/better-auth/plugin/lib/build-collections/users/hooks/on-verified-change.js +1 -1
- package/dist/better-auth/plugin/lib/build-collections/users/hooks/sync-account.d.ts +1 -1
- package/dist/better-auth/plugin/lib/build-collections/users/hooks/sync-account.d.ts.map +1 -1
- package/dist/better-auth/plugin/lib/build-collections/users/hooks/sync-account.js +9 -9
- package/dist/better-auth/plugin/lib/build-collections/users/index.d.ts +3 -3
- package/dist/better-auth/plugin/lib/build-collections/users/index.d.ts.map +1 -1
- package/dist/better-auth/plugin/lib/build-collections/users/index.js +84 -94
- package/dist/better-auth/plugin/lib/build-collections/utils/get-timestamp-fields.d.ts +1 -1
- package/dist/better-auth/plugin/lib/build-collections/utils/get-timestamp-fields.d.ts.map +1 -1
- package/dist/better-auth/plugin/lib/build-collections/utils/get-timestamp-fields.js +7 -7
- package/dist/better-auth/plugin/lib/build-collections/utils/payload-access.d.ts +1 -1
- package/dist/better-auth/plugin/lib/build-collections/utils/payload-access.d.ts.map +1 -1
- package/dist/better-auth/plugin/lib/build-collections/utils/payload-access.js +9 -9
- package/dist/better-auth/plugin/lib/build-collections/verifications.d.ts +3 -3
- package/dist/better-auth/plugin/lib/build-collections/verifications.d.ts.map +1 -1
- package/dist/better-auth/plugin/lib/build-collections/verifications.js +17 -17
- package/dist/better-auth/plugin/lib/get-payload-auth.d.ts +2 -2
- package/dist/better-auth/plugin/lib/get-payload-auth.d.ts.map +1 -1
- package/dist/better-auth/plugin/lib/get-payload-auth.js +1 -1
- package/dist/better-auth/plugin/lib/get-required-collection-slugs.d.ts +2 -2
- package/dist/better-auth/plugin/lib/get-required-collection-slugs.d.ts.map +1 -1
- package/dist/better-auth/plugin/lib/get-required-collection-slugs.js +7 -7
- package/dist/better-auth/plugin/lib/init-better-auth.d.ts +4 -4
- package/dist/better-auth/plugin/lib/init-better-auth.d.ts.map +1 -1
- package/dist/better-auth/plugin/lib/init-better-auth.js +1 -1
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/admin-plugin.d.ts +1 -1
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/admin-plugin.d.ts.map +1 -1
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/admin-plugin.js +3 -3
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/api-key-plugin.js +3 -3
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/index.d.ts +4 -4
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/index.d.ts.map +1 -1
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/index.js +28 -12
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/oidc-plugin.js +10 -11
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/organizations-plugin.js +15 -16
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/passkey-plugin.js +3 -3
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/sso-plugin.js +3 -3
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/ensure-password-set-before-create.d.ts +1 -1
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/ensure-password-set-before-create.d.ts.map +1 -1
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/ensure-password-set-before-create.js +7 -6
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/password.d.ts +1 -1
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/password.d.ts.map +1 -1
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/password.js +7 -6
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/require-admin-invite-for-sign-up-middleware.d.ts +10 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/require-admin-invite-for-sign-up-middleware.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/require-admin-invite-for-sign-up-middleware.js +43 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/save-to-jwt-middleware.d.ts +4 -4
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/save-to-jwt-middleware.d.ts.map +1 -1
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/save-to-jwt-middleware.js +9 -4
- package/dist/better-auth/plugin/lib/set-login-methods.d.ts +5 -0
- package/dist/better-auth/plugin/lib/set-login-methods.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/set-login-methods.js +16 -0
- package/dist/better-auth/plugin/payload/components/admin-buttons/index.d.ts +4 -4
- package/dist/better-auth/plugin/payload/components/admin-buttons/index.d.ts.map +1 -1
- package/dist/better-auth/plugin/payload/components/admin-buttons/index.js +19 -20
- package/dist/better-auth/plugin/payload/components/admin-invite-button/index.d.ts +4 -4
- package/dist/better-auth/plugin/payload/components/admin-invite-button/index.d.ts.map +1 -1
- package/dist/better-auth/plugin/payload/components/admin-invite-button/index.js +59 -42
- package/dist/better-auth/plugin/payload/components/admin-invite-button/index.scss +7 -6
- package/dist/better-auth/plugin/payload/components/logout-button.d.ts +2 -3
- package/dist/better-auth/plugin/payload/components/logout-button.d.ts.map +1 -1
- package/dist/better-auth/plugin/payload/components/logout-button.js +8 -11
- package/dist/better-auth/plugin/payload/components/rsc-redirect.d.ts +1 -1
- package/dist/better-auth/plugin/payload/components/rsc-redirect.d.ts.map +1 -1
- package/dist/better-auth/plugin/payload/components/rsc-redirect.js +1 -1
- package/dist/better-auth/plugin/payload/components/social-provider-buttons/index.d.ts +14 -0
- package/dist/better-auth/plugin/payload/components/social-provider-buttons/index.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/components/social-provider-buttons/index.js +142 -0
- package/dist/better-auth/plugin/payload/components/{admin-social-provider-buttons → social-provider-buttons}/index.scss +4 -1
- package/dist/better-auth/plugin/payload/components/token-field.d.ts +2 -2
- package/dist/better-auth/plugin/payload/components/token-field.d.ts.map +1 -1
- package/dist/better-auth/plugin/payload/components/token-field.js +3 -3
- package/dist/better-auth/plugin/payload/exports/client.d.ts +5 -6
- package/dist/better-auth/plugin/payload/exports/client.d.ts.map +1 -1
- package/dist/better-auth/plugin/payload/exports/client.js +6 -7
- package/dist/better-auth/plugin/payload/exports/rsc.d.ts +6 -9
- package/dist/better-auth/plugin/payload/exports/rsc.d.ts.map +1 -1
- package/dist/better-auth/plugin/payload/exports/rsc.js +5 -8
- package/dist/better-auth/plugin/payload/utils/generate-admin-invite-url.d.ts +1 -1
- package/dist/better-auth/plugin/payload/utils/generate-admin-invite-url.d.ts.map +1 -1
- package/dist/better-auth/plugin/payload/utils/generate-admin-invite-url.js +6 -5
- package/dist/better-auth/plugin/payload/utils/generate-metadata.d.ts +3 -3
- package/dist/better-auth/plugin/payload/utils/generate-metadata.d.ts.map +1 -1
- package/dist/better-auth/plugin/payload/utils/generate-metadata.js +18 -18
- package/dist/better-auth/plugin/payload/utils/get-safe-redirect.d.ts.map +1 -1
- package/dist/better-auth/plugin/payload/utils/get-safe-redirect.js +1 -1
- package/dist/better-auth/plugin/payload/views/admin-login/client.d.ts +17 -0
- package/dist/better-auth/plugin/payload/views/admin-login/client.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/views/admin-login/client.js +175 -0
- package/dist/better-auth/plugin/payload/views/admin-login/index.d.ts +11 -0
- package/dist/better-auth/plugin/payload/views/admin-login/index.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/views/admin-login/index.js +125 -0
- package/dist/better-auth/plugin/payload/views/admin-signup/client.d.ts +15 -0
- package/dist/better-auth/plugin/payload/views/admin-signup/client.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/views/admin-signup/client.js +156 -0
- package/dist/better-auth/plugin/payload/views/admin-signup/index.d.ts +11 -0
- package/dist/better-auth/plugin/payload/views/admin-signup/index.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/views/admin-signup/index.js +71 -0
- package/dist/better-auth/plugin/payload/views/forgot-password/client.d.ts +4 -7
- package/dist/better-auth/plugin/payload/views/forgot-password/client.d.ts.map +1 -1
- package/dist/better-auth/plugin/payload/views/forgot-password/client.js +70 -100
- package/dist/better-auth/plugin/payload/views/forgot-password/index.d.ts +6 -6
- package/dist/better-auth/plugin/payload/views/forgot-password/index.d.ts.map +1 -1
- package/dist/better-auth/plugin/payload/views/forgot-password/index.js +23 -34
- package/dist/better-auth/plugin/payload/views/reset-password/client.d.ts +4 -2
- package/dist/better-auth/plugin/payload/views/reset-password/client.d.ts.map +1 -1
- package/dist/better-auth/plugin/payload/views/reset-password/client.js +88 -53
- package/dist/better-auth/plugin/payload/views/reset-password/index.d.ts +2 -2
- package/dist/better-auth/plugin/payload/views/reset-password/index.d.ts.map +1 -1
- package/dist/better-auth/plugin/payload/views/reset-password/index.js +51 -56
- package/dist/better-auth/plugin/types.d.ts +58 -31
- package/dist/better-auth/plugin/types.d.ts.map +1 -1
- package/dist/better-auth/plugin/types.js +1 -1
- package/dist/better-auth/types.js +2 -2
- package/dist/clerk/admin-ui.js +4 -4
- package/dist/clerk/index.js +5 -5
- package/dist/clerk/plugin/auth-strategy.js +4 -4
- package/dist/clerk/plugin/collections/users/access.js +1 -1
- package/dist/clerk/plugin/collections/users/endpoints/sync-from-clerk.d.ts +2 -2
- package/dist/clerk/plugin/collections/users/endpoints/sync-from-clerk.d.ts.map +1 -1
- package/dist/clerk/plugin/collections/users/endpoints/sync-from-clerk.js +9 -9
- package/dist/clerk/plugin/collections/users/endpoints/webhook/handlers/index.js +4 -4
- package/dist/clerk/plugin/collections/users/endpoints/webhook/handlers/userCreated.d.ts.map +1 -1
- package/dist/clerk/plugin/collections/users/endpoints/webhook/handlers/userCreated.js +2 -2
- package/dist/clerk/plugin/collections/users/endpoints/webhook/handlers/userDeleted.d.ts.map +1 -1
- package/dist/clerk/plugin/collections/users/endpoints/webhook/handlers/userDeleted.js +2 -2
- package/dist/clerk/plugin/collections/users/endpoints/webhook/handlers/userUpdated.d.ts.map +1 -1
- package/dist/clerk/plugin/collections/users/endpoints/webhook/handlers/userUpdated.js +2 -2
- package/dist/clerk/plugin/collections/users/endpoints/webhook/index.d.ts.map +1 -1
- package/dist/clerk/plugin/collections/users/endpoints/webhook/index.js +5 -4
- package/dist/clerk/plugin/collections/users/fields.js +1 -1
- package/dist/clerk/plugin/collections/users/index.d.ts +1 -1
- package/dist/clerk/plugin/collections/users/index.d.ts.map +1 -1
- package/dist/clerk/plugin/collections/users/index.js +7 -7
- package/dist/clerk/plugin/components/after-login-form.js +4 -4
- package/dist/clerk/plugin/components/logout-button.d.ts.map +1 -1
- package/dist/clerk/plugin/components/logout-button.js +17 -17
- package/dist/clerk/plugin/components/sync-clerk-users-button.d.ts +1 -1
- package/dist/clerk/plugin/components/sync-clerk-users-button.d.ts.map +1 -1
- package/dist/clerk/plugin/components/sync-clerk-users-button.js +8 -8
- package/dist/clerk/plugin.d.ts +4 -4
- package/dist/clerk/plugin.d.ts.map +1 -1
- package/dist/clerk/plugin.js +4 -4
- package/dist/clerk/types.js +1 -1
- package/dist/clerk/utils/clerk-user.d.ts.map +1 -1
- package/dist/clerk/utils/clerk-user.js +1 -1
- package/dist/clerk/utils/index.js +4 -4
- package/dist/clerk/utils/load-clerk-instance.d.ts.map +1 -1
- package/dist/clerk/utils/load-clerk-instance.js +2 -2
- package/dist/clerk/utils/svix.d.ts +1 -1
- package/dist/clerk/utils/svix.d.ts.map +1 -1
- package/dist/clerk/utils/svix.js +2 -2
- package/dist/clerk/utils/user.d.ts.map +1 -1
- package/dist/clerk/utils/user.js +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/kinde/index.d.ts.map +1 -1
- package/dist/kinde/index.js +2 -2
- package/dist/{better-auth/plugin/payload → shared}/components/icons.d.ts +3 -3
- package/dist/shared/components/icons.d.ts.map +1 -0
- package/dist/shared/components/icons.js +437 -0
- package/dist/shared/components/logo.d.ts +4 -0
- package/dist/shared/components/logo.d.ts.map +1 -0
- package/dist/shared/components/logo.js +24 -0
- package/dist/shared/form/components/submit.d.ts +8 -0
- package/dist/shared/form/components/submit.d.ts.map +1 -0
- package/dist/shared/form/components/submit.js +21 -0
- package/dist/shared/form/fields/text-field.d.ts +8 -0
- package/dist/shared/form/fields/text-field.d.ts.map +1 -0
- package/dist/shared/form/fields/text-field.js +41 -0
- package/dist/shared/form/index.d.ts +34 -0
- package/dist/shared/form/index.d.ts.map +1 -0
- package/dist/shared/form/index.js +17 -0
- package/dist/shared/form/ui/header/index.d.ts +9 -0
- package/dist/shared/form/ui/header/index.d.ts.map +1 -0
- package/dist/shared/form/ui/header/index.js +24 -0
- package/dist/shared/form/ui/index.d.ts +31 -0
- package/dist/shared/form/ui/index.d.ts.map +1 -0
- package/dist/shared/form/ui/index.js +57 -0
- package/dist/shared/form/ui/index.scss +27 -0
- package/dist/shared/form/validation.d.ts +103 -0
- package/dist/shared/form/validation.d.ts.map +1 -0
- package/dist/shared/form/validation.js +108 -0
- package/dist/shared/index.d.ts +3 -0
- package/dist/shared/index.d.ts.map +1 -0
- package/dist/shared/index.js +4 -0
- package/dist/shared/payload/fields/field-copy-button/index.css +47 -0
- package/dist/shared/payload/fields/field-copy-button/index.d.ts +4 -0
- package/dist/shared/payload/fields/field-copy-button/index.d.ts.map +1 -0
- package/dist/shared/payload/fields/field-copy-button/index.js +38 -0
- package/dist/shared/payload/fields/generate-uuid-button/index.css +14 -0
- package/dist/shared/payload/fields/generate-uuid-button/index.d.ts +4 -0
- package/dist/shared/payload/fields/generate-uuid-button/index.d.ts.map +1 -0
- package/dist/shared/payload/fields/generate-uuid-button/index.js +26 -0
- package/dist/shared/payload/fields/index.d.ts +3 -0
- package/dist/shared/payload/fields/index.d.ts.map +1 -0
- package/dist/shared/payload/fields/index.js +4 -0
- package/dist/shared/utils/regex.d.ts +3 -0
- package/dist/shared/utils/regex.d.ts.map +1 -0
- package/dist/shared/utils/regex.js +4 -0
- package/dist/shared/utils/try-catch.d.ts +12 -0
- package/dist/shared/utils/try-catch.d.ts.map +1 -0
- package/dist/shared/utils/try-catch.js +17 -0
- package/package.json +7 -5
- package/dist/better-auth/plugin/helpers/get-admin-routes.d.ts +0 -14
- package/dist/better-auth/plugin/helpers/get-admin-routes.d.ts.map +0 -1
- package/dist/better-auth/plugin/helpers/get-admin-routes.js +0 -6
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/forgot-password.d.ts +0 -3
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/forgot-password.d.ts.map +0 -1
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/forgot-password.js +0 -96
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/login.d.ts +0 -4
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/login.d.ts.map +0 -1
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/login.js +0 -115
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/reset-password.d.ts +0 -3
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/reset-password.d.ts.map +0 -1
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/reset-password.js +0 -62
- package/dist/better-auth/plugin/lib/constants.d.ts.map +0 -1
- package/dist/better-auth/plugin/lib/constants.js +0 -56
- package/dist/better-auth/plugin/payload/components/admin-social-provider-buttons/index.d.ts +0 -14
- package/dist/better-auth/plugin/payload/components/admin-social-provider-buttons/index.d.ts.map +0 -1
- package/dist/better-auth/plugin/payload/components/admin-social-provider-buttons/index.js +0 -111
- package/dist/better-auth/plugin/payload/components/form-header/index.d.ts +0 -9
- package/dist/better-auth/plugin/payload/components/form-header/index.d.ts.map +0 -1
- package/dist/better-auth/plugin/payload/components/form-header/index.js +0 -23
- package/dist/better-auth/plugin/payload/components/icons.d.ts.map +0 -1
- package/dist/better-auth/plugin/payload/components/icons.js +0 -437
- package/dist/better-auth/plugin/payload/components/logo.d.ts +0 -4
- package/dist/better-auth/plugin/payload/components/logo.d.ts.map +0 -1
- package/dist/better-auth/plugin/payload/components/logo.js +0 -24
- package/dist/better-auth/plugin/payload/components/styles.css +0 -73
- package/dist/better-auth/plugin/payload/views/admin-invite/client.d.ts +0 -12
- package/dist/better-auth/plugin/payload/views/admin-invite/client.d.ts.map +0 -1
- package/dist/better-auth/plugin/payload/views/admin-invite/client.js +0 -92
- package/dist/better-auth/plugin/payload/views/admin-invite/index.d.ts +0 -11
- package/dist/better-auth/plugin/payload/views/admin-invite/index.d.ts.map +0 -1
- package/dist/better-auth/plugin/payload/views/admin-invite/index.js +0 -84
- package/dist/better-auth/plugin/payload/views/admin-invite/index.scss +0 -25
- package/dist/better-auth/plugin/payload/views/create-first-admin/client.d.ts +0 -14
- package/dist/better-auth/plugin/payload/views/create-first-admin/client.d.ts.map +0 -1
- package/dist/better-auth/plugin/payload/views/create-first-admin/client.js +0 -95
- package/dist/better-auth/plugin/payload/views/create-first-admin/index.d.ts +0 -12
- package/dist/better-auth/plugin/payload/views/create-first-admin/index.d.ts.map +0 -1
- package/dist/better-auth/plugin/payload/views/create-first-admin/index.js +0 -144
- package/dist/better-auth/plugin/payload/views/create-first-admin/index.scss +0 -29
- package/dist/better-auth/plugin/payload/views/forgot-password/index.scss +0 -0
- package/dist/better-auth/plugin/payload/views/inactivity/index.d.ts +0 -5
- package/dist/better-auth/plugin/payload/views/inactivity/index.d.ts.map +0 -1
- package/dist/better-auth/plugin/payload/views/inactivity/index.js +0 -12
- package/dist/better-auth/plugin/payload/views/login/form/fields/login-field.d.ts +0 -9
- package/dist/better-auth/plugin/payload/views/login/form/fields/login-field.d.ts.map +0 -1
- package/dist/better-auth/plugin/payload/views/login/form/fields/login-field.js +0 -54
- package/dist/better-auth/plugin/payload/views/login/form/fields/password/index.d.ts +0 -1
- package/dist/better-auth/plugin/payload/views/login/form/fields/password/index.d.ts.map +0 -1
- package/dist/better-auth/plugin/payload/views/login/form/fields/password/index.js +0 -121
- package/dist/better-auth/plugin/payload/views/login/form/fields/password/index.scss +0 -31
- package/dist/better-auth/plugin/payload/views/login/form/fields/password/types.d.ts +0 -56
- package/dist/better-auth/plugin/payload/views/login/form/fields/password/types.d.ts.map +0 -1
- package/dist/better-auth/plugin/payload/views/login/form/fields/password/types.js +0 -3
- package/dist/better-auth/plugin/payload/views/login/form/index.d.ts +0 -17
- package/dist/better-auth/plugin/payload/views/login/form/index.d.ts.map +0 -1
- package/dist/better-auth/plugin/payload/views/login/form/index.js +0 -137
- package/dist/better-auth/plugin/payload/views/login/form/index.scss +0 -23
- package/dist/better-auth/plugin/payload/views/login/index.d.ts +0 -11
- package/dist/better-auth/plugin/payload/views/login/index.d.ts.map +0 -1
- package/dist/better-auth/plugin/payload/views/login/index.js +0 -98
- package/dist/better-auth/plugin/payload/views/login/index.scss +0 -10
- package/dist/better-auth/plugin/payload/views/logout/client.d.ts +0 -8
- package/dist/better-auth/plugin/payload/views/logout/client.d.ts.map +0 -1
- package/dist/better-auth/plugin/payload/views/logout/client.js +0 -76
- package/dist/better-auth/plugin/payload/views/logout/index.d.ts +0 -8
- package/dist/better-auth/plugin/payload/views/logout/index.d.ts.map +0 -1
- package/dist/better-auth/plugin/payload/views/logout/index.js +0 -14
- package/dist/better-auth/plugin/payload/views/logout/index.scss +0 -0
- package/dist/better-auth/plugin/payload/views/reset-password/index.scss +0 -9
- package/dist/better-auth/plugin/payload/views/reset-password/metadata.d.ts +0 -3
- package/dist/better-auth/plugin/payload/views/reset-password/metadata.d.ts.map +0 -1
- package/dist/better-auth/plugin/payload/views/reset-password/metadata.js +0 -11
- /package/dist/{better-auth/plugin/payload/components/form-header → shared/form/ui/header}/index.scss +0 -0
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { baseCollectionSlugs, betterAuthPluginSlugs } from "
|
|
1
|
+
import { baseCollectionSlugs, betterAuthPluginSlugs } from "../../constants";
|
|
2
2
|
export function configureOrganizationPlugin(plugin) {
|
|
3
3
|
plugin.schema = plugin?.schema ?? {};
|
|
4
|
-
// Initialize missing schema objects
|
|
5
4
|
[
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
'organization',
|
|
6
|
+
'member',
|
|
7
|
+
'invitation',
|
|
8
|
+
'team',
|
|
9
|
+
'session'
|
|
11
10
|
].forEach((key)=>{
|
|
12
11
|
if (!plugin.schema[key]) plugin.schema[key] = {};
|
|
13
12
|
});
|
|
@@ -27,15 +26,15 @@ export function configureOrganizationPlugin(plugin) {
|
|
|
27
26
|
...plugin?.schema?.member?.fields ?? {},
|
|
28
27
|
organizationId: {
|
|
29
28
|
...plugin?.schema?.member?.fields?.organizationId ?? {},
|
|
30
|
-
fieldName:
|
|
29
|
+
fieldName: 'organization'
|
|
31
30
|
},
|
|
32
31
|
userId: {
|
|
33
32
|
...plugin?.schema?.member?.fields?.userId ?? {},
|
|
34
|
-
fieldName:
|
|
33
|
+
fieldName: 'user'
|
|
35
34
|
},
|
|
36
35
|
teamId: {
|
|
37
36
|
...plugin?.schema?.member?.fields?.teamId ?? {},
|
|
38
|
-
fieldName:
|
|
37
|
+
fieldName: 'team'
|
|
39
38
|
}
|
|
40
39
|
}
|
|
41
40
|
},
|
|
@@ -46,15 +45,15 @@ export function configureOrganizationPlugin(plugin) {
|
|
|
46
45
|
...plugin?.schema?.invitation?.fields ?? {},
|
|
47
46
|
organizationId: {
|
|
48
47
|
...plugin?.schema?.invitation?.fields?.organizationId ?? {},
|
|
49
|
-
fieldName:
|
|
48
|
+
fieldName: 'organization'
|
|
50
49
|
},
|
|
51
50
|
inviterId: {
|
|
52
51
|
...plugin?.schema?.invitation?.fields?.inviterId ?? {},
|
|
53
|
-
fieldName:
|
|
52
|
+
fieldName: 'inviter'
|
|
54
53
|
},
|
|
55
54
|
teamId: {
|
|
56
55
|
...plugin?.schema?.invitation?.fields?.teamId ?? {},
|
|
57
|
-
fieldName:
|
|
56
|
+
fieldName: 'team'
|
|
58
57
|
}
|
|
59
58
|
}
|
|
60
59
|
},
|
|
@@ -65,7 +64,7 @@ export function configureOrganizationPlugin(plugin) {
|
|
|
65
64
|
...plugin?.schema?.team?.fields ?? {},
|
|
66
65
|
organizationId: {
|
|
67
66
|
...plugin?.schema?.team?.fields?.organizationId ?? {},
|
|
68
|
-
fieldName:
|
|
67
|
+
fieldName: 'organization'
|
|
69
68
|
}
|
|
70
69
|
}
|
|
71
70
|
},
|
|
@@ -76,11 +75,11 @@ export function configureOrganizationPlugin(plugin) {
|
|
|
76
75
|
...plugin?.schema?.session?.fields ?? {},
|
|
77
76
|
activeOrganizationId: {
|
|
78
77
|
...plugin?.schema?.session?.fields?.activeOrganizationId ?? {},
|
|
79
|
-
fieldName:
|
|
78
|
+
fieldName: 'activeOrganization'
|
|
80
79
|
}
|
|
81
80
|
}
|
|
82
81
|
}
|
|
83
82
|
};
|
|
84
83
|
}
|
|
85
84
|
|
|
86
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
85
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3NyYy9iZXR0ZXItYXV0aC9wbHVnaW4vbGliL3Nhbml0aXplLWJldHRlci1hdXRoLW9wdGlvbnMvb3JnYW5pemF0aW9ucy1wbHVnaW4udHMiXSwic291cmNlc0Nvb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HQUFHakIsT0FBT0MsTUFBTSxDQUFDZ0IsSUFBSTtZQUNyQlosV0FBV1Asc0JBQXNCb0IsS0FBSztZQUN0Q1gsUUFBUTtnQkFDTixHQUFJUCxRQUFRQyxRQUFRZ0IsTUFBTVYsVUFBVSxDQUFDLENBQUM7Z0JBQ3RDRyxnQkFBZ0I7b0JBQ2QsR0FBSVYsUUFBUUMsUUFBUWdCLE1BQU1WLFFBQVFHLGtCQUFrQixDQUFDLENBQUM7b0JBQ3REQyxXQUFXO2dCQUNiO1lBQ0Y7UUFDRjtRQUNBUSxTQUFTO1lBQ1AsR0FBR25CLFFBQVFDLFFBQVFrQixPQUFPO1lBQzFCZCxXQUFXUixvQkFBb0J1QixRQUFRO1lBQ3ZDYixRQUFRO2dCQUNOLEdBQUlQLFFBQVFDLFFBQVFrQixTQUFTWixVQUFVLENBQUMsQ0FBQztnQkFDekNjLHNCQUFzQjtvQkFDcEIsR0FBSXJCLFFBQVFDLFFBQVFrQixTQUFTWixRQUFRYyx3QkFBd0IsQ0FBQyxDQUFDO29CQUMvRFYsV0FBVztnQkFDYjtZQUNGO1FBQ0Y7SUFDRjtBQUNGIn0=
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { betterAuthPluginSlugs } from "
|
|
1
|
+
import { betterAuthPluginSlugs } from "../../constants";
|
|
2
2
|
export function configurePasskeyPlugin(plugin) {
|
|
3
3
|
plugin.schema = plugin?.schema ?? {};
|
|
4
4
|
plugin.schema.passkey = {
|
|
@@ -8,10 +8,10 @@ export function configurePasskeyPlugin(plugin) {
|
|
|
8
8
|
...plugin?.schema?.passkey?.fields ?? {},
|
|
9
9
|
userId: {
|
|
10
10
|
...plugin?.schema?.passkey?.fields?.userId ?? {},
|
|
11
|
-
fieldName:
|
|
11
|
+
fieldName: 'user'
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
17
|
+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JBQWdDO0FBRXRFLE9BQU8sU0FBU0MsdUJBQXVCQyxNQUFXO0lBQ2hEQSxPQUFPQyxNQUFNLEdBQUdELFFBQVFDLFVBQVUsQ0FBQztJQUNuQ0QsT0FBT0MsTUFBTSxDQUFDQyxPQUFPLEdBQUc7UUFDdEIsR0FBSUYsUUFBUUMsUUFBUUMsV0FBVyxDQUFDLENBQUM7UUFDakNDLFdBQVdMLHNCQUFzQk0sUUFBUTtRQUN6Q0MsUUFBUTtZQUNOLEdBQUlMLFFBQVFDLFFBQVFDLFNBQVNHLFVBQVUsQ0FBQyxDQUFDO1lBQ3pDQyxRQUFRO2dCQUNOLEdBQUlOLFFBQVFDLFFBQVFDLFNBQVNHLFFBQVFDLFVBQVUsQ0FBQyxDQUFDO2dCQUNqREMsV0FBVztZQUNiO1FBQ0Y7SUFDRjtBQUNGIn0=
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { betterAuthPluginSlugs } from "
|
|
1
|
+
import { betterAuthPluginSlugs } from "../../constants";
|
|
2
2
|
export function configureSsoPlugin(plugin) {
|
|
3
3
|
plugin.schema = plugin?.schema ?? {};
|
|
4
4
|
plugin.schema.sso = {
|
|
@@ -8,10 +8,10 @@ export function configureSsoPlugin(plugin) {
|
|
|
8
8
|
...plugin?.schema?.sso?.fields ?? {},
|
|
9
9
|
userId: {
|
|
10
10
|
...plugin?.schema?.sso?.fields?.userId ?? {},
|
|
11
|
-
fieldName:
|
|
11
|
+
fieldName: 'user'
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
17
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3NyYy9iZXR0ZXItYXV0aC9wbHVnaW4vbGliL3Nhbml0aXplLWJldHRlci1hdXRoLW9wdGlvbnMvc3NvLXBsdWdpbi50c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LENBQUM7UUFDN0JDLFdBQVdMLHNCQUFzQk0sWUFBWTtRQUM3Q0MsUUFBUTtZQUNOLEdBQUlMLFFBQVFDLFFBQVFDLEtBQUtHLFVBQVUsQ0FBQyxDQUFDO1lBQ3JDQyxRQUFRO2dCQUNOLEdBQUlOLFFBQVFDLFFBQVFDLEtBQUtHLFFBQVFDLFVBQVUsQ0FBQyxDQUFDO2dCQUM3Q0MsV0FBVztZQUNiO1FBQ0Y7SUFDRjtBQUNGIn0=
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SanitizedBetterAuthOptions } from
|
|
1
|
+
import type { SanitizedBetterAuthOptions } from '@/better-auth/plugin/types';
|
|
2
2
|
/**
|
|
3
3
|
* Adds a before hook to the user create operation to ensure the password is set.
|
|
4
4
|
* This is necessary because the password is not set in the user create operation
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ensure-password-set-before-create.d.ts","sourceRoot":"","sources":["../../../../../../src/better-auth/plugin/lib/sanitize-better-auth-options/utils/ensure-password-set-before-create.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"ensure-password-set-before-create.d.ts","sourceRoot":"","sources":["../../../../../../src/better-auth/plugin/lib/sanitize-better-auth-options/utils/ensure-password-set-before-create.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAA;AAE5E;;;;GAIG;AACH,wBAAgB,iCAAiC,CAAC,OAAO,EAAE,0BAA0B,QAoBpF"}
|
|
@@ -3,15 +3,16 @@
|
|
|
3
3
|
* This is necessary because the password is not set in the user create operation
|
|
4
4
|
* and is instead set in the sync password accounts hook.
|
|
5
5
|
*/ export function ensurePasswordSetBeforeUserCreate(options) {
|
|
6
|
-
if (typeof options.databaseHooks !==
|
|
7
|
-
if (typeof options.databaseHooks.user !==
|
|
8
|
-
if (typeof options.databaseHooks.user.create !==
|
|
6
|
+
if (typeof options.databaseHooks !== 'object') options.databaseHooks = {};
|
|
7
|
+
if (typeof options.databaseHooks.user !== 'object') options.databaseHooks.user = {};
|
|
8
|
+
if (typeof options.databaseHooks.user.create !== 'object') options.databaseHooks.user.create = {};
|
|
9
9
|
const initialBeforeUserCreateHook = options.databaseHooks.user.create.before ?? null;
|
|
10
10
|
options.databaseHooks.user.create.before = async (user, ctx)=>{
|
|
11
11
|
if (!user.password) {
|
|
12
|
-
|
|
12
|
+
;
|
|
13
|
+
user.password = ctx?.body?.password ?? Array(3).fill(0).map(()=>Math.random().toString(36).slice(2)).join('');
|
|
13
14
|
}
|
|
14
|
-
if (typeof initialBeforeUserCreateHook ===
|
|
15
|
+
if (typeof initialBeforeUserCreateHook === 'function') {
|
|
15
16
|
return initialBeforeUserCreateHook(user, ctx);
|
|
16
17
|
}
|
|
17
18
|
return {
|
|
@@ -20,4 +21,4 @@
|
|
|
20
21
|
};
|
|
21
22
|
}
|
|
22
23
|
|
|
23
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
24
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3NyYy9iZXR0ZXItYXV0aC9wbHVnaW4vbGliL3Nhbml0aXplLWJldHRlci1hdXRoLW9wdGlvbnMvdXRpbHMvZW5zdXJlLXBhc3N3b3JkLXNldC1iZWZvcmUtY3JlYXRlLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB0eXBlIHsgU2FuaXRpemVkQmV0dGVyQXV0aE9wdGlvbnMgfSBmcm9tICdAL2JldHRlci1hdXRoL3BsdWdpbi90eXBlcydcblxuLyoqXG4gKiBBZGRzIGEgYmVmb3JlIGhvb2sgdG8gdGhlIHVzZXIgY3JlYXRlIG9wZXJhdGlvbiB0byBlbnN1cmUgdGhlIHBhc3N3b3JkIGlzIHNldC5cbiAqIFRoaXMgaXMgbmVjZXNzYXJ5IGJlY2F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JO0lBRWhGTCxRQUFRQyxhQUFhLENBQUNDLElBQUksQ0FBQ0MsTUFBTSxDQUFDRSxNQUFNLEdBQUcsT0FBT0gsTUFBTUk7UUFDdEQsSUFBSSxDQUFDLEFBQUNKLEtBQWFLLFFBQVEsRUFBRTs7WUFDekJMLEtBQWFLLFFBQVEsR0FDckJELEtBQUtFLE1BQU1ELFlBQ1hFLE1BQU0sR0FDSEMsSUFBSSxDQUFDLEdBQ0xDLEdBQUcsQ0FBQyxJQUFNQyxLQUFLQyxNQUFNLEdBQUdDLFFBQVEsQ0FBQyxJQUFJQyxLQUFLLENBQUMsSUFDM0NDLElBQUksQ0FBQztRQUNaO1FBQ0EsSUFBSSxPQUFPWixnQ0FBZ0MsWUFBWTtZQUNyRCxPQUFPQSw0QkFBNEJGLE1BQU1JO1FBQzNDO1FBQ0EsT0FBTztZQUFFVyxNQUFNZjtRQUFLO0lBQ3RCO0FBQ0YifQ==
|
|
@@ -18,7 +18,7 @@ export declare const hashPassword: (password: string) => Promise<string>;
|
|
|
18
18
|
* @param params Object containing the hash and password
|
|
19
19
|
* @returns Boolean indicating if the password matches
|
|
20
20
|
*/
|
|
21
|
-
export declare const verifyPassword: ({ hash, password, salt
|
|
21
|
+
export declare const verifyPassword: ({ hash, password, salt }: {
|
|
22
22
|
hash: string;
|
|
23
23
|
password: string;
|
|
24
24
|
salt?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"password.d.ts","sourceRoot":"","sources":["../../../../../../src/better-auth/plugin/lib/sanitize-better-auth-options/utils/password.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"password.d.ts","sourceRoot":"","sources":["../../../../../../src/better-auth/plugin/lib/sanitize-better-auth-options/utils/password.ts"],"names":[],"mappings":"AAqBA;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,GAAU,UAAU,MAAM,KAAG,OAAO,CAAC,MAAM,CAQnE,CAAA;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc,GAAU,0BAA0B;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,KAAG,OAAO,CAAC,OAAO,CAyBjI,CAAA"}
|
|
@@ -5,7 +5,7 @@ import crypto from "crypto";
|
|
|
5
5
|
* This generates a hash compatible with Payload's internal auth system
|
|
6
6
|
* so that passwords set via better-auth can be used with Payload admin panel
|
|
7
7
|
*/ function pbkdf2Promisified(password, salt) {
|
|
8
|
-
return new Promise((resolve, reject)=>crypto.pbkdf2(password, salt, 25000, 512,
|
|
8
|
+
return new Promise((resolve, reject)=>crypto.pbkdf2(password, salt, 25000, 512, 'sha256', (err, hashRaw)=>err ? reject(err) : resolve(hashRaw)));
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
11
|
* Generates random bytes for the salt
|
|
@@ -22,9 +22,9 @@ import crypto from "crypto";
|
|
|
22
22
|
* @returns A string in the format {salt}:{hash}
|
|
23
23
|
*/ export const hashPassword = async (password)=>{
|
|
24
24
|
const saltBuffer = await randomBytes();
|
|
25
|
-
const salt = saltBuffer.toString(
|
|
25
|
+
const salt = saltBuffer.toString('hex');
|
|
26
26
|
const hashRaw = await pbkdf2Promisified(password, salt);
|
|
27
|
-
const hash = hashRaw.toString(
|
|
27
|
+
const hash = hashRaw.toString('hex');
|
|
28
28
|
return `${salt}:${hash}`;
|
|
29
29
|
};
|
|
30
30
|
/**
|
|
@@ -45,18 +45,19 @@ import crypto from "crypto";
|
|
|
45
45
|
storedHash = hash;
|
|
46
46
|
} else {
|
|
47
47
|
// Otherwise, split the combined format (from account.password)
|
|
48
|
-
const parts = hash.split(
|
|
48
|
+
const parts = hash.split(':');
|
|
49
49
|
if (parts.length !== 2) {
|
|
50
50
|
return false;
|
|
51
51
|
}
|
|
52
|
+
;
|
|
52
53
|
[saltValue, storedHash] = parts;
|
|
53
54
|
}
|
|
54
55
|
if (!saltValue || !storedHash) {
|
|
55
56
|
return false;
|
|
56
57
|
}
|
|
57
58
|
const hashRaw = await pbkdf2Promisified(password, saltValue);
|
|
58
|
-
const computedHash = hashRaw.toString(
|
|
59
|
+
const computedHash = hashRaw.toString('hex');
|
|
59
60
|
return storedHash === computedHash;
|
|
60
61
|
};
|
|
61
62
|
|
|
62
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
63
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3NyYy9iZXR0ZXItYXV0aC9wbHVnaW4vbGliL3Nhbml0aXplLWJldHRlci1hdXRoLW9wdGlvbnMvdXRpbHMvcGFzc3dvcmQudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IGNyeXB0byBmcm9tICdjcnlwdG8nXG5cbi8qKlxuICogTWltaWNzIFBheWxvYWQncyBpbnRlcm5hbCBwYXNzd29yZCBoYXNoaW5nIHVzaW5nIHBia2RmMlxuICpcbiAqIFRoaXMgZ2VuZXJhdGVzIGEgaGFzaCBjb21wYXRpYmxlIHdpdGggUGF5bG9hZCdzIGludGVybmFsIGF1dGggc3lzdGVtXG4gKiBzbyB0aGF0IHBhc3N3b3JkcyBzZXQgdmlhIGJldHRlci1hdXRoIGNhbiBiZSB1c2VkIHdpdGggUGF5bG9hZCBhZG1pbiBwYW5lbFxuICovXG5mdW5jdGlvbiBwYmtkZjJQcm9taXNpZmllZChwYXNzd29yZDogc3RyaW5nLCBzYWx0OiBzdHJpbmcpOiBQcm9taXNlPEJ1ZmZlcj4ge1xuICByZXR1cm4gbmV3IFByb21pc2UoKHJlc29sdmUsIHJlamVjdCkgPT5cbiAgICBjcnlwdG8ucGJrZGYyKHBhc3N3b3JkLCBzYWx0LCAyNTAwMCwgNTEyLCAnc2hhMjU2JywgKGVyciwgaGFzaFJhdykgPT4gKGVyciA/IHJlamVjdChlcnIpIDogcmVzb2x2ZShoYXNoUmF3KSkpXG4gIClcbn1cblxu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BQWVaLFFBQVFJLFFBQVEsQ0FBQztJQUV0QyxPQUFPSSxlQUFlSTtBQUN4QixFQUFDIn0=
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BetterAuthPluginOptions } from "@/better-auth/types";
|
|
2
|
+
import type { SanitizedBetterAuthOptions } from "@/better-auth/plugin/types";
|
|
3
|
+
/**
|
|
4
|
+
* Mofies options object and adds a middleware to check for admin invite for sign up
|
|
5
|
+
*/
|
|
6
|
+
export declare const requireAdminInviteForSignUpMiddleware: ({ options, pluginOptions, }: {
|
|
7
|
+
options: SanitizedBetterAuthOptions;
|
|
8
|
+
pluginOptions: BetterAuthPluginOptions;
|
|
9
|
+
}) => Promise<void>;
|
|
10
|
+
//# sourceMappingURL=require-admin-invite-for-sign-up-middleware.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"require-admin-invite-for-sign-up-middleware.d.ts","sourceRoot":"","sources":["../../../../../../src/better-auth/plugin/lib/sanitize-better-auth-options/utils/require-admin-invite-for-sign-up-middleware.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAA;AAG7D,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAA;AAU5E;;GAEG;AACH,eAAO,MAAM,qCAAqC,GAAU,6BAGzD;IACD,OAAO,EAAE,0BAA0B,CAAA;IACnC,aAAa,EAAE,uBAAuB,CAAA;CACvC,kBA4BA,CAAA"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { baseCollectionSlugs } from "../../../constants";
|
|
2
|
+
import { createAuthMiddleware } from "better-auth/api";
|
|
3
|
+
import { APIError } from "better-auth/api";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
const throwUnauthorizedError = ()=>{
|
|
6
|
+
throw new APIError('UNAUTHORIZED', {
|
|
7
|
+
message: 'signup disabled' // mimic: https://github.com/better-auth/better-auth/blob/171fab5273cf38f46cf207b0d99c8ccdda64c2fb/packages/better-auth/src/oauth2/link-account.ts#L108
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Mofies options object and adds a middleware to check for admin invite for sign up
|
|
12
|
+
*/ export const requireAdminInviteForSignUpMiddleware = async ({ options, pluginOptions })=>{
|
|
13
|
+
options.hooks = options.hooks || {};
|
|
14
|
+
const originalBefore = options.hooks.before;
|
|
15
|
+
options.hooks.before = createAuthMiddleware(async (ctx)=>{
|
|
16
|
+
if (ctx.path !== '/sign-up/email' && // not an email sign-up request
|
|
17
|
+
!(ctx.path === '/sign-in/social' && ctx.body?.requestSignUp // not a social sign-in request with sign-up intent
|
|
18
|
+
)) return;
|
|
19
|
+
const adminInviteToken = ctx?.query?.adminInviteToken ?? ctx.body.adminInviteToken;
|
|
20
|
+
if (!!pluginOptions.requireAdminInviteForSignUp && !z.string().uuid().safeParse(adminInviteToken).success) {
|
|
21
|
+
throwUnauthorizedError();
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const query = {
|
|
25
|
+
field: 'token',
|
|
26
|
+
value: adminInviteToken,
|
|
27
|
+
operator: 'eq'
|
|
28
|
+
};
|
|
29
|
+
const isValidAdminInvitation = await ctx.context.adapter.count({
|
|
30
|
+
model: pluginOptions.adminInvitations?.slug ?? baseCollectionSlugs.adminInvitations,
|
|
31
|
+
where: [
|
|
32
|
+
query
|
|
33
|
+
]
|
|
34
|
+
});
|
|
35
|
+
if (isValidAdminInvitation) {
|
|
36
|
+
if (originalBefore) return originalBefore(ctx);
|
|
37
|
+
return ctx;
|
|
38
|
+
}
|
|
39
|
+
throwUnauthorizedError();
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3NyYy9iZXR0ZXItYXV0aC9wbHVnaW4vbGliL3Nhbml0aXplLWJldHRlci1hdXRoLW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sRUFBRWdCLE1BQU0sR0FBR0MsSUFBSSxHQUFHQyxTQUFTLENBQUNMLGtCQUFrQk0sT0FBTyxFQUFFO1lBQ3hHbEI7WUFDQTtRQUNGO1FBQ0EsTUFBTWEsUUFBZTtZQUNuQk0sT0FBTztZQUNQQyxPQUFPUjtZQUNQUyxVQUFVO1FBQ1o7UUFDQSxNQUFNQyx5QkFBeUIsTUFBTWQsSUFBSWUsT0FBTyxDQUFDQyxPQUFPLENBQUNDLEtBQUssQ0FBQztZQUM3REMsT0FBT3RCLGNBQWN1QixnQkFBZ0IsRUFBRUMsUUFBUWhDLG9CQUFvQitCLGdCQUFnQjtZQUNuRkUsT0FBTztnQkFBQ2hCO2FBQU07UUFDaEI7UUFDQSxJQUFHUyx3QkFBd0I7WUFDekIsSUFBR2hCLGdCQUFnQixPQUFPQSxlQUFlRTtZQUN6QyxPQUFPQTtRQUNUO1FBQ0FSO0lBQ0Y7QUFDRixFQUFDIn0=
|
package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/save-to-jwt-middleware.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { Config, Payload } from 'payload';
|
|
2
|
+
import type { SanitizedBetterAuthOptions, BetterAuthPluginOptions } from '@/better-auth/plugin/types';
|
|
3
3
|
/**
|
|
4
4
|
* Sets up a middleware that enforces the saveToJwt configuration when setting session data.
|
|
5
5
|
* This ensures that only fields specified in saveToJwt are included in the cookie cache
|
|
@@ -8,9 +8,9 @@ import type { Config, Payload } from "payload";
|
|
|
8
8
|
* The middleware runs after authentication and filters the session data based on
|
|
9
9
|
* the collection configurations before storing it in the cookie cache.
|
|
10
10
|
*/
|
|
11
|
-
export declare function saveToJwtMiddleware({ sanitizedOptions, payloadConfig, pluginOptions
|
|
11
|
+
export declare function saveToJwtMiddleware({ sanitizedOptions, payloadConfig, pluginOptions }: {
|
|
12
12
|
sanitizedOptions: SanitizedBetterAuthOptions;
|
|
13
|
-
payloadConfig: Payload[
|
|
13
|
+
payloadConfig: Payload['config'] | Config | Promise<Payload['config'] | Config>;
|
|
14
14
|
pluginOptions: BetterAuthPluginOptions;
|
|
15
15
|
}): void;
|
|
16
16
|
//# sourceMappingURL=save-to-jwt-middleware.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"save-to-jwt-middleware.d.ts","sourceRoot":"","sources":["../../../../../../src/better-auth/plugin/lib/sanitize-better-auth-options/utils/save-to-jwt-middleware.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"save-to-jwt-middleware.d.ts","sourceRoot":"","sources":["../../../../../../src/better-auth/plugin/lib/sanitize-better-auth-options/utils/save-to-jwt-middleware.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAC9C,OAAO,KAAK,EAAE,0BAA0B,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAA;AAErG;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,gBAAgB,EAChB,aAAa,EACb,aAAa,EACd,EAAE;IACD,gBAAgB,EAAE,0BAA0B,CAAA;IAC5C,aAAa,EAAE,OAAO,CAAC,QAAQ,CAAC,GAAG,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC,CAAA;IAC/E,aAAa,EAAE,uBAAuB,CAAA;CACvC,QAyBA"}
|
package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/save-to-jwt-middleware.js
CHANGED
|
@@ -9,7 +9,8 @@ import { prepareSessionData } from "../../../helpers/prepare-session-data";
|
|
|
9
9
|
* The middleware runs after authentication and filters the session data based on
|
|
10
10
|
* the collection configurations before storing it in the cookie cache.
|
|
11
11
|
*/ export function saveToJwtMiddleware({ sanitizedOptions, payloadConfig, pluginOptions }) {
|
|
12
|
-
if (typeof sanitizedOptions.hooks !==
|
|
12
|
+
if (typeof sanitizedOptions.hooks !== 'object') sanitizedOptions.hooks = {};
|
|
13
|
+
const originalAfter = sanitizedOptions.hooks.after;
|
|
13
14
|
sanitizedOptions.hooks.after = createAuthMiddleware(async (ctx)=>{
|
|
14
15
|
const newSession = ctx.context?.session ?? ctx.context?.newSession;
|
|
15
16
|
if (!newSession) return;
|
|
@@ -17,14 +18,18 @@ import { prepareSessionData } from "../../../helpers/prepare-session-data";
|
|
|
17
18
|
newSession,
|
|
18
19
|
payloadConfig,
|
|
19
20
|
collectionSlugs: {
|
|
20
|
-
userCollectionSlug: pluginOptions.users?.slug ??
|
|
21
|
-
sessionCollectionSlug: pluginOptions.sessions?.slug ??
|
|
21
|
+
userCollectionSlug: pluginOptions.users?.slug ?? 'users',
|
|
22
|
+
sessionCollectionSlug: pluginOptions.sessions?.slug ?? 'sessions'
|
|
22
23
|
}
|
|
23
24
|
});
|
|
24
25
|
if (filteredSessionData) {
|
|
25
26
|
await setCookieCache(ctx, filteredSessionData);
|
|
26
27
|
}
|
|
28
|
+
if (typeof originalAfter === 'function') {
|
|
29
|
+
return originalAfter(ctx);
|
|
30
|
+
}
|
|
31
|
+
return ctx;
|
|
27
32
|
});
|
|
28
33
|
}
|
|
29
34
|
|
|
30
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
35
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3NyYy9iZXR0ZXItYXV0aC9wbHVnaW4vbGliL3Nhbml0aXplLWJldHRlci1hdXRoLW9wdGlvbnMvdXRpbHMvc2F2ZS10by1qd3QtbWlkZGxld2FyZS50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBzZXRDb29raWVDYWNoZSB9IGZyb20gJ2JldHRlci1hdXRoL2Nvb2tpZXMnXG5pbXBvcnQgeyBjcmVhdGVBdXRoTWlkZGxld2FyZSB9IGZyb20gJ2JldHRlci1hdXRoL2FwaSdc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QXFCLE9BQU9TO1FBQ3pELE1BQU1DLGFBQWFELElBQUlFLE9BQU8sRUFBRUMsV0FBV0gsSUFBSUUsT0FBTyxFQUFFRDtRQUN4RCxJQUFJLENBQUNBLFlBQVk7UUFFakIsTUFBTUcsc0JBQXNCLE1BQU1aLG1CQUFtQjtZQUNuRFM7WUFDQU47WUFDQVUsaUJBQWlCO2dCQUNmQyxvQkFBb0JWLGNBQWNXLEtBQUssRUFBRUMsUUFBUTtnQkFDakRDLHVCQUF1QmIsY0FBY2MsUUFBUSxFQUFFRixRQUFRO1lBQ3pEO1FBQ0Y7UUFFQSxJQUFJSixxQkFBcUI7WUFDdkIsTUFBTWQsZUFBZVUsS0FBS0k7UUFDNUI7UUFDQSxJQUFHLE9BQU9OLGtCQUFrQixZQUFZO1lBQ3RDLE9BQU9BLGNBQWNFO1FBQ3ZCO1FBQ0EsT0FBT0E7SUFDVDtBQUNGIn0=
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-login-methods.d.ts","sourceRoot":"","sources":["../../../../src/better-auth/plugin/lib/set-login-methods.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAe,MAAM,UAAU,CAAC;AAEhE,wBAAgB,eAAe,CAAC,EAC9B,aAAa,EACd,EAAE;IACD,aAAa,EAAE,uBAAuB,CAAA;CACvC,2BAeA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export function setLoginMethods({ pluginOptions }) {
|
|
2
|
+
const betterAuthOptions = pluginOptions.betterAuthOptions;
|
|
3
|
+
const hasBetterAuthPlugin = (pluginId)=>{
|
|
4
|
+
return betterAuthOptions?.plugins?.some((plugin)=>plugin.id === pluginId) || false;
|
|
5
|
+
};
|
|
6
|
+
if (pluginOptions?.admin?.loginMethods) return pluginOptions // If user defined, exit early
|
|
7
|
+
;
|
|
8
|
+
const loginMethods = Object.keys(betterAuthOptions?.socialProviders ?? {});
|
|
9
|
+
if (!!betterAuthOptions?.emailAndPassword || betterAuthOptions?.emailAndPassword?.enabled) loginMethods.push('emailPassword');
|
|
10
|
+
if (hasBetterAuthPlugin('passkey')) loginMethods.push('passkey');
|
|
11
|
+
pluginOptions.admin = pluginOptions.admin ?? {};
|
|
12
|
+
pluginOptions.admin.loginMethods = loginMethods;
|
|
13
|
+
return pluginOptions;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9iZXR0ZXItYXV0aC9wbHVnaW4vbGliL3NldC1sb2dpbi1tZXRob2RzLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IEJldHRlckF1dGhQbHVnaW5PcHRpb25zLCBMb2dpbk1ldGhvZCB9IGZyb20gXCIuLi90eXBlc1wiO1xuXG5leHBvcnQgZnVuY3Rpb24gc2V0TG9naW5NZXRob2RzKHtcbiAgcGx1Z2luT3B0aW9uc1xufToge1xuICBwbHVnaW5PcHRpb25zOiBCZXR0ZXJBdXRoUGx1Z2luT3B0aW9uc1xufSkge1xuICBjb25zdCBiZXR0ZXJBdXRoT3B0aW9ucyA9IHBsdWdpbk9wdGlvbnMuYmV0dGVyQXV0aE9wdGlvbnNcblxuICBjb25zdCBoYXNCZXR0ZXJBdXRoUGx1Z2luID0gKHBsdWdpbklkOiBzdHJpbmcpID0+IHtcbiAgICByZXR1cm4gYmV0dGVyQXV0aE9wdGlvbnM/LnBsdWdpbnM/LnNvbWUoKHBsdWdpbikgPT4gcGx1Z2luLmlkID09PSBwbHVnaW5JZCkgfHwgZmFsc2VcbiAgfVxuXG4gIGlmIChwbHVnaW5PcHRpb25zPy5hZG1pbj8ubG9naW5NZXRob2RzKSByZXR1cm4gcGx1Z2luT3B0aW9ucyAvLyBJZiB1c2VyIGRlZmluZWQsIGV4aXQgZWFybHlcblxuICBjb25zdCBsb2dpbk1ldGhvZHMgPSBPYmplY3Qua2V5cyhiZXR0ZXJ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USxPQUFPQyxjQUFjLE9BQU9ULGNBQWMsOEJBQThCOztJQUUzRixNQUFNUyxlQUFlQyxPQUFPQyxJQUFJLENBQUNWLG1CQUFtQlcsbUJBQW1CLENBQUM7SUFDeEUsSUFBSSxDQUFDLENBQUNYLG1CQUFtQlksb0JBQW9CWixtQkFBbUJZLGtCQUFrQkMsU0FBU0wsYUFBYU0sSUFBSSxDQUFDO0lBQzdHLElBQUliLG9CQUFvQixZQUFZTyxhQUFhTSxJQUFJLENBQUM7SUFDdERmLGNBQWNRLEtBQUssR0FBR1IsY0FBY1EsS0FBSyxJQUFJLENBQUM7SUFDOUNSLGNBQWNRLEtBQUssQ0FBQ0MsWUFBWSxHQUFHQTtJQUNuQyxPQUFPVDtBQUNUIn0=
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './index.scss';
|
|
3
3
|
type AdminButtonsProps = {
|
|
4
4
|
userSlug: string;
|
|
5
5
|
};
|
|
6
|
-
declare const AdminButtons: React.FC<AdminButtonsProps>;
|
|
7
|
-
export
|
|
6
|
+
export declare const AdminButtons: React.FC<AdminButtonsProps>;
|
|
7
|
+
export {};
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/better-auth/plugin/payload/components/admin-buttons/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/better-auth/plugin/payload/components/admin-buttons/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA4B,MAAM,OAAO,CAAA;AAMhD,OAAO,cAAc,CAAA;AAErB,KAAK,iBAAiB,GAAG;IACvB,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAoGpD,CAAA"}
|