@baseplate-dev/plugin-auth 0.6.16 → 0.6.18
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/CHANGELOG.md +36 -0
- package/dist/better-auth/admin/generators/admin-crud-manage-roles-action/admin-crud-manage-roles-action.generator.d.ts +12 -0
- package/dist/better-auth/admin/generators/admin-crud-manage-roles-action/generated/index.d.ts +12 -0
- package/dist/better-auth/admin/generators/admin-crud-manage-roles-action/generated/template-renderers.d.ts +6 -0
- package/dist/better-auth/admin/generators/admin-crud-manage-roles-action/generated/typed-templates.d.ts +6 -0
- package/dist/better-auth/admin/generators/admin-crud-reset-password-action/admin-crud-reset-password-action.generator.d.ts +12 -0
- package/dist/better-auth/admin/generators/admin-crud-reset-password-action/generated/index.d.ts +12 -0
- package/dist/better-auth/admin/generators/admin-crud-reset-password-action/generated/template-renderers.d.ts +6 -0
- package/dist/better-auth/admin/generators/admin-crud-reset-password-action/generated/typed-templates.d.ts +12 -0
- package/dist/better-auth/admin/generators/admin-crud-roles-column/admin-crud-roles-column.generator.d.ts +6 -0
- package/dist/better-auth/generators/react/better-auth-pages/better-auth-pages.generator.d.ts +6 -0
- package/dist/better-auth/generators/react/better-auth-pages/generated/index.d.ts +36 -0
- package/dist/better-auth/generators/react/better-auth-pages/generated/template-renderers.d.ts +6 -0
- package/dist/better-auth/generators/react/better-auth-pages/generated/typed-templates.d.ts +60 -0
- package/dist/better-auth/generators/react/react-better-auth/generated/index.d.ts +12 -0
- package/dist/better-auth/generators/react/react-better-auth/generated/template-renderers.d.ts +6 -0
- package/dist/better-auth/generators/react/react-better-auth/generated/typed-templates.d.ts +6 -0
- package/dist/better-auth/generators/react/react-better-auth/react-better-auth.generator.d.ts +6 -0
- package/dist/local-auth/admin/common.js +6 -0
- package/dist/local-auth/admin/generators/admin-crud-invite-user-action/admin-crud-invite-user-action.generator.d.ts +531 -0
- package/dist/local-auth/admin/generators/admin-crud-invite-user-action/admin-crud-invite-user-action.generator.js +119 -0
- package/dist/local-auth/admin/generators/admin-crud-invite-user-action/generated/index.d.ts +540 -0
- package/dist/local-auth/admin/generators/admin-crud-invite-user-action/generated/index.js +11 -0
- package/dist/local-auth/admin/generators/admin-crud-invite-user-action/generated/template-paths.d.ts +12 -0
- package/dist/local-auth/admin/generators/admin-crud-invite-user-action/generated/template-paths.js +24 -0
- package/dist/local-auth/admin/generators/admin-crud-invite-user-action/generated/template-renderers.d.ts +276 -0
- package/dist/local-auth/admin/generators/admin-crud-invite-user-action/generated/template-renderers.js +45 -0
- package/dist/local-auth/admin/generators/admin-crud-invite-user-action/generated/typed-templates.d.ts +263 -0
- package/dist/local-auth/admin/generators/admin-crud-invite-user-action/generated/typed-templates.js +21 -0
- package/dist/local-auth/admin/generators/admin-crud-invite-user-action/index.d.ts +2 -0
- package/dist/local-auth/admin/generators/admin-crud-invite-user-action/index.js +2 -0
- package/dist/local-auth/admin/generators/admin-crud-invite-user-action/templates/routes/-components/invite-user-dialog.d.ts +21 -0
- package/dist/local-auth/admin/generators/admin-crud-invite-user-action/templates/routes/-components/invite-user-dialog.js +69 -0
- package/dist/local-auth/admin/generators/admin-crud-invite-user-action/templates/routes/-components/invite-user-dialog.tsx +122 -0
- package/dist/local-auth/admin/generators/admin-crud-manage-roles-action/admin-crud-manage-roles-action.generator.d.ts +12 -0
- package/dist/local-auth/admin/generators/admin-crud-manage-roles-action/generated/index.d.ts +12 -0
- package/dist/local-auth/admin/generators/admin-crud-manage-roles-action/generated/template-renderers.d.ts +6 -0
- package/dist/local-auth/admin/generators/admin-crud-manage-roles-action/generated/typed-templates.d.ts +6 -0
- package/dist/local-auth/admin/generators/admin-crud-reset-password-action/admin-crud-reset-password-action.generator.d.ts +12 -0
- package/dist/local-auth/admin/generators/admin-crud-reset-password-action/generated/index.d.ts +12 -0
- package/dist/local-auth/admin/generators/admin-crud-reset-password-action/generated/template-renderers.d.ts +6 -0
- package/dist/local-auth/admin/generators/admin-crud-reset-password-action/generated/typed-templates.d.ts +12 -0
- package/dist/local-auth/admin/generators/admin-crud-roles-column/admin-crud-roles-column.generator.d.ts +6 -0
- package/dist/local-auth/admin/node.js +13 -0
- package/dist/local-auth/admin/schema/invite-user-action.d.ts +12 -0
- package/dist/local-auth/admin/schema/invite-user-action.js +6 -0
- package/dist/local-auth/admin/web.js +8 -0
- package/dist/local-auth/core/common.js +7 -2
- package/dist/local-auth/core/components/local-auth-definition-editor.js +2 -1
- package/dist/local-auth/core/components/local-auth-web-app-settings-form.d.ts +9 -0
- package/dist/local-auth/core/components/local-auth-web-app-settings-form.js +11 -0
- package/dist/local-auth/core/generators/auth-apollo/auth-apollo.generator.d.ts +1 -0
- package/dist/local-auth/core/generators/auth-email-password/auth-email-password.generator.d.ts +6 -0
- package/dist/local-auth/core/generators/auth-email-password/auth-email-password.generator.js +66 -6
- package/dist/local-auth/core/generators/auth-email-password/generated/index.d.ts +188 -0
- package/dist/local-auth/core/generators/auth-email-password/generated/template-paths.d.ts +5 -0
- package/dist/local-auth/core/generators/auth-email-password/generated/template-paths.js +5 -0
- package/dist/local-auth/core/generators/auth-email-password/generated/template-renderers.d.ts +18 -0
- package/dist/local-auth/core/generators/auth-email-password/generated/template-renderers.js +66 -0
- package/dist/local-auth/core/generators/auth-email-password/generated/typed-templates.d.ts +192 -0
- package/dist/local-auth/core/generators/auth-email-password/generated/typed-templates.js +82 -1
- package/dist/local-auth/core/generators/auth-email-password/templates/module/constants/otp.constants.d.ts +19 -0
- package/dist/local-auth/core/generators/auth-email-password/templates/module/constants/otp.constants.js +20 -0
- package/dist/local-auth/core/generators/auth-email-password/templates/module/constants/otp.constants.ts +22 -0
- package/dist/local-auth/core/generators/auth-email-password/templates/module/constants/password.constants.d.ts +12 -0
- package/dist/local-auth/core/generators/auth-email-password/templates/module/constants/password.constants.js +12 -0
- package/dist/local-auth/core/generators/auth-email-password/templates/module/constants/password.constants.ts +14 -0
- package/dist/local-auth/core/generators/auth-email-password/templates/module/schema/email-otp.mutations.d.ts +2 -0
- package/dist/local-auth/core/generators/auth-email-password/templates/module/schema/email-otp.mutations.js +30 -0
- package/dist/local-auth/core/generators/auth-email-password/templates/module/schema/email-otp.mutations.ts +38 -0
- package/dist/local-auth/core/generators/auth-email-password/templates/module/schema/invite.mutations.d.ts +2 -0
- package/dist/local-auth/core/generators/auth-email-password/templates/module/schema/invite.mutations.js +42 -0
- package/dist/local-auth/core/generators/auth-email-password/templates/module/schema/invite.mutations.ts +54 -0
- package/dist/local-auth/core/generators/auth-email-password/templates/module/schema/user-password.mutations.js +2 -19
- package/dist/local-auth/core/generators/auth-email-password/templates/module/schema/user-password.mutations.ts +1 -22
- package/dist/local-auth/core/generators/auth-email-password/templates/module/services/email-otp.service.d.ts +37 -0
- package/dist/local-auth/core/generators/auth-email-password/templates/module/services/email-otp.service.js +225 -0
- package/dist/local-auth/core/generators/auth-email-password/templates/module/services/email-otp.service.ts +333 -0
- package/dist/local-auth/core/generators/auth-email-password/templates/module/services/invite.service.d.ts +39 -0
- package/dist/local-auth/core/generators/auth-email-password/templates/module/services/invite.service.js +138 -0
- package/dist/local-auth/core/generators/auth-email-password/templates/module/services/invite.service.ts +209 -0
- package/dist/local-auth/core/generators/auth-email-password/templates/module/services/password-reset.service.js +3 -3
- package/dist/local-auth/core/generators/auth-email-password/templates/module/services/password-reset.service.ts +3 -2
- package/dist/local-auth/core/generators/auth-email-templates/auth-email-templates.generator.d.ts +3 -1
- package/dist/local-auth/core/generators/auth-email-templates/auth-email-templates.generator.js +18 -3
- package/dist/local-auth/core/generators/auth-email-templates/generated/index.d.ts +40 -0
- package/dist/local-auth/core/generators/auth-email-templates/generated/template-paths.d.ts +2 -0
- package/dist/local-auth/core/generators/auth-email-templates/generated/template-paths.js +2 -0
- package/dist/local-auth/core/generators/auth-email-templates/generated/template-renderers.d.ts +6 -0
- package/dist/local-auth/core/generators/auth-email-templates/generated/template-renderers.js +20 -0
- package/dist/local-auth/core/generators/auth-email-templates/generated/typed-templates.d.ts +40 -0
- package/dist/local-auth/core/generators/auth-email-templates/generated/typed-templates.js +24 -0
- package/dist/local-auth/core/generators/auth-email-templates/templates/src/emails/auth/email-otp.email.d.ts +3 -0
- package/dist/local-auth/core/generators/auth-email-templates/templates/src/emails/auth/email-otp.email.js +18 -0
- package/dist/local-auth/core/generators/auth-email-templates/templates/src/emails/auth/email-otp.email.tsx +57 -0
- package/dist/local-auth/core/generators/auth-email-templates/templates/src/emails/auth/invite.email.d.ts +3 -0
- package/dist/local-auth/core/generators/auth-email-templates/templates/src/emails/auth/invite.email.js +14 -0
- package/dist/local-auth/core/generators/auth-email-templates/templates/src/emails/auth/invite.email.tsx +47 -0
- package/dist/local-auth/core/generators/auth-module/auth-module.generator.d.ts +8 -0
- package/dist/local-auth/core/generators/auth-module/auth-module.generator.js +5 -1
- package/dist/local-auth/core/generators/auth-module/generated/index.d.ts +32 -0
- package/dist/local-auth/core/generators/auth-module/generated/template-paths.d.ts +1 -0
- package/dist/local-auth/core/generators/auth-module/generated/template-paths.js +1 -0
- package/dist/local-auth/core/generators/auth-module/generated/template-renderers.d.ts +7 -0
- package/dist/local-auth/core/generators/auth-module/generated/template-renderers.js +13 -0
- package/dist/local-auth/core/generators/auth-module/generated/ts-import-providers.d.ts +9 -0
- package/dist/local-auth/core/generators/auth-module/generated/ts-import-providers.js +6 -0
- package/dist/local-auth/core/generators/auth-module/generated/typed-templates.d.ts +25 -0
- package/dist/local-auth/core/generators/auth-module/generated/typed-templates.js +20 -0
- package/dist/local-auth/core/generators/auth-module/templates/module/services/auth-verification.service.d.ts +4 -0
- package/dist/local-auth/core/generators/auth-module/templates/module/services/auth-verification.service.js +1 -1
- package/dist/local-auth/core/generators/auth-module/templates/module/services/auth-verification.service.ts +1 -1
- package/dist/local-auth/core/generators/auth-module/templates/module/services/code-verification.service.d.ts +66 -0
- package/dist/local-auth/core/generators/auth-module/templates/module/services/code-verification.service.js +134 -0
- package/dist/local-auth/core/generators/auth-module/templates/module/services/code-verification.service.ts +184 -0
- package/dist/local-auth/core/generators/auth-routes/auth-routes.generator.d.ts +8 -0
- package/dist/local-auth/core/generators/auth-routes/auth-routes.generator.js +38 -5
- package/dist/local-auth/core/generators/auth-routes/generated/index.d.ts +840 -268
- package/dist/local-auth/core/generators/auth-routes/generated/template-paths.d.ts +3 -0
- package/dist/local-auth/core/generators/auth-routes/generated/template-paths.js +3 -0
- package/dist/local-auth/core/generators/auth-routes/generated/template-renderers.d.ts +18 -0
- package/dist/local-auth/core/generators/auth-routes/generated/template-renderers.js +51 -0
- package/dist/local-auth/core/generators/auth-routes/generated/typed-templates.d.ts +608 -283
- package/dist/local-auth/core/generators/auth-routes/generated/typed-templates.js +69 -23
- package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/-otp-constants.d.ts +9 -0
- package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/-otp-constants.js +10 -0
- package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/-otp-constants.ts +11 -0
- package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/accept-invite.d.ts +7 -0
- package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/accept-invite.js +148 -0
- package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/accept-invite.tsx +264 -0
- package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/login-otp.d.ts +7 -0
- package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/login-otp.js +184 -0
- package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/login-otp.tsx +311 -0
- package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/login.js +1 -1
- package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/login.tsx +2 -9
- package/dist/local-auth/core/generators/react-session/generated/index.d.ts +12 -0
- package/dist/local-auth/core/generators/react-session/generated/template-renderers.d.ts +6 -0
- package/dist/local-auth/core/generators/react-session/generated/typed-templates.d.ts +12 -0
- package/dist/local-auth/core/generators/react-session/react-session.generator.d.ts +6 -0
- package/dist/local-auth/core/node.js +24 -6
- package/dist/local-auth/core/schema/migrations.d.ts +3 -0
- package/dist/local-auth/core/schema/migrations.js +36 -0
- package/dist/local-auth/core/schema/models.js +8 -0
- package/dist/local-auth/core/schema/plugin-definition.d.ts +1 -0
- package/dist/local-auth/core/schema/plugin-definition.js +1 -0
- package/dist/local-auth/core/schema/web-app-schema.d.ts +15 -0
- package/dist/local-auth/core/schema/web-app-schema.js +16 -0
- package/dist/local-auth/core/web.js +8 -1
- package/dist/web/assets/{_virtual_mf-localSharedImportMap___mfe_internal__plugin_mf_2_auth-04_7KkB1.js → _virtual_mf-localSharedImportMap___mfe_internal__plugin_mf_2_auth__mf_owner__1-CKKmnLep.js} +49 -41
- package/dist/web/assets/{dist-BjxypexQ.js → _virtual_mf___mfe_internal__plugin_mf_2_auth__mf_owner__1__loadShare___mf_0_baseplate_mf_2_dev_mf_1_project_mf_2_builder_mf_2_lib__loadShare__.js-Cx7TvZ_H.js} +16720 -384
- package/dist/web/assets/_virtual_mf___mfe_internal__plugin_mf_2_auth__mf_owner__1__loadShare___mf_0_baseplate_mf_2_dev_mf_1_project_mf_2_builder_mf_2_lib_mf_1_web__loadShare__.js-D3Nvasea.js +177 -0
- package/dist/web/assets/{_virtual_mf___mfe_internal__plugin_mf_2_auth__loadShare___mf_0_baseplate_mf_2_dev_mf_1_ui_mf_2_components__loadShare__.js-CXGct_48.js → _virtual_mf___mfe_internal__plugin_mf_2_auth__mf_owner__1__loadShare___mf_0_baseplate_mf_2_dev_mf_1_ui_mf_2_components__loadShare__.js-C2GDE8Py.js} +3349 -2632
- package/dist/web/assets/{_virtual_mf___mfe_internal__plugin_mf_2_auth__loadShare___mf_0_tanstack_mf_1_react_mf_2_router__loadShare__.js-Ci5_qYaj.js → _virtual_mf___mfe_internal__plugin_mf_2_auth__mf_owner__1__loadShare___mf_0_tanstack_mf_1_react_mf_2_router__loadShare__.js-CiccpWjh.js} +320 -164
- package/dist/web/assets/{arduino-BP2nYunF.js → arduino-BXtgMpyb.js} +2 -2
- package/dist/web/assets/auth-CsHp2bQi.js +1 -0
- package/dist/web/assets/{c-C7Ey31hW.js → c-6gdx-Hqg.js} +3 -3
- package/dist/web/assets/{clike-D9YNFwtw.js → clike-Ds9lUsCq.js} +2 -2
- package/dist/web/assets/common-BGTuTgx7.js +43 -0
- package/dist/web/assets/common-C8_sC5pp.js +70 -0
- package/dist/web/assets/{common-BvU-7KsV.js → common-Co5lW_TK.js} +13 -11
- package/dist/web/assets/{common-eFh2vwGb.js → common-CoLuMS7U.js} +6 -6
- package/dist/web/assets/common-Dueu_1NG.js +36 -0
- package/dist/web/assets/{common-BBriDRRy.js → common-N3skPbzk.js} +10 -10
- package/dist/web/assets/{cpp-_RjA_yNA.js → cpp-DRYAY5P6.js} +2 -2
- package/dist/web/assets/{csharp-0LZzOc6Q.js → csharp-RJBSoHJ6.js} +2 -2
- package/dist/web/assets/{dist-SBfmsOB2.js → dist-DQd1TAJX.js} +274 -133
- package/dist/web/assets/{get-auth-plugin-definition-x8oAsN1R.js → get-auth-plugin-definition-DyokUVjX.js} +3 -3
- package/dist/web/assets/{go-CzER04EZ.js → go-D9nlw8GJ.js} +2 -2
- package/dist/web/assets/{hostInit-Bay0Y9UX.js → hostInit-BCYmw0H5.js} +33 -6
- package/dist/web/assets/{java-HAvRESj1.js → java-Asfw0WtJ.js} +2 -2
- package/dist/web/assets/{javascript-BVAr0eZH.js → javascript-fpnGEVws.js} +2 -2
- package/dist/web/assets/{kotlin-DkCMjTKK.js → kotlin-zNWfDPVY.js} +2 -2
- package/dist/web/assets/{markdown-_2_uVr2L.js → markdown-ewV-vLcZ.js} +2 -2
- package/dist/web/assets/{markup-BVZ8HhdW.js → markup-D2krQlDZ.js} +2 -2
- package/dist/web/assets/{markup-templating-BDIRuVJH.js → markup-templating-c_XBo6vX.js} +2 -2
- package/dist/web/assets/mf-entry-bootstrap-0-3ede9334.js +36 -0
- package/dist/web/assets/mf-entry-bootstrap-1-3da85eea.js +36 -0
- package/dist/web/assets/{mf-entry-bootstrap-0-659c976f.js → mf-entry-bootstrap-2-32e24e11.js} +3 -2
- package/dist/web/assets/mf-entry-bootstrap-3-a3cfea9d.js +36 -0
- package/dist/web/assets/{models-BpslIbU7.js → models-BcPOQC5p.js} +4 -5
- package/dist/web/assets/{models-CKab4MTC.js → models-BcUgOGGn.js} +11 -6
- package/dist/web/assets/{objectivec-DPgB68It.js → objectivec-PkUOhxeb.js} +2 -2
- package/dist/web/assets/{php-JTON0zp9.js → php-CfWLJZIj.js} +2 -2
- package/dist/web/assets/{plugin-definition-8Exesd6T.js → plugin-definition-D1EImXIf.js} +9 -10
- package/dist/web/assets/plugin-definition-lw-gB4hU.js +10 -0
- package/dist/web/assets/{rolldown-runtime-FZ4Itg2g.js → rolldown-runtime-7_rZTKki.js} +1 -1
- package/dist/web/assets/{ruby-BoFHz67P.js → ruby-BlM93DKO.js} +2 -2
- package/dist/web/assets/{styles-Cc26Bbxc.css → styles-DIj1cIPB.css} +119 -1
- package/dist/web/assets/{styles-Cuq4wgvD.js → styles-EOyEbGA4.js} +9 -10
- package/dist/web/assets/{typescript-CDkIWcT8.js → typescript-C5BVqltI.js} +2 -2
- package/dist/web/assets/{virtualExposes-BwIds34r.js → virtualExposes-DWORnjyA.js} +1 -1
- package/dist/web/assets/virtual_mf-REMOTE_ENTRY_ID___mfe_internal__plugin-auth__remoteEntry_js-t-KnBiUh.js +747 -0
- package/dist/web/assets/{virtual_mf-exposes___mfe_internal__plugin-auth__remoteEntry_js-DM6Ir1_S.js → virtual_mf-exposes___mfe_internal__plugin-auth__remoteEntry_js-DZfE3QCR.js} +15 -15
- package/dist/web/assets/{vite-preload-helper-iIio8xkS.js → vite-preload-helper-ARKYL6bp.js} +5 -1
- package/dist/web/assets/{web-DHv2aVpi.js → web-CBVepebK.js} +24 -24
- package/dist/web/assets/{web-CnB-sqCR.js → web-Dgb85jhs.js} +54 -53
- package/dist/web/assets/{web-BZd3bM0n.js → web-EDeSquSP.js} +38 -38
- package/dist/web/assets/{web-DNrWXjpS.js → web-PqAcfBSy.js} +9 -9
- package/dist/web/assets/{web-BgWG7dYl.js → web-RhChfBw_.js} +23 -23
- package/dist/web/assets/web-kaD9AzNS.js +59 -0
- package/dist/web/assets/web-xJ-GnSkC.js +148 -0
- package/dist/web/assets/{workerBundle-GFUata9j.js → workerBundle-BjsY-uXx.js} +2 -2
- package/dist/web/index.html +5 -2
- package/dist/web/remoteEntry.js +1 -1
- package/package.json +36 -39
- package/dist/web/assets/_virtual_mf___mfe_internal__plugin_mf_2_auth__loadShare___mf_0_baseplate_mf_2_dev_mf_1_project_mf_2_builder_mf_2_lib__loadShare__.js-BfSk5vRC.js +0 -384
- package/dist/web/assets/_virtual_mf___mfe_internal__plugin_mf_2_auth__loadShare___mf_0_baseplate_mf_2_dev_mf_1_project_mf_2_builder_mf_2_lib_mf_1_web__loadShare__.js-DZIcwf2B.js +0 -125
- package/dist/web/assets/_virtual_mf___mfe_internal__plugin_mf_2_auth__loadShare__zod__loadShare__.js-Do-7VDVw.js +0 -13567
- package/dist/web/assets/auth-8qJtXAgU.js +0 -1
- package/dist/web/assets/common-23-wvKrM.js +0 -39
- package/dist/web/assets/common-B-NI9TR-.js +0 -37
- package/dist/web/assets/common-DBBUvtGu.js +0 -37
- package/dist/web/assets/index-qso1IsKy.js +0 -2
- package/dist/web/assets/model-utils-dNFTOjqi.js +0 -1599
- package/dist/web/assets/plugin-definition-ChBrbazJ.js +0 -11
- package/dist/web/assets/virtual_mf-REMOTE_ENTRY_ID___mfe_internal__plugin-auth__remoteEntry_js-BBt5f0I7.js +0 -259
- package/dist/web/assets/virtual_mf-exposes-ssr___mfe_internal__plugin-auth__remoteEntry_js-RzPgl37a.js +0 -129
- package/dist/web/assets/web-CXHw8SK7.js +0 -118
- package/dist/web/assets/web-D_H-MoGI.js +0 -46
- package/dist/web/remoteEntry.ssr.js +0 -43
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
|
|
3
|
+
import type { User } from '%prismaGeneratedImports';
|
|
4
|
+
import type {
|
|
5
|
+
RequestServiceContext,
|
|
6
|
+
RequestServiceContextWith,
|
|
7
|
+
} from '%requestServiceContextImports';
|
|
8
|
+
import type { UserSessionPayload } from '%userSessionTypesImports';
|
|
9
|
+
|
|
10
|
+
import {
|
|
11
|
+
AUTH_TOKEN_MAX_LENGTH,
|
|
12
|
+
INVITE_TOKEN_EXPIRY_SEC,
|
|
13
|
+
PASSWORD_MAX_LENGTH,
|
|
14
|
+
PASSWORD_MIN_LENGTH,
|
|
15
|
+
} from '$constantsPassword';
|
|
16
|
+
import {
|
|
17
|
+
createAuthVerification,
|
|
18
|
+
validateAuthVerification,
|
|
19
|
+
} from '%authModuleImports';
|
|
20
|
+
import { getConfig } from '%configServiceImports';
|
|
21
|
+
import {
|
|
22
|
+
BadRequestError,
|
|
23
|
+
handleZodRequestValidationError,
|
|
24
|
+
NotFoundError,
|
|
25
|
+
} from '%errorHandlerServiceImports';
|
|
26
|
+
import { createPasswordHash } from '%passwordHasherServiceImports';
|
|
27
|
+
import { prisma } from '%prismaImports';
|
|
28
|
+
import z from 'zod';
|
|
29
|
+
|
|
30
|
+
const PROVIDER_ID = 'email-password';
|
|
31
|
+
const INVITE_TYPE = 'invite';
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Sends an invite email so a user can set their password and sign in.
|
|
35
|
+
* Admin-triggered, so unlike password reset requests, it does not need
|
|
36
|
+
* anti-enumeration rate limiting.
|
|
37
|
+
*/
|
|
38
|
+
export async function inviteUser({
|
|
39
|
+
userId,
|
|
40
|
+
context,
|
|
41
|
+
}: {
|
|
42
|
+
userId: string;
|
|
43
|
+
context: RequestServiceContextWith<'email'>;
|
|
44
|
+
}): Promise<{ user: User }> {
|
|
45
|
+
const { services } = context;
|
|
46
|
+
|
|
47
|
+
const user = await prisma.user.findUnique({ where: { id: userId } });
|
|
48
|
+
|
|
49
|
+
if (!user) {
|
|
50
|
+
throw new NotFoundError('User not found', 'user-not-found');
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (!user.email) {
|
|
54
|
+
throw new BadRequestError('User has no email', 'user-has-no-email');
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const existingAccount = await prisma.userAccount.findUnique({
|
|
58
|
+
where: {
|
|
59
|
+
accountId_providerId: {
|
|
60
|
+
accountId: user.email,
|
|
61
|
+
providerId: PROVIDER_ID,
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
if (existingAccount) {
|
|
67
|
+
throw new BadRequestError(
|
|
68
|
+
'User already has a password set',
|
|
69
|
+
'user-already-has-account',
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const { token } = await createAuthVerification({
|
|
74
|
+
type: INVITE_TYPE,
|
|
75
|
+
userId: user.id,
|
|
76
|
+
expiresInSec: INVITE_TOKEN_EXPIRY_SEC,
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
const acceptLink = `${getConfig().AUTH_FRONTEND_URL}/auth/accept-invite?token=${encodeURIComponent(token)}`;
|
|
80
|
+
|
|
81
|
+
await services.email.send(TPL_INVITE_EMAIL, {
|
|
82
|
+
to: user.email,
|
|
83
|
+
data: { acceptLink },
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
return { user };
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const validateTokenSchema = z.object({
|
|
90
|
+
token: z.string().min(1).max(AUTH_TOKEN_MAX_LENGTH),
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Validates an invite token without consuming it.
|
|
95
|
+
* Used by the frontend to verify the token is valid and to show the
|
|
96
|
+
* invited email before displaying the set-password form.
|
|
97
|
+
*
|
|
98
|
+
* @throws BadRequestError with code 'invalid-token' if the token is invalid or expired
|
|
99
|
+
*/
|
|
100
|
+
export async function validateInviteToken({
|
|
101
|
+
token: rawToken,
|
|
102
|
+
}: {
|
|
103
|
+
token: string;
|
|
104
|
+
}): Promise<{ email: string }> {
|
|
105
|
+
const { token } = await validateTokenSchema
|
|
106
|
+
.parseAsync({ token: rawToken })
|
|
107
|
+
.catch(handleZodRequestValidationError);
|
|
108
|
+
|
|
109
|
+
const record = await validateAuthVerification({
|
|
110
|
+
type: INVITE_TYPE,
|
|
111
|
+
token,
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
if (!record?.userId) {
|
|
115
|
+
throw new BadRequestError('Invalid or expired token', 'invalid-token');
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const user = await prisma.user.findUniqueOrThrow({
|
|
119
|
+
where: { id: record.userId },
|
|
120
|
+
select: { email: true },
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
if (!user.email) {
|
|
124
|
+
throw new BadRequestError('User has no email', 'user-has-no-email');
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return { email: user.email };
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const acceptInviteSchema = z.object({
|
|
131
|
+
token: z.string().min(1).max(AUTH_TOKEN_MAX_LENGTH),
|
|
132
|
+
newPassword: z.string().min(PASSWORD_MIN_LENGTH).max(PASSWORD_MAX_LENGTH),
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Completes the invite flow by setting the invited user's password and
|
|
137
|
+
* signing them in. Token is single-use (deleted after acceptance, along
|
|
138
|
+
* with any other pending invite tokens for the user).
|
|
139
|
+
*/
|
|
140
|
+
export async function acceptInvite({
|
|
141
|
+
token: rawToken,
|
|
142
|
+
newPassword: rawNewPassword,
|
|
143
|
+
context,
|
|
144
|
+
}: {
|
|
145
|
+
token: string;
|
|
146
|
+
newPassword: string;
|
|
147
|
+
context: RequestServiceContext;
|
|
148
|
+
}): Promise<{ session: UserSessionPayload }> {
|
|
149
|
+
const { token, newPassword } = await acceptInviteSchema
|
|
150
|
+
.parseAsync({
|
|
151
|
+
token: rawToken,
|
|
152
|
+
newPassword: rawNewPassword,
|
|
153
|
+
})
|
|
154
|
+
.catch(handleZodRequestValidationError);
|
|
155
|
+
|
|
156
|
+
const record = await validateAuthVerification({
|
|
157
|
+
type: INVITE_TYPE,
|
|
158
|
+
token,
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
if (!record?.userId) {
|
|
162
|
+
throw new BadRequestError('Invalid or expired token', 'invalid-token');
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
const user = await prisma.user.findUniqueOrThrow({
|
|
166
|
+
where: { id: record.userId },
|
|
167
|
+
select: { id: true, email: true },
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
if (!user.email) {
|
|
171
|
+
throw new BadRequestError('User has no email', 'user-has-no-email');
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
const passwordHash = await createPasswordHash(newPassword);
|
|
175
|
+
|
|
176
|
+
await prisma.$transaction([
|
|
177
|
+
prisma.authVerification.deleteMany({
|
|
178
|
+
where: { type: INVITE_TYPE, userId: user.id },
|
|
179
|
+
}),
|
|
180
|
+
prisma.userAccount.upsert({
|
|
181
|
+
where: {
|
|
182
|
+
accountId_providerId: {
|
|
183
|
+
accountId: user.email,
|
|
184
|
+
providerId: PROVIDER_ID,
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
create: {
|
|
188
|
+
userId: user.id,
|
|
189
|
+
accountId: user.email,
|
|
190
|
+
providerId: PROVIDER_ID,
|
|
191
|
+
password: passwordHash,
|
|
192
|
+
},
|
|
193
|
+
update: {
|
|
194
|
+
password: passwordHash,
|
|
195
|
+
},
|
|
196
|
+
}),
|
|
197
|
+
prisma.user.update({
|
|
198
|
+
where: { id: user.id },
|
|
199
|
+
data: { emailVerified: true },
|
|
200
|
+
}),
|
|
201
|
+
]);
|
|
202
|
+
|
|
203
|
+
const session = await context.services.userSession.createSession(
|
|
204
|
+
user.id,
|
|
205
|
+
context,
|
|
206
|
+
);
|
|
207
|
+
|
|
208
|
+
return { session };
|
|
209
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
|
-
import { PASSWORD_MAX_LENGTH, PASSWORD_MIN_LENGTH, PASSWORD_RESET_TOKEN_EXPIRY_SEC, } from '$constantsPassword';
|
|
2
|
+
import { AUTH_TOKEN_MAX_LENGTH, PASSWORD_MAX_LENGTH, PASSWORD_MIN_LENGTH, PASSWORD_RESET_TOKEN_EXPIRY_SEC, } from '$constantsPassword';
|
|
3
3
|
import { resetLoginRateLimits } from '$servicesUserPassword';
|
|
4
4
|
import { createAuthVerification, validateAuthVerification, } from '%authModuleImports';
|
|
5
5
|
import { getConfig } from '%configServiceImports';
|
|
@@ -70,7 +70,7 @@ export async function requestPasswordReset({ email: rawEmail, context, }) {
|
|
|
70
70
|
return { success: true };
|
|
71
71
|
}
|
|
72
72
|
const validateTokenSchema = z.object({
|
|
73
|
-
token: z.string().min(1).max(
|
|
73
|
+
token: z.string().min(1).max(AUTH_TOKEN_MAX_LENGTH),
|
|
74
74
|
});
|
|
75
75
|
/**
|
|
76
76
|
* Validates a password reset token without consuming it.
|
|
@@ -92,7 +92,7 @@ export async function validatePasswordResetToken({ token: rawToken, }) {
|
|
|
92
92
|
return { success: true };
|
|
93
93
|
}
|
|
94
94
|
const completePasswordResetSchema = z.object({
|
|
95
|
-
token: z.string().min(1).max(
|
|
95
|
+
token: z.string().min(1).max(AUTH_TOKEN_MAX_LENGTH),
|
|
96
96
|
newPassword: z.string().min(PASSWORD_MIN_LENGTH).max(PASSWORD_MAX_LENGTH),
|
|
97
97
|
});
|
|
98
98
|
/**
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import type { RequestServiceContextWith } from '%requestServiceContextImports';
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
|
+
AUTH_TOKEN_MAX_LENGTH,
|
|
6
7
|
PASSWORD_MAX_LENGTH,
|
|
7
8
|
PASSWORD_MIN_LENGTH,
|
|
8
9
|
PASSWORD_RESET_TOKEN_EXPIRY_SEC,
|
|
@@ -122,7 +123,7 @@ export async function requestPasswordReset({
|
|
|
122
123
|
}
|
|
123
124
|
|
|
124
125
|
const validateTokenSchema = z.object({
|
|
125
|
-
token: z.string().min(1).max(
|
|
126
|
+
token: z.string().min(1).max(AUTH_TOKEN_MAX_LENGTH),
|
|
126
127
|
});
|
|
127
128
|
|
|
128
129
|
/**
|
|
@@ -153,7 +154,7 @@ export async function validatePasswordResetToken({
|
|
|
153
154
|
}
|
|
154
155
|
|
|
155
156
|
const completePasswordResetSchema = z.object({
|
|
156
|
-
token: z.string().min(1).max(
|
|
157
|
+
token: z.string().min(1).max(AUTH_TOKEN_MAX_LENGTH),
|
|
157
158
|
newPassword: z.string().min(PASSWORD_MIN_LENGTH).max(PASSWORD_MAX_LENGTH),
|
|
158
159
|
});
|
|
159
160
|
|
package/dist/local-auth/core/generators/auth-email-templates/auth-email-templates.generator.d.ts
CHANGED
|
@@ -5,7 +5,9 @@
|
|
|
5
5
|
* account verification) with the transactional email library and generates
|
|
6
6
|
* the corresponding .tsx template files.
|
|
7
7
|
*/
|
|
8
|
-
export declare const authEmailTemplatesGenerator: import("@baseplate-dev/sync").GeneratorBundleCreator<
|
|
8
|
+
export declare const authEmailTemplatesGenerator: import("@baseplate-dev/sync").GeneratorBundleCreator<{
|
|
9
|
+
emailOtp?: boolean | undefined;
|
|
10
|
+
}, {
|
|
9
11
|
paths: import("@baseplate-dev/sync").GeneratorTask<{
|
|
10
12
|
localAuthAuthEmailTemplatesPaths: import("@baseplate-dev/sync").ProviderExport<import("./generated/template-paths.js").LocalAuthAuthEmailTemplatesPaths>;
|
|
11
13
|
}, {
|
package/dist/local-auth/core/generators/auth-email-templates/auth-email-templates.generator.js
CHANGED
|
@@ -2,7 +2,9 @@ import { emailTemplatesProvider } from '@baseplate-dev/plugin-email';
|
|
|
2
2
|
import { createGenerator, createGeneratorTask } from '@baseplate-dev/sync';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import { LOCAL_AUTH_AUTH_EMAIL_TEMPLATES_GENERATED as GENERATED_TEMPLATES } from './generated/index.js';
|
|
5
|
-
const descriptorSchema = z.object({
|
|
5
|
+
const descriptorSchema = z.object({
|
|
6
|
+
emailOtp: z.boolean().default(false),
|
|
7
|
+
});
|
|
6
8
|
/**
|
|
7
9
|
* Generator for auth email templates.
|
|
8
10
|
*
|
|
@@ -14,7 +16,7 @@ export const authEmailTemplatesGenerator = createGenerator({
|
|
|
14
16
|
name: 'local-auth/auth-email-templates',
|
|
15
17
|
generatorFileUrl: import.meta.url,
|
|
16
18
|
descriptorSchema,
|
|
17
|
-
buildTasks: () => ({
|
|
19
|
+
buildTasks: ({ emailOtp }) => ({
|
|
18
20
|
paths: GENERATED_TEMPLATES.paths.task,
|
|
19
21
|
renderers: GENERATED_TEMPLATES.renderers.task,
|
|
20
22
|
main: createGeneratorTask({
|
|
@@ -36,9 +38,22 @@ export const authEmailTemplatesGenerator = createGenerator({
|
|
|
36
38
|
exportName: 'PasswordResetEmail',
|
|
37
39
|
exportPath: paths.passwordResetEmail,
|
|
38
40
|
});
|
|
41
|
+
emailTemplates.registerExport({
|
|
42
|
+
exportName: 'InviteEmail',
|
|
43
|
+
exportPath: paths.inviteEmail,
|
|
44
|
+
});
|
|
45
|
+
if (emailOtp) {
|
|
46
|
+
emailTemplates.registerExport({
|
|
47
|
+
exportName: 'EmailOtpEmail',
|
|
48
|
+
exportPath: paths.emailOtpEmail,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
39
51
|
return {
|
|
40
52
|
build: async (builder) => {
|
|
41
|
-
await builder.apply(renderers.accountVerificationEmail.render({}), renderers.passwordChangedEmail.render({}), renderers.passwordResetEmail.render({}));
|
|
53
|
+
await builder.apply(renderers.accountVerificationEmail.render({}), renderers.passwordChangedEmail.render({}), renderers.passwordResetEmail.render({}), renderers.inviteEmail.render({}));
|
|
54
|
+
if (emailOtp) {
|
|
55
|
+
await builder.apply(renderers.emailOtpEmail.render({}));
|
|
56
|
+
}
|
|
42
57
|
},
|
|
43
58
|
};
|
|
44
59
|
},
|
|
@@ -55,6 +55,46 @@ export declare const LOCAL_AUTH_AUTH_EMAIL_TEMPLATES_GENERATED: {
|
|
|
55
55
|
theme: {};
|
|
56
56
|
}>>;
|
|
57
57
|
}, Record<never, Record<never, never>>>;
|
|
58
|
+
emailOtpEmail: import("@baseplate-dev/core-generators").TsTemplateFile<{}, {
|
|
59
|
+
transactionalLibImports: import("@baseplate-dev/sync").ProviderType<import("@baseplate-dev/core-generators").InferTsImportMapFromSchema<{
|
|
60
|
+
Button: {};
|
|
61
|
+
defineEmail: {};
|
|
62
|
+
DefineEmailOptions: {
|
|
63
|
+
isTypeOnly: true;
|
|
64
|
+
};
|
|
65
|
+
Divider: {};
|
|
66
|
+
EmailComponent: {
|
|
67
|
+
isTypeOnly: true;
|
|
68
|
+
};
|
|
69
|
+
EmailLayout: {};
|
|
70
|
+
Heading: {};
|
|
71
|
+
Link: {};
|
|
72
|
+
renderEmail: {};
|
|
73
|
+
Section: {};
|
|
74
|
+
Text: {};
|
|
75
|
+
theme: {};
|
|
76
|
+
}>>;
|
|
77
|
+
}, Record<never, Record<never, never>>>;
|
|
78
|
+
inviteEmail: import("@baseplate-dev/core-generators").TsTemplateFile<{}, {
|
|
79
|
+
transactionalLibImports: import("@baseplate-dev/sync").ProviderType<import("@baseplate-dev/core-generators").InferTsImportMapFromSchema<{
|
|
80
|
+
Button: {};
|
|
81
|
+
defineEmail: {};
|
|
82
|
+
DefineEmailOptions: {
|
|
83
|
+
isTypeOnly: true;
|
|
84
|
+
};
|
|
85
|
+
Divider: {};
|
|
86
|
+
EmailComponent: {
|
|
87
|
+
isTypeOnly: true;
|
|
88
|
+
};
|
|
89
|
+
EmailLayout: {};
|
|
90
|
+
Heading: {};
|
|
91
|
+
Link: {};
|
|
92
|
+
renderEmail: {};
|
|
93
|
+
Section: {};
|
|
94
|
+
Text: {};
|
|
95
|
+
theme: {};
|
|
96
|
+
}>>;
|
|
97
|
+
}, Record<never, Record<never, never>>>;
|
|
58
98
|
passwordChangedEmail: import("@baseplate-dev/core-generators").TsTemplateFile<{}, {
|
|
59
99
|
transactionalLibImports: import("@baseplate-dev/sync").ProviderType<import("@baseplate-dev/core-generators").InferTsImportMapFromSchema<{
|
|
60
100
|
Button: {};
|
|
@@ -12,6 +12,8 @@ const localAuthAuthEmailTemplatesPathsTask = createGeneratorTask({
|
|
|
12
12
|
providers: {
|
|
13
13
|
localAuthAuthEmailTemplatesPaths: {
|
|
14
14
|
accountVerificationEmail: `${srcRoot}/emails/auth/account-verification.email.tsx`,
|
|
15
|
+
emailOtpEmail: `${srcRoot}/emails/auth/email-otp.email.tsx`,
|
|
16
|
+
inviteEmail: `${srcRoot}/emails/auth/invite.email.tsx`,
|
|
15
17
|
passwordChangedEmail: `${srcRoot}/emails/auth/password-changed.email.tsx`,
|
|
16
18
|
passwordResetEmail: `${srcRoot}/emails/auth/password-reset.email.tsx`,
|
|
17
19
|
},
|
package/dist/local-auth/core/generators/auth-email-templates/generated/template-renderers.d.ts
CHANGED
|
@@ -5,6 +5,12 @@ export interface LocalAuthAuthEmailTemplatesRenderers {
|
|
|
5
5
|
accountVerificationEmail: {
|
|
6
6
|
render: (options: Omit<RenderTsTemplateFileActionInput<typeof LOCAL_AUTH_AUTH_EMAIL_TEMPLATES_TEMPLATES.accountVerificationEmail>, 'destination' | 'importMapProviders' | 'template' | 'generatorPaths'>) => BuilderAction;
|
|
7
7
|
};
|
|
8
|
+
emailOtpEmail: {
|
|
9
|
+
render: (options: Omit<RenderTsTemplateFileActionInput<typeof LOCAL_AUTH_AUTH_EMAIL_TEMPLATES_TEMPLATES.emailOtpEmail>, 'destination' | 'importMapProviders' | 'template' | 'generatorPaths'>) => BuilderAction;
|
|
10
|
+
};
|
|
11
|
+
inviteEmail: {
|
|
12
|
+
render: (options: Omit<RenderTsTemplateFileActionInput<typeof LOCAL_AUTH_AUTH_EMAIL_TEMPLATES_TEMPLATES.inviteEmail>, 'destination' | 'importMapProviders' | 'template' | 'generatorPaths'>) => BuilderAction;
|
|
13
|
+
};
|
|
8
14
|
passwordChangedEmail: {
|
|
9
15
|
render: (options: Omit<RenderTsTemplateFileActionInput<typeof LOCAL_AUTH_AUTH_EMAIL_TEMPLATES_TEMPLATES.passwordChangedEmail>, 'destination' | 'importMapProviders' | 'template' | 'generatorPaths'>) => BuilderAction;
|
|
10
16
|
};
|
package/dist/local-auth/core/generators/auth-email-templates/generated/template-renderers.js
CHANGED
|
@@ -27,6 +27,26 @@ const localAuthAuthEmailTemplatesRenderersTask = createGeneratorTask({
|
|
|
27
27
|
...options,
|
|
28
28
|
}),
|
|
29
29
|
},
|
|
30
|
+
emailOtpEmail: {
|
|
31
|
+
render: (options) => typescriptFile.renderTemplateFile({
|
|
32
|
+
template: LOCAL_AUTH_AUTH_EMAIL_TEMPLATES_TEMPLATES.emailOtpEmail,
|
|
33
|
+
destination: paths.emailOtpEmail,
|
|
34
|
+
importMapProviders: {
|
|
35
|
+
transactionalLibImports,
|
|
36
|
+
},
|
|
37
|
+
...options,
|
|
38
|
+
}),
|
|
39
|
+
},
|
|
40
|
+
inviteEmail: {
|
|
41
|
+
render: (options) => typescriptFile.renderTemplateFile({
|
|
42
|
+
template: LOCAL_AUTH_AUTH_EMAIL_TEMPLATES_TEMPLATES.inviteEmail,
|
|
43
|
+
destination: paths.inviteEmail,
|
|
44
|
+
importMapProviders: {
|
|
45
|
+
transactionalLibImports,
|
|
46
|
+
},
|
|
47
|
+
...options,
|
|
48
|
+
}),
|
|
49
|
+
},
|
|
30
50
|
passwordChangedEmail: {
|
|
31
51
|
render: (options) => typescriptFile.renderTemplateFile({
|
|
32
52
|
template: LOCAL_AUTH_AUTH_EMAIL_TEMPLATES_TEMPLATES.passwordChangedEmail,
|
|
@@ -19,6 +19,46 @@ export declare const LOCAL_AUTH_AUTH_EMAIL_TEMPLATES_TEMPLATES: {
|
|
|
19
19
|
theme: {};
|
|
20
20
|
}>>;
|
|
21
21
|
}, Record<never, Record<never, never>>>;
|
|
22
|
+
emailOtpEmail: import("@baseplate-dev/core-generators").TsTemplateFile<{}, {
|
|
23
|
+
transactionalLibImports: import("@baseplate-dev/sync").ProviderType<import("@baseplate-dev/core-generators").InferTsImportMapFromSchema<{
|
|
24
|
+
Button: {};
|
|
25
|
+
defineEmail: {};
|
|
26
|
+
DefineEmailOptions: {
|
|
27
|
+
isTypeOnly: true;
|
|
28
|
+
};
|
|
29
|
+
Divider: {};
|
|
30
|
+
EmailComponent: {
|
|
31
|
+
isTypeOnly: true;
|
|
32
|
+
};
|
|
33
|
+
EmailLayout: {};
|
|
34
|
+
Heading: {};
|
|
35
|
+
Link: {};
|
|
36
|
+
renderEmail: {};
|
|
37
|
+
Section: {};
|
|
38
|
+
Text: {};
|
|
39
|
+
theme: {};
|
|
40
|
+
}>>;
|
|
41
|
+
}, Record<never, Record<never, never>>>;
|
|
42
|
+
inviteEmail: import("@baseplate-dev/core-generators").TsTemplateFile<{}, {
|
|
43
|
+
transactionalLibImports: import("@baseplate-dev/sync").ProviderType<import("@baseplate-dev/core-generators").InferTsImportMapFromSchema<{
|
|
44
|
+
Button: {};
|
|
45
|
+
defineEmail: {};
|
|
46
|
+
DefineEmailOptions: {
|
|
47
|
+
isTypeOnly: true;
|
|
48
|
+
};
|
|
49
|
+
Divider: {};
|
|
50
|
+
EmailComponent: {
|
|
51
|
+
isTypeOnly: true;
|
|
52
|
+
};
|
|
53
|
+
EmailLayout: {};
|
|
54
|
+
Heading: {};
|
|
55
|
+
Link: {};
|
|
56
|
+
renderEmail: {};
|
|
57
|
+
Section: {};
|
|
58
|
+
Text: {};
|
|
59
|
+
theme: {};
|
|
60
|
+
}>>;
|
|
61
|
+
}, Record<never, Record<never, never>>>;
|
|
22
62
|
passwordChangedEmail: import("@baseplate-dev/core-generators").TsTemplateFile<{}, {
|
|
23
63
|
transactionalLibImports: import("@baseplate-dev/sync").ProviderType<import("@baseplate-dev/core-generators").InferTsImportMapFromSchema<{
|
|
24
64
|
Button: {};
|
|
@@ -12,6 +12,28 @@ const accountVerificationEmail = createTsTemplateFile({
|
|
|
12
12
|
},
|
|
13
13
|
variables: {},
|
|
14
14
|
});
|
|
15
|
+
const emailOtpEmail = createTsTemplateFile({
|
|
16
|
+
fileOptions: { kind: 'singleton' },
|
|
17
|
+
importMapProviders: {
|
|
18
|
+
transactionalLibImports: transactionalLibImportsProvider,
|
|
19
|
+
},
|
|
20
|
+
name: 'email-otp-email',
|
|
21
|
+
source: {
|
|
22
|
+
path: path.join(import.meta.dirname, '../templates/src/emails/auth/email-otp.email.tsx'),
|
|
23
|
+
},
|
|
24
|
+
variables: {},
|
|
25
|
+
});
|
|
26
|
+
const inviteEmail = createTsTemplateFile({
|
|
27
|
+
fileOptions: { kind: 'singleton' },
|
|
28
|
+
importMapProviders: {
|
|
29
|
+
transactionalLibImports: transactionalLibImportsProvider,
|
|
30
|
+
},
|
|
31
|
+
name: 'invite-email',
|
|
32
|
+
source: {
|
|
33
|
+
path: path.join(import.meta.dirname, '../templates/src/emails/auth/invite.email.tsx'),
|
|
34
|
+
},
|
|
35
|
+
variables: {},
|
|
36
|
+
});
|
|
15
37
|
const passwordChangedEmail = createTsTemplateFile({
|
|
16
38
|
fileOptions: { kind: 'singleton' },
|
|
17
39
|
importMapProviders: {
|
|
@@ -36,6 +58,8 @@ const passwordResetEmail = createTsTemplateFile({
|
|
|
36
58
|
});
|
|
37
59
|
export const LOCAL_AUTH_AUTH_EMAIL_TEMPLATES_TEMPLATES = {
|
|
38
60
|
accountVerificationEmail,
|
|
61
|
+
emailOtpEmail,
|
|
62
|
+
inviteEmail,
|
|
39
63
|
passwordChangedEmail,
|
|
40
64
|
passwordResetEmail,
|
|
41
65
|
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
import { defineEmail, Divider, EmailLayout, Heading, Section, Text, theme, } from '%transactionalLibImports';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
export default defineEmail(EmailOtpEmail, {
|
|
6
|
+
// Code first: inbox lists and notification previews truncate early, so many
|
|
7
|
+
// users never need to open the message. It also makes each resend visually
|
|
8
|
+
// distinct in clients that collapse threads by subject.
|
|
9
|
+
subject: ({ code }) => `${code} is your ${theme.branding.name} sign-in code`,
|
|
10
|
+
previewProps: {
|
|
11
|
+
code: '123456',
|
|
12
|
+
expiryMinutes: 10,
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
function EmailOtpEmail({ code, expiryMinutes, }) {
|
|
16
|
+
return (_jsxs(EmailLayout, { previewText: `Your ${theme.branding.name} sign-in code`, children: [_jsx(Heading, { as: "h2", children: "Your sign-in code" }), _jsxs(Text, { children: ["Enter this code to finish signing in to ", theme.branding.name, "."] }), _jsx(Section, { align: "center", children: _jsx(Text, { children: _jsx("strong", { style: { fontSize: '28px', letterSpacing: '6px' }, children: code }) }) }), _jsxs(Text, { children: ["This code expires in ", expiryMinutes, " minutes."] }), _jsx(Divider, { spacing: "lg" }), _jsx(Text, { variant: "muted", children: "If you didn't request this code, you can safely ignore this email. Someone may have typed your email address by mistake." })] }));
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=email-otp.email.js.map
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
defineEmail,
|
|
5
|
+
Divider,
|
|
6
|
+
EmailLayout,
|
|
7
|
+
Heading,
|
|
8
|
+
Section,
|
|
9
|
+
Text,
|
|
10
|
+
theme,
|
|
11
|
+
} from '%transactionalLibImports';
|
|
12
|
+
import * as React from 'react';
|
|
13
|
+
|
|
14
|
+
interface EmailOtpProps {
|
|
15
|
+
code: string;
|
|
16
|
+
expiryMinutes: number;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default defineEmail(EmailOtpEmail, {
|
|
20
|
+
// Code first: inbox lists and notification previews truncate early, so many
|
|
21
|
+
// users never need to open the message. It also makes each resend visually
|
|
22
|
+
// distinct in clients that collapse threads by subject.
|
|
23
|
+
subject: ({ code }) => `${code} is your ${theme.branding.name} sign-in code`,
|
|
24
|
+
previewProps: {
|
|
25
|
+
code: '123456',
|
|
26
|
+
expiryMinutes: 10,
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
function EmailOtpEmail({
|
|
31
|
+
code,
|
|
32
|
+
expiryMinutes,
|
|
33
|
+
}: EmailOtpProps): React.ReactElement {
|
|
34
|
+
return (
|
|
35
|
+
<EmailLayout previewText={`Your ${theme.branding.name} sign-in code`}>
|
|
36
|
+
<Heading as="h2">Your sign-in code</Heading>
|
|
37
|
+
<Text>
|
|
38
|
+
Enter this code to finish signing in to {theme.branding.name}.
|
|
39
|
+
</Text>
|
|
40
|
+
|
|
41
|
+
<Section align="center">
|
|
42
|
+
<Text>
|
|
43
|
+
<strong style={{ fontSize: '28px', letterSpacing: '6px' }}>
|
|
44
|
+
{code}
|
|
45
|
+
</strong>
|
|
46
|
+
</Text>
|
|
47
|
+
</Section>
|
|
48
|
+
|
|
49
|
+
<Text>This code expires in {expiryMinutes} minutes.</Text>
|
|
50
|
+
<Divider spacing="lg" />
|
|
51
|
+
<Text variant="muted">
|
|
52
|
+
If you didn't request this code, you can safely ignore this email.
|
|
53
|
+
Someone may have typed your email address by mistake.
|
|
54
|
+
</Text>
|
|
55
|
+
</EmailLayout>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
import { Button, defineEmail, Divider, EmailLayout, Heading, Section, Text, theme, } from '%transactionalLibImports';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
export default defineEmail(InviteEmail, {
|
|
6
|
+
subject: `You've been invited to ${theme.branding.name}`,
|
|
7
|
+
previewProps: {
|
|
8
|
+
acceptLink: 'https://example.com',
|
|
9
|
+
},
|
|
10
|
+
});
|
|
11
|
+
function InviteEmail({ acceptLink }) {
|
|
12
|
+
return (_jsxs(EmailLayout, { previewText: `You've been invited to ${theme.branding.name}`, children: [_jsx(Heading, { as: "h2", children: "You've been invited" }), _jsxs(Text, { children: ["You've been invited to join ", theme.branding.name, ". Click the button below to set your password and get started."] }), _jsx(Section, { align: "center", children: _jsx(Button, { href: acceptLink, children: "Accept Invite" }) }), _jsx(Divider, { spacing: "lg" }), _jsx(Text, { variant: "muted", children: "If you weren't expecting this invite, you can safely ignore this email." })] }));
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=invite.email.js.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
Button,
|
|
5
|
+
defineEmail,
|
|
6
|
+
Divider,
|
|
7
|
+
EmailLayout,
|
|
8
|
+
Heading,
|
|
9
|
+
Section,
|
|
10
|
+
Text,
|
|
11
|
+
theme,
|
|
12
|
+
} from '%transactionalLibImports';
|
|
13
|
+
import * as React from 'react';
|
|
14
|
+
|
|
15
|
+
interface InviteProps {
|
|
16
|
+
acceptLink: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default defineEmail(InviteEmail, {
|
|
20
|
+
subject: `You've been invited to ${theme.branding.name}`,
|
|
21
|
+
previewProps: {
|
|
22
|
+
acceptLink: 'https://example.com',
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
function InviteEmail({ acceptLink }: InviteProps): React.ReactElement {
|
|
27
|
+
return (
|
|
28
|
+
<EmailLayout previewText={`You've been invited to ${theme.branding.name}`}>
|
|
29
|
+
<Heading as="h2">You've been invited</Heading>
|
|
30
|
+
|
|
31
|
+
<Text>
|
|
32
|
+
You've been invited to join {theme.branding.name}. Click the button
|
|
33
|
+
below to set your password and get started.
|
|
34
|
+
</Text>
|
|
35
|
+
|
|
36
|
+
<Section align="center">
|
|
37
|
+
<Button href={acceptLink}>Accept Invite</Button>
|
|
38
|
+
</Section>
|
|
39
|
+
|
|
40
|
+
<Divider spacing="lg" />
|
|
41
|
+
|
|
42
|
+
<Text variant="muted">
|
|
43
|
+
If you weren't expecting this invite, you can safely ignore this email.
|
|
44
|
+
</Text>
|
|
45
|
+
</EmailLayout>
|
|
46
|
+
);
|
|
47
|
+
}
|