@baseplate-dev/plugin-auth 4.0.1 → 4.0.3

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.
Files changed (285) hide show
  1. package/CHANGELOG.md +645 -0
  2. package/dist/auth0/core/schema/plugin-definition.js +1 -1
  3. package/dist/auth0/core/schema/plugin-definition.js.map +1 -1
  4. package/dist/auth0/generators/fastify/auth0-module/templates/module/schema/user-session.queries.ts +1 -1
  5. package/dist/auth0/generators/react/auth0-hooks/auth0-hooks.generator.js +1 -1
  6. package/dist/auth0/generators/react/auth0-hooks/auth0-hooks.generator.js.map +1 -1
  7. package/dist/local-auth/constants/model-names.d.ts +4 -0
  8. package/dist/local-auth/constants/model-names.d.ts.map +1 -1
  9. package/dist/local-auth/constants/model-names.js +4 -0
  10. package/dist/local-auth/constants/model-names.js.map +1 -1
  11. package/dist/local-auth/core/generators/auth-email-password/auth-email-password.generator.d.ts +53 -0
  12. package/dist/local-auth/core/generators/auth-email-password/auth-email-password.generator.d.ts.map +1 -1
  13. package/dist/local-auth/core/generators/auth-email-password/auth-email-password.generator.js +28 -7
  14. package/dist/local-auth/core/generators/auth-email-password/auth-email-password.generator.js.map +1 -1
  15. package/dist/local-auth/core/generators/auth-email-password/generated/index.d.ts +219 -0
  16. package/dist/local-auth/core/generators/auth-email-password/generated/index.d.ts.map +1 -1
  17. package/dist/local-auth/core/generators/auth-email-password/generated/template-paths.d.ts +4 -0
  18. package/dist/local-auth/core/generators/auth-email-password/generated/template-paths.d.ts.map +1 -1
  19. package/dist/local-auth/core/generators/auth-email-password/generated/template-paths.js +4 -0
  20. package/dist/local-auth/core/generators/auth-email-password/generated/template-paths.js.map +1 -1
  21. package/dist/local-auth/core/generators/auth-email-password/generated/template-renderers.d.ts +47 -1
  22. package/dist/local-auth/core/generators/auth-email-password/generated/template-renderers.d.ts.map +1 -1
  23. package/dist/local-auth/core/generators/auth-email-password/generated/template-renderers.js +38 -2
  24. package/dist/local-auth/core/generators/auth-email-password/generated/template-renderers.js.map +1 -1
  25. package/dist/local-auth/core/generators/auth-email-password/generated/ts-import-providers.d.ts +18 -0
  26. package/dist/local-auth/core/generators/auth-email-password/generated/ts-import-providers.d.ts.map +1 -1
  27. package/dist/local-auth/core/generators/auth-email-password/generated/ts-import-providers.js +12 -0
  28. package/dist/local-auth/core/generators/auth-email-password/generated/ts-import-providers.js.map +1 -1
  29. package/dist/local-auth/core/generators/auth-email-password/generated/typed-templates.d.ts +271 -0
  30. package/dist/local-auth/core/generators/auth-email-password/generated/typed-templates.d.ts.map +1 -1
  31. package/dist/local-auth/core/generators/auth-email-password/generated/typed-templates.js +85 -4
  32. package/dist/local-auth/core/generators/auth-email-password/generated/typed-templates.js.map +1 -1
  33. package/dist/local-auth/core/generators/auth-email-password/templates/module/constants/password.constants.d.ts +15 -0
  34. package/dist/local-auth/core/generators/auth-email-password/templates/module/constants/password.constants.d.ts.map +1 -1
  35. package/dist/local-auth/core/generators/auth-email-password/templates/module/constants/password.constants.js +15 -0
  36. package/dist/local-auth/core/generators/auth-email-password/templates/module/constants/password.constants.js.map +1 -1
  37. package/dist/local-auth/core/generators/auth-email-password/templates/module/constants/password.constants.ts +18 -0
  38. package/dist/local-auth/core/generators/auth-email-password/templates/module/schema/email-verification.mutations.d.ts +2 -0
  39. package/dist/local-auth/core/generators/auth-email-password/templates/module/schema/email-verification.mutations.d.ts.map +1 -0
  40. package/dist/local-auth/core/generators/auth-email-password/templates/module/schema/email-verification.mutations.js +24 -0
  41. package/dist/local-auth/core/generators/auth-email-password/templates/module/schema/email-verification.mutations.js.map +1 -0
  42. package/dist/local-auth/core/generators/auth-email-password/templates/module/schema/email-verification.mutations.ts +35 -0
  43. package/dist/local-auth/core/generators/auth-email-password/templates/module/schema/password-reset.mutations.d.ts +2 -0
  44. package/dist/local-auth/core/generators/auth-email-password/templates/module/schema/password-reset.mutations.d.ts.map +1 -0
  45. package/dist/local-auth/core/generators/auth-email-password/templates/module/schema/password-reset.mutations.js +38 -0
  46. package/dist/local-auth/core/generators/auth-email-password/templates/module/schema/password-reset.mutations.js.map +1 -0
  47. package/dist/local-auth/core/generators/auth-email-password/templates/module/schema/password-reset.mutations.ts +54 -0
  48. package/dist/local-auth/core/generators/auth-email-password/templates/module/services/email-verification.service.d.ts +24 -0
  49. package/dist/local-auth/core/generators/auth-email-password/templates/module/services/email-verification.service.d.ts.map +1 -0
  50. package/dist/local-auth/core/generators/auth-email-password/templates/module/services/email-verification.service.js +87 -0
  51. package/dist/local-auth/core/generators/auth-email-password/templates/module/services/email-verification.service.js.map +1 -0
  52. package/dist/local-auth/core/generators/auth-email-password/templates/module/services/email-verification.service.ts +140 -0
  53. package/dist/local-auth/core/generators/auth-email-password/templates/module/services/password-reset.service.d.ts +35 -0
  54. package/dist/local-auth/core/generators/auth-email-password/templates/module/services/password-reset.service.d.ts.map +1 -0
  55. package/dist/local-auth/core/generators/auth-email-password/templates/module/services/password-reset.service.js +156 -0
  56. package/dist/local-auth/core/generators/auth-email-password/templates/module/services/password-reset.service.js.map +1 -0
  57. package/dist/local-auth/core/generators/auth-email-password/templates/module/services/password-reset.service.ts +229 -0
  58. package/dist/local-auth/core/generators/auth-email-password/templates/module/services/user-password.service.d.ts.map +1 -1
  59. package/dist/local-auth/core/generators/auth-email-password/templates/module/services/user-password.service.js +48 -14
  60. package/dist/local-auth/core/generators/auth-email-password/templates/module/services/user-password.service.js.map +1 -1
  61. package/dist/local-auth/core/generators/auth-email-password/templates/module/services/user-password.service.ts +79 -15
  62. package/dist/local-auth/core/generators/auth-email-templates/auth-email-templates.generator.d.ts +43 -0
  63. package/dist/local-auth/core/generators/auth-email-templates/auth-email-templates.generator.d.ts.map +1 -0
  64. package/dist/local-auth/core/generators/auth-email-templates/auth-email-templates.generator.js +48 -0
  65. package/dist/local-auth/core/generators/auth-email-templates/auth-email-templates.generator.js.map +1 -0
  66. package/dist/local-auth/core/generators/auth-email-templates/generated/index.d.ts +96 -0
  67. package/dist/local-auth/core/generators/auth-email-templates/generated/index.d.ts.map +1 -0
  68. package/dist/local-auth/core/generators/auth-email-templates/generated/index.js +11 -0
  69. package/dist/local-auth/core/generators/auth-email-templates/generated/index.js.map +1 -0
  70. package/dist/local-auth/core/generators/auth-email-templates/generated/template-paths.d.ts +14 -0
  71. package/dist/local-auth/core/generators/auth-email-templates/generated/template-paths.d.ts.map +1 -0
  72. package/dist/local-auth/core/generators/auth-email-templates/generated/template-paths.js +26 -0
  73. package/dist/local-auth/core/generators/auth-email-templates/generated/template-paths.js.map +1 -0
  74. package/dist/local-auth/core/generators/auth-email-templates/generated/template-renderers.d.ts +41 -0
  75. package/dist/local-auth/core/generators/auth-email-templates/generated/template-renderers.d.ts.map +1 -0
  76. package/dist/local-auth/core/generators/auth-email-templates/generated/template-renderers.js +59 -0
  77. package/dist/local-auth/core/generators/auth-email-templates/generated/template-renderers.js.map +1 -0
  78. package/dist/local-auth/core/generators/auth-email-templates/generated/typed-templates.d.ts +60 -0
  79. package/dist/local-auth/core/generators/auth-email-templates/generated/typed-templates.d.ts.map +1 -0
  80. package/dist/local-auth/core/generators/auth-email-templates/generated/typed-templates.js +42 -0
  81. package/dist/local-auth/core/generators/auth-email-templates/generated/typed-templates.js.map +1 -0
  82. package/dist/local-auth/core/generators/auth-email-templates/index.d.ts +2 -0
  83. package/dist/local-auth/core/generators/auth-email-templates/index.d.ts.map +1 -0
  84. package/dist/local-auth/core/generators/auth-email-templates/index.js +2 -0
  85. package/dist/local-auth/core/generators/auth-email-templates/index.js.map +1 -0
  86. package/dist/local-auth/core/generators/auth-email-templates/templates/src/emails/auth/account-verification.email.d.ts +3 -0
  87. package/dist/local-auth/core/generators/auth-email-templates/templates/src/emails/auth/account-verification.email.d.ts.map +1 -0
  88. package/dist/local-auth/core/generators/auth-email-templates/templates/src/emails/auth/account-verification.email.js +14 -0
  89. package/dist/local-auth/core/generators/auth-email-templates/templates/src/emails/auth/account-verification.email.js.map +1 -0
  90. package/dist/local-auth/core/generators/auth-email-templates/templates/src/emails/auth/account-verification.email.tsx +55 -0
  91. package/dist/local-auth/core/generators/auth-email-templates/templates/src/emails/auth/password-changed.email.d.ts +3 -0
  92. package/dist/local-auth/core/generators/auth-email-templates/templates/src/emails/auth/password-changed.email.d.ts.map +1 -0
  93. package/dist/local-auth/core/generators/auth-email-templates/templates/src/emails/auth/password-changed.email.js +12 -0
  94. package/dist/local-auth/core/generators/auth-email-templates/templates/src/emails/auth/password-changed.email.js.map +1 -0
  95. package/dist/local-auth/core/generators/auth-email-templates/templates/src/emails/auth/password-changed.email.tsx +44 -0
  96. package/dist/local-auth/core/generators/auth-email-templates/templates/src/emails/auth/password-reset.email.d.ts +3 -0
  97. package/dist/local-auth/core/generators/auth-email-templates/templates/src/emails/auth/password-reset.email.d.ts.map +1 -0
  98. package/dist/local-auth/core/generators/auth-email-templates/templates/src/emails/auth/password-reset.email.js +14 -0
  99. package/dist/local-auth/core/generators/auth-email-templates/templates/src/emails/auth/password-reset.email.js.map +1 -0
  100. package/dist/local-auth/core/generators/auth-email-templates/templates/src/emails/auth/password-reset.email.tsx +55 -0
  101. package/dist/local-auth/core/generators/auth-module/auth-module.generator.d.ts +11 -0
  102. package/dist/local-auth/core/generators/auth-module/auth-module.generator.d.ts.map +1 -1
  103. package/dist/local-auth/core/generators/auth-module/auth-module.generator.js +12 -2
  104. package/dist/local-auth/core/generators/auth-module/auth-module.generator.js.map +1 -1
  105. package/dist/local-auth/core/generators/auth-module/generated/index.d.ts +26 -0
  106. package/dist/local-auth/core/generators/auth-module/generated/index.d.ts.map +1 -1
  107. package/dist/local-auth/core/generators/auth-module/generated/template-paths.d.ts +2 -0
  108. package/dist/local-auth/core/generators/auth-module/generated/template-paths.d.ts.map +1 -1
  109. package/dist/local-auth/core/generators/auth-module/generated/template-paths.js +2 -0
  110. package/dist/local-auth/core/generators/auth-module/generated/template-paths.js.map +1 -1
  111. package/dist/local-auth/core/generators/auth-module/generated/template-renderers.d.ts +10 -0
  112. package/dist/local-auth/core/generators/auth-module/generated/template-renderers.d.ts.map +1 -1
  113. package/dist/local-auth/core/generators/auth-module/generated/template-renderers.js +25 -1
  114. package/dist/local-auth/core/generators/auth-module/generated/template-renderers.js.map +1 -1
  115. package/dist/local-auth/core/generators/auth-module/generated/ts-import-providers.d.ts +9 -0
  116. package/dist/local-auth/core/generators/auth-module/generated/ts-import-providers.d.ts.map +1 -1
  117. package/dist/local-auth/core/generators/auth-module/generated/ts-import-providers.js +6 -0
  118. package/dist/local-auth/core/generators/auth-module/generated/ts-import-providers.js.map +1 -1
  119. package/dist/local-auth/core/generators/auth-module/generated/typed-templates.d.ts +19 -0
  120. package/dist/local-auth/core/generators/auth-module/generated/typed-templates.d.ts.map +1 -1
  121. package/dist/local-auth/core/generators/auth-module/generated/typed-templates.js +30 -0
  122. package/dist/local-auth/core/generators/auth-module/generated/typed-templates.js.map +1 -1
  123. package/dist/local-auth/core/generators/auth-module/templates/module/queues/cleanup-auth-verification.queue.d.ts +6 -0
  124. package/dist/local-auth/core/generators/auth-module/templates/module/queues/cleanup-auth-verification.queue.d.ts.map +1 -0
  125. package/dist/local-auth/core/generators/auth-module/templates/module/queues/cleanup-auth-verification.queue.js +17 -0
  126. package/dist/local-auth/core/generators/auth-module/templates/module/queues/cleanup-auth-verification.queue.js.map +1 -0
  127. package/dist/local-auth/core/generators/auth-module/templates/module/queues/cleanup-auth-verification.queue.ts +21 -0
  128. package/dist/local-auth/core/generators/auth-module/templates/module/schema/user-session.mutations.js +1 -1
  129. package/dist/local-auth/core/generators/auth-module/templates/module/schema/user-session.mutations.js.map +1 -1
  130. package/dist/local-auth/core/generators/auth-module/templates/module/schema/user-session.mutations.ts +1 -1
  131. package/dist/local-auth/core/generators/auth-module/templates/module/schema/user-session.queries.js +2 -2
  132. package/dist/local-auth/core/generators/auth-module/templates/module/schema/user-session.queries.js.map +1 -1
  133. package/dist/local-auth/core/generators/auth-module/templates/module/schema/user-session.queries.ts +2 -2
  134. package/dist/local-auth/core/generators/auth-module/templates/module/services/auth-verification.service.d.ts +40 -0
  135. package/dist/local-auth/core/generators/auth-module/templates/module/services/auth-verification.service.d.ts.map +1 -0
  136. package/dist/local-auth/core/generators/auth-module/templates/module/services/auth-verification.service.js +106 -0
  137. package/dist/local-auth/core/generators/auth-module/templates/module/services/auth-verification.service.js.map +1 -0
  138. package/dist/local-auth/core/generators/auth-module/templates/module/services/auth-verification.service.ts +146 -0
  139. package/dist/local-auth/core/generators/auth-routes/auth-routes.generator.d.ts.map +1 -1
  140. package/dist/local-auth/core/generators/auth-routes/auth-routes.generator.js +1 -0
  141. package/dist/local-auth/core/generators/auth-routes/auth-routes.generator.js.map +1 -1
  142. package/dist/local-auth/core/generators/auth-routes/generated/index.d.ts +722 -4
  143. package/dist/local-auth/core/generators/auth-routes/generated/index.d.ts.map +1 -1
  144. package/dist/local-auth/core/generators/auth-routes/generated/index.js +2 -0
  145. package/dist/local-auth/core/generators/auth-routes/generated/index.js.map +1 -1
  146. package/dist/local-auth/core/generators/auth-routes/generated/template-paths.d.ts +4 -0
  147. package/dist/local-auth/core/generators/auth-routes/generated/template-paths.d.ts.map +1 -1
  148. package/dist/local-auth/core/generators/auth-routes/generated/template-paths.js +4 -0
  149. package/dist/local-auth/core/generators/auth-routes/generated/template-paths.js.map +1 -1
  150. package/dist/local-auth/core/generators/auth-routes/generated/template-renderers.d.ts +4 -1
  151. package/dist/local-auth/core/generators/auth-routes/generated/template-renderers.d.ts.map +1 -1
  152. package/dist/local-auth/core/generators/auth-routes/generated/template-renderers.js +14 -0
  153. package/dist/local-auth/core/generators/auth-routes/generated/template-renderers.js.map +1 -1
  154. package/dist/local-auth/core/generators/auth-routes/generated/ts-import-providers.d.ts +21 -0
  155. package/dist/local-auth/core/generators/auth-routes/generated/ts-import-providers.d.ts.map +1 -0
  156. package/dist/local-auth/core/generators/auth-routes/generated/ts-import-providers.js +30 -0
  157. package/dist/local-auth/core/generators/auth-routes/generated/ts-import-providers.js.map +1 -0
  158. package/dist/local-auth/core/generators/auth-routes/generated/typed-templates.d.ts +1216 -34
  159. package/dist/local-auth/core/generators/auth-routes/generated/typed-templates.d.ts.map +1 -1
  160. package/dist/local-auth/core/generators/auth-routes/generated/typed-templates.js +70 -2
  161. package/dist/local-auth/core/generators/auth-routes/generated/typed-templates.js.map +1 -1
  162. package/dist/local-auth/core/generators/auth-routes/index.d.ts +2 -0
  163. package/dist/local-auth/core/generators/auth-routes/index.d.ts.map +1 -1
  164. package/dist/local-auth/core/generators/auth-routes/index.js +1 -0
  165. package/dist/local-auth/core/generators/auth-routes/index.js.map +1 -1
  166. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/-constants.d.ts +10 -0
  167. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/-constants.d.ts.map +1 -0
  168. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/-constants.js +11 -0
  169. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/-constants.js.map +1 -0
  170. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/-constants.ts +12 -0
  171. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/forgot-password.d.ts +2 -0
  172. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/forgot-password.d.ts.map +1 -0
  173. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/forgot-password.js +60 -0
  174. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/forgot-password.js.map +1 -0
  175. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/forgot-password.tsx +127 -0
  176. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/login.d.ts +1 -1
  177. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/login.d.ts.map +1 -1
  178. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/login.js +6 -11
  179. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/login.js.map +1 -1
  180. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/login.tsx +20 -19
  181. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/register.d.ts +1 -1
  182. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/register.d.ts.map +1 -1
  183. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/register.js +2 -2
  184. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/register.js.map +1 -1
  185. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/register.tsx +2 -3
  186. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/reset-password.d.ts +7 -0
  187. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/reset-password.d.ts.map +1 -0
  188. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/reset-password.js +131 -0
  189. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/reset-password.js.map +1 -0
  190. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/reset-password.tsx +240 -0
  191. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/verify-email.d.ts +7 -0
  192. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/verify-email.d.ts.map +1 -0
  193. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/verify-email.js +106 -0
  194. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/verify-email.js.map +1 -0
  195. package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/verify-email.tsx +206 -0
  196. package/dist/local-auth/core/generators/index.d.ts +1 -0
  197. package/dist/local-auth/core/generators/index.d.ts.map +1 -1
  198. package/dist/local-auth/core/generators/index.js +1 -0
  199. package/dist/local-auth/core/generators/index.js.map +1 -1
  200. package/dist/local-auth/core/generators/seed-initial-user/generated/index.d.ts +12 -0
  201. package/dist/local-auth/core/generators/seed-initial-user/generated/index.d.ts.map +1 -1
  202. package/dist/local-auth/core/generators/seed-initial-user/generated/template-renderers.d.ts +6 -0
  203. package/dist/local-auth/core/generators/seed-initial-user/generated/template-renderers.d.ts.map +1 -1
  204. package/dist/local-auth/core/generators/seed-initial-user/generated/typed-templates.d.ts +6 -0
  205. package/dist/local-auth/core/generators/seed-initial-user/generated/typed-templates.d.ts.map +1 -1
  206. package/dist/local-auth/core/generators/seed-initial-user/seed-initial-user.generator.d.ts +6 -0
  207. package/dist/local-auth/core/generators/seed-initial-user/seed-initial-user.generator.d.ts.map +1 -1
  208. package/dist/local-auth/core/generators/seed-initial-user/seed-initial-user.generator.js +1 -1
  209. package/dist/local-auth/core/generators/seed-initial-user/seed-initial-user.generator.js.map +1 -1
  210. package/dist/local-auth/core/node.d.ts.map +1 -1
  211. package/dist/local-auth/core/node.js +11 -1
  212. package/dist/local-auth/core/node.js.map +1 -1
  213. package/dist/local-auth/core/schema/models.d.ts.map +1 -1
  214. package/dist/local-auth/core/schema/models.js +60 -0
  215. package/dist/local-auth/core/schema/models.js.map +1 -1
  216. package/dist/placeholder-auth/core/schema/plugin-definition.js +1 -1
  217. package/dist/placeholder-auth/core/schema/plugin-definition.js.map +1 -1
  218. package/dist/web/assets/{__federation_expose_auth0CoreCommon-DLSGXjCI.js → __federation_expose_auth0CoreCommon-e_GtBIIm.js} +3 -3
  219. package/dist/web/assets/{__federation_expose_auth0CoreCommon-DLSGXjCI.js.map → __federation_expose_auth0CoreCommon-e_GtBIIm.js.map} +1 -1
  220. package/dist/web/assets/{__federation_expose_auth0CoreWeb-C7FfhlmF.js → __federation_expose_auth0CoreWeb-CTfPylMw.js} +5 -5
  221. package/dist/web/assets/{__federation_expose_auth0CoreWeb-C7FfhlmF.js.map → __federation_expose_auth0CoreWeb-CTfPylMw.js.map} +1 -1
  222. package/dist/web/assets/{__federation_expose_authCoreCommon-BF58isGa.js → __federation_expose_authCoreCommon-Bg2mzE9K.js} +3 -3
  223. package/dist/web/assets/{__federation_expose_authCoreCommon-BF58isGa.js.map → __federation_expose_authCoreCommon-Bg2mzE9K.js.map} +1 -1
  224. package/dist/web/assets/{__federation_expose_authCoreWeb-DMq9M88g.js → __federation_expose_authCoreWeb-DrOVHmj4.js} +6 -6
  225. package/dist/web/assets/{__federation_expose_authCoreWeb-DMq9M88g.js.map → __federation_expose_authCoreWeb-DrOVHmj4.js.map} +1 -1
  226. package/dist/web/assets/{__federation_expose_local-authAdminCommon-sQw4q5YX.js → __federation_expose_local-authAdminCommon-Bzb0P17-.js} +2 -2
  227. package/dist/web/assets/{__federation_expose_local-authAdminCommon-sQw4q5YX.js.map → __federation_expose_local-authAdminCommon-Bzb0P17-.js.map} +1 -1
  228. package/dist/web/assets/{__federation_expose_local-authAdminWeb-9FbO89NR.js → __federation_expose_local-authAdminWeb-D_LWcl7j.js} +3 -3
  229. package/dist/web/assets/{__federation_expose_local-authAdminWeb-9FbO89NR.js.map → __federation_expose_local-authAdminWeb-D_LWcl7j.js.map} +1 -1
  230. package/dist/web/assets/{__federation_expose_local-authCoreCommon-CpUK09_4.js → __federation_expose_local-authCoreCommon-D6OG-Rz6.js} +4 -4
  231. package/dist/web/assets/{__federation_expose_local-authCoreCommon-CpUK09_4.js.map → __federation_expose_local-authCoreCommon-D6OG-Rz6.js.map} +1 -1
  232. package/dist/web/assets/{__federation_expose_local-authCoreWeb-Czp0GaY1.js → __federation_expose_local-authCoreWeb-CaR8fx1f.js} +66 -6
  233. package/dist/web/assets/__federation_expose_local-authCoreWeb-CaR8fx1f.js.map +1 -0
  234. package/dist/web/assets/{__federation_expose_placeholder-authCoreCommon-CFDDdOMo.js → __federation_expose_placeholder-authCoreCommon-D7b3GEPP.js} +3 -3
  235. package/dist/web/assets/{__federation_expose_placeholder-authCoreCommon-CFDDdOMo.js.map → __federation_expose_placeholder-authCoreCommon-D7b3GEPP.js.map} +1 -1
  236. package/dist/web/assets/{__federation_expose_placeholder-authCoreWeb-Bcn1_oDP.js → __federation_expose_placeholder-authCoreWeb-VZzvid5j.js} +5 -5
  237. package/dist/web/assets/{__federation_expose_placeholder-authCoreWeb-Bcn1_oDP.js.map → __federation_expose_placeholder-authCoreWeb-VZzvid5j.js.map} +1 -1
  238. package/dist/web/assets/{__federation_fn_import-DsXcpNlB.js → __federation_fn_import-DfNliZHH.js} +2 -2
  239. package/dist/web/assets/{__federation_fn_import-DsXcpNlB.js.map → __federation_fn_import-DfNliZHH.js.map} +1 -1
  240. package/dist/web/assets/__federation_shared_@baseplate-dev/project-builder-lib/{web-zqe3PPcn.js → web-BqJ1vSYx.js} +8 -8
  241. package/dist/web/assets/__federation_shared_@baseplate-dev/project-builder-lib/web-BqJ1vSYx.js.map +1 -0
  242. package/dist/web/assets/__federation_shared_@baseplate-dev/{project-builder-lib-CmgMfkI5.js → project-builder-lib-qf98MMJC.js} +7137 -136
  243. package/dist/web/assets/__federation_shared_@baseplate-dev/project-builder-lib-qf98MMJC.js.map +1 -0
  244. package/dist/web/assets/__federation_shared_@baseplate-dev/ui-components-DFkMnXmX.js +52536 -0
  245. package/dist/web/assets/__federation_shared_@baseplate-dev/ui-components-DFkMnXmX.js.map +1 -0
  246. package/dist/web/assets/__federation_shared_@baseplate-dev/{utils-BO5VHrCf.js → utils-CApJheqk.js} +5 -6
  247. package/dist/web/assets/__federation_shared_@baseplate-dev/utils-CApJheqk.js.map +1 -0
  248. package/dist/web/assets/__federation_shared_@tanstack/{react-router-CNzDweD5.js → react-router-YQslfDyE.js} +1069 -746
  249. package/dist/web/assets/__federation_shared_@tanstack/react-router-YQslfDyE.js.map +1 -0
  250. package/dist/web/assets/{get-auth-plugin-definition-BV2O8wTa.js → get-auth-plugin-definition-CVuj_mvy.js} +2 -2
  251. package/dist/web/assets/{get-auth-plugin-definition-BV2O8wTa.js.map → get-auth-plugin-definition-CVuj_mvy.js.map} +1 -1
  252. package/dist/web/assets/{index-BL7fotl7.js → index-B00D4irM.js} +2 -2
  253. package/dist/web/assets/{index-BL7fotl7.js.map → index-B00D4irM.js.map} +1 -1
  254. package/dist/web/assets/{index.esm-B4RpOlq_.js → index.esm-1qBxxnfu.js} +2 -2
  255. package/dist/web/assets/{index.esm-B4RpOlq_.js.map → index.esm-1qBxxnfu.js.map} +1 -1
  256. package/dist/web/assets/{model-merger-BwRNqcBu.js → model-merger-59HLmy_J.js} +80 -23
  257. package/dist/web/assets/model-merger-59HLmy_J.js.map +1 -0
  258. package/dist/web/assets/{model-names-CEoSIalq.js → model-names-DrcaRxt1.js} +6 -2
  259. package/dist/web/assets/{model-names-CEoSIalq.js.map → model-names-DrcaRxt1.js.map} +1 -1
  260. package/dist/web/assets/{plugin-definition-BMTsmwyH.js → plugin-definition-BKCeZ0Ni.js} +2 -2
  261. package/dist/web/assets/{plugin-definition-BMTsmwyH.js.map → plugin-definition-BKCeZ0Ni.js.map} +1 -1
  262. package/dist/web/assets/{plugin-definition-DA9rJBcS.js → plugin-definition-B_hlyPlm.js} +3 -3
  263. package/dist/web/assets/plugin-definition-B_hlyPlm.js.map +1 -0
  264. package/dist/web/assets/{plugin-definition-CHD5r-h7.js → plugin-definition-Bkx-a_wA.js} +3 -3
  265. package/dist/web/assets/plugin-definition-Bkx-a_wA.js.map +1 -0
  266. package/dist/web/assets/{plugin-definition-B9d2CoQL.js → plugin-definition-CcdhC0td.js} +2 -2
  267. package/dist/web/assets/{plugin-definition-B9d2CoQL.js.map → plugin-definition-CcdhC0td.js.map} +1 -1
  268. package/dist/web/assets/{react-B9vhIZMy.js → react-Df9ccuow.js} +2 -2
  269. package/dist/web/assets/{react-B9vhIZMy.js.map → react-Df9ccuow.js.map} +1 -1
  270. package/dist/web/assets/remoteEntry.js +20 -20
  271. package/dist/web/assets/{style-DZ-aOCkd.css → style-DiK_rD1L.css} +1 -1
  272. package/dist/web/assets/{styles-CEm5K1iU.js → styles-CbPVroCT.js} +3 -3
  273. package/dist/web/assets/{styles-CEm5K1iU.js.map → styles-CbPVroCT.js.map} +1 -1
  274. package/dist/web/index.html +1 -1
  275. package/package.json +22 -19
  276. package/dist/web/assets/__federation_expose_local-authCoreWeb-Czp0GaY1.js.map +0 -1
  277. package/dist/web/assets/__federation_shared_@baseplate-dev/project-builder-lib/web-zqe3PPcn.js.map +0 -1
  278. package/dist/web/assets/__federation_shared_@baseplate-dev/project-builder-lib-CmgMfkI5.js.map +0 -1
  279. package/dist/web/assets/__federation_shared_@baseplate-dev/ui-components-D1Dayhn9.js +0 -24082
  280. package/dist/web/assets/__federation_shared_@baseplate-dev/ui-components-D1Dayhn9.js.map +0 -1
  281. package/dist/web/assets/__federation_shared_@baseplate-dev/utils-BO5VHrCf.js.map +0 -1
  282. package/dist/web/assets/__federation_shared_@tanstack/react-router-CNzDweD5.js.map +0 -1
  283. package/dist/web/assets/model-merger-BwRNqcBu.js.map +0 -1
  284. package/dist/web/assets/plugin-definition-CHD5r-h7.js.map +0 -1
  285. package/dist/web/assets/plugin-definition-DA9rJBcS.js.map +0 -1
@@ -0,0 +1,140 @@
1
+ // @ts-nocheck
2
+
3
+ import type { RequestServiceContext } from '%requestServiceContextImports';
4
+
5
+ import { EMAIL_VERIFICATION_TOKEN_EXPIRY_SEC } from '$constantsPassword';
6
+ import {
7
+ createAuthVerification,
8
+ validateAuthVerification,
9
+ } from '%authModuleImports';
10
+ import { config } from '%configServiceImports';
11
+ import { sendEmail } from '%emailModuleImports';
12
+ import { BadRequestError } from '%errorHandlerServiceImports';
13
+ import { prisma } from '%prismaImports';
14
+ import { memoizeRateLimiter } from '%rateLimitImports';
15
+
16
+ const EMAIL_VERIFY_TYPE = 'email-verify';
17
+
18
+ /**
19
+ * Rate limiters for email verification operations.
20
+ */
21
+
22
+ // Per-user rate limit: 3 requests per 20 minutes
23
+ const getRequestEmailVerificationUserLimiter = memoizeRateLimiter(
24
+ 'request-email-verification-user',
25
+ {
26
+ points: 3,
27
+ duration: 60 * 20, // 20 minutes
28
+ },
29
+ );
30
+
31
+ // Per-IP rate limit: 10 requests/hour
32
+ const getRequestEmailVerificationIpLimiter = memoizeRateLimiter(
33
+ 'request-email-verification-ip',
34
+ {
35
+ points: 10,
36
+ duration: 60 * 60, // 1 hour
37
+ },
38
+ );
39
+
40
+ // Per-IP rate limit for verify endpoint: 10 requests/hour
41
+ const getVerifyEmailIpLimiter = memoizeRateLimiter('verify-email-ip', {
42
+ points: 10,
43
+ duration: 60 * 60, // 1 hour
44
+ });
45
+
46
+ /**
47
+ * Request an email verification for the authenticated user.
48
+ * Sends a verification email with a link to verify.
49
+ */
50
+ export async function requestEmailVerification({
51
+ userId,
52
+ context,
53
+ }: {
54
+ userId: string;
55
+ context: RequestServiceContext;
56
+ }): Promise<{ success: true }> {
57
+ await Promise.all([
58
+ getRequestEmailVerificationIpLimiter().consumeOrThrow(
59
+ context.reqInfo.ip,
60
+ 'Too many verification attempts. Please try again later.',
61
+ 'too-many-requests',
62
+ ),
63
+ getRequestEmailVerificationUserLimiter().consumeOrThrow(
64
+ userId,
65
+ 'Too many verification attempts. Please try again later.',
66
+ 'too-many-requests',
67
+ ),
68
+ ]);
69
+
70
+ const user = await prisma.user.findUnique({
71
+ where: { id: userId },
72
+ select: { id: true, email: true, emailVerified: true },
73
+ });
74
+
75
+ if (!user?.email) {
76
+ throw new BadRequestError('No email address on account', 'no-email');
77
+ }
78
+
79
+ if (user.emailVerified) {
80
+ return { success: true };
81
+ }
82
+
83
+ const { token } = await createAuthVerification({
84
+ type: EMAIL_VERIFY_TYPE,
85
+ userId: user.id,
86
+ expiresInSec: EMAIL_VERIFICATION_TOKEN_EXPIRY_SEC,
87
+ });
88
+
89
+ // Construct verification URL using configured domain
90
+ const verifyLink = `${config.AUTH_FRONTEND_URL}/auth/verify-email?token=${encodeURIComponent(token)}`;
91
+
92
+ await sendEmail(TPL_ACCOUNT_VERIFICATION_EMAIL, {
93
+ to: user.email,
94
+ data: { verifyLink },
95
+ });
96
+
97
+ return { success: true };
98
+ }
99
+
100
+ /**
101
+ * Verify a user's email using the token from the verification email.
102
+ * This is a public (anonymous) mutation — the token proves identity.
103
+ *
104
+ * @throws BadRequestError if token is invalid or expired
105
+ */
106
+ export async function verifyEmail({
107
+ token,
108
+ context,
109
+ }: {
110
+ token: string;
111
+ context: RequestServiceContext;
112
+ }): Promise<{ success: true }> {
113
+ await getVerifyEmailIpLimiter().consumeOrThrow(
114
+ context.reqInfo.ip,
115
+ 'Too many verification attempts. Please try again later.',
116
+ 'too-many-requests',
117
+ );
118
+
119
+ const record = await validateAuthVerification({
120
+ type: EMAIL_VERIFY_TYPE,
121
+ token,
122
+ });
123
+
124
+ if (!record?.userId) {
125
+ throw new BadRequestError('Invalid or expired token', 'invalid-token');
126
+ }
127
+
128
+ // Delete this token + remaining email-verify tokens + update user in one transaction
129
+ await prisma.$transaction([
130
+ prisma.authVerification.deleteMany({
131
+ where: { type: EMAIL_VERIFY_TYPE, userId: record.userId },
132
+ }),
133
+ prisma.user.update({
134
+ where: { id: record.userId },
135
+ data: { emailVerified: true },
136
+ }),
137
+ ]);
138
+
139
+ return { success: true };
140
+ }
@@ -0,0 +1,35 @@
1
+ import type { RequestServiceContext } from '%requestServiceContextImports';
2
+ /**
3
+ * Request a password reset for the given email.
4
+ */
5
+ export declare function requestPasswordReset({ email: rawEmail, context, }: {
6
+ email: string;
7
+ context: RequestServiceContext;
8
+ }): Promise<{
9
+ success: true;
10
+ }>;
11
+ /**
12
+ * Validates a password reset token without consuming it.
13
+ * Used by the frontend to verify the token is valid before showing the reset form.
14
+ */
15
+ export declare function validatePasswordResetToken({ token: rawToken, }: {
16
+ token: string;
17
+ }): Promise<{
18
+ valid: boolean;
19
+ }>;
20
+ /**
21
+ * Completes the password reset process by setting a new password.
22
+ *
23
+ * Security notes (OWASP Forgot Password Cheat Sheet):
24
+ * - Token is single-use (deleted after successful reset)
25
+ * - Does not auto-login the user
26
+ * - Always invalidates all existing sessions for security
27
+ * - All remaining password-reset tokens for this user are deleted
28
+ */
29
+ export declare function completePasswordReset({ token: rawToken, newPassword: rawNewPassword, }: {
30
+ token: string;
31
+ newPassword: string;
32
+ }): Promise<{
33
+ success: true;
34
+ }>;
35
+ //# sourceMappingURL=password-reset.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"password-reset.service.d.ts","sourceRoot":"","sources":["../../../../../../../../src/local-auth/core/generators/auth-email-password/templates/module/services/password-reset.service.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AA4D3E;;GAEG;AACH,wBAAsB,oBAAoB,CAAC,EACzC,KAAK,EAAE,QAAQ,EACf,OAAO,GACR,EAAE;IACD,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,qBAAqB,CAAC;CAChC,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,IAAI,CAAA;CAAE,CAAC,CAgD7B;AAMD;;;GAGG;AACH,wBAAsB,0BAA0B,CAAC,EAC/C,KAAK,EAAE,QAAQ,GAChB,EAAE;IACD,KAAK,EAAE,MAAM,CAAC;CACf,GAAG,OAAO,CAAC;IAAE,KAAK,EAAE,OAAO,CAAA;CAAE,CAAC,CAW9B;AAOD;;;;;;;;GAQG;AACH,wBAAsB,qBAAqB,CAAC,EAC1C,KAAK,EAAE,QAAQ,EACf,WAAW,EAAE,cAAc,GAC5B,EAAE;IACD,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;CACrB,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,IAAI,CAAA;CAAE,CAAC,CA8D7B"}
@@ -0,0 +1,156 @@
1
+ // @ts-nocheck
2
+ import { PASSWORD_MAX_LENGTH, PASSWORD_MIN_LENGTH, PASSWORD_RESET_TOKEN_EXPIRY_SEC, } from '$constantsPassword';
3
+ import { createAuthVerification, validateAuthVerification, } from '%authModuleImports';
4
+ import { config } from '%configServiceImports';
5
+ import { sendEmail } from '%emailModuleImports';
6
+ import { BadRequestError, handleZodRequestValidationError, } from '%errorHandlerServiceImports';
7
+ import { createPasswordHash } from '%passwordHasherServiceImports';
8
+ import { prisma } from '%prismaImports';
9
+ import { memoizeRateLimiter } from '%rateLimitImports';
10
+ import z from 'zod';
11
+ const PROVIDER_ID = 'email-password';
12
+ const PASSWORD_RESET_TYPE = 'password-reset';
13
+ /**
14
+ * Rate limiters for password reset operations.
15
+ */
16
+ // Per-email rate limit: 3 requests/hour
17
+ const getPasswordResetEmailLimiter = memoizeRateLimiter('password-reset-email', {
18
+ points: 3,
19
+ duration: 60 * 60, // 1 hour
20
+ });
21
+ // Per-IP rate limit: 10 requests/hour (prevents email scanning)
22
+ const getPasswordResetIpLimiter = memoizeRateLimiter('password-reset-ip', {
23
+ points: 10,
24
+ duration: 60 * 60, // 1 hour
25
+ });
26
+ // Global rate limit: 100 requests/hour (prevents overloading the email service)
27
+ const getPasswordResetGlobalLimiter = memoizeRateLimiter('password-reset-global', {
28
+ points: 100,
29
+ duration: 60 * 60, // 1 hour
30
+ });
31
+ const requestPasswordResetSchema = z.object({
32
+ email: z
33
+ .email()
34
+ .max(PASSWORD_MAX_LENGTH)
35
+ .transform((value) => value.toLowerCase()),
36
+ });
37
+ /**
38
+ * Request a password reset for the given email.
39
+ */
40
+ export async function requestPasswordReset({ email: rawEmail, context, }) {
41
+ const { email } = await requestPasswordResetSchema
42
+ .parseAsync({ email: rawEmail })
43
+ .catch(handleZodRequestValidationError);
44
+ await Promise.all([
45
+ getPasswordResetIpLimiter().consumeOrThrow(context.reqInfo.ip, 'Too many password reset attempts. Please try again later.', 'too-many-requests'),
46
+ getPasswordResetEmailLimiter().consumeOrThrow(email, 'Too many password reset attempts. Please try again later.', 'too-many-requests'),
47
+ getPasswordResetGlobalLimiter().consumeOrThrow('global', 'Too many password reset attempts. Please try again later.', 'too-many-requests'),
48
+ ]);
49
+ // Find user by email - silently handle non-existent users to prevent enumeration
50
+ const user = await prisma.user.findUnique({
51
+ where: { email },
52
+ select: { id: true, email: true },
53
+ });
54
+ if (user?.email) {
55
+ const { token } = await createAuthVerification({
56
+ type: PASSWORD_RESET_TYPE,
57
+ userId: user.id,
58
+ expiresInSec: PASSWORD_RESET_TOKEN_EXPIRY_SEC,
59
+ });
60
+ // Construct reset URL using configured domain
61
+ const resetLink = `${config.AUTH_FRONTEND_URL}/auth/reset-password?token=${encodeURIComponent(token)}`;
62
+ // Send email asynchronously (queue-based)
63
+ await sendEmail(TPL_PASSWORD_RESET_EMAIL, {
64
+ to: user.email,
65
+ data: { resetLink },
66
+ });
67
+ }
68
+ // Always return success to prevent user enumeration
69
+ return { success: true };
70
+ }
71
+ const validateTokenSchema = z.object({
72
+ token: z.string().min(1).max(PASSWORD_MAX_LENGTH),
73
+ });
74
+ /**
75
+ * Validates a password reset token without consuming it.
76
+ * Used by the frontend to verify the token is valid before showing the reset form.
77
+ */
78
+ export async function validatePasswordResetToken({ token: rawToken, }) {
79
+ const { token } = await validateTokenSchema
80
+ .parseAsync({ token: rawToken })
81
+ .catch(handleZodRequestValidationError);
82
+ const record = await validateAuthVerification({
83
+ type: PASSWORD_RESET_TYPE,
84
+ token,
85
+ });
86
+ return { valid: record !== null };
87
+ }
88
+ const completePasswordResetSchema = z.object({
89
+ token: z.string().min(1).max(PASSWORD_MAX_LENGTH),
90
+ newPassword: z.string().min(PASSWORD_MIN_LENGTH).max(PASSWORD_MAX_LENGTH),
91
+ });
92
+ /**
93
+ * Completes the password reset process by setting a new password.
94
+ *
95
+ * Security notes (OWASP Forgot Password Cheat Sheet):
96
+ * - Token is single-use (deleted after successful reset)
97
+ * - Does not auto-login the user
98
+ * - Always invalidates all existing sessions for security
99
+ * - All remaining password-reset tokens for this user are deleted
100
+ */
101
+ export async function completePasswordReset({ token: rawToken, newPassword: rawNewPassword, }) {
102
+ const { token, newPassword } = await completePasswordResetSchema
103
+ .parseAsync({
104
+ token: rawToken,
105
+ newPassword: rawNewPassword,
106
+ })
107
+ .catch(handleZodRequestValidationError);
108
+ const record = await validateAuthVerification({
109
+ type: PASSWORD_RESET_TYPE,
110
+ token,
111
+ });
112
+ if (!record?.userId) {
113
+ throw new BadRequestError('Invalid or expired token', 'invalid-token');
114
+ }
115
+ const user = await prisma.user.findUniqueOrThrow({
116
+ where: { id: record.userId },
117
+ select: { id: true, email: true },
118
+ });
119
+ if (!user.email) {
120
+ throw new BadRequestError('User has no email', 'user-has-no-email');
121
+ }
122
+ const passwordHash = await createPasswordHash(newPassword);
123
+ // Delete token + remaining reset tokens + update password + invalidate sessions
124
+ await prisma.$transaction([
125
+ prisma.authVerification.deleteMany({
126
+ where: { type: PASSWORD_RESET_TYPE, userId: user.id },
127
+ }),
128
+ prisma.userAccount.upsert({
129
+ where: {
130
+ accountId_providerId: {
131
+ accountId: user.email,
132
+ providerId: PROVIDER_ID,
133
+ },
134
+ },
135
+ create: {
136
+ userId: user.id,
137
+ accountId: user.email,
138
+ providerId: PROVIDER_ID,
139
+ password: passwordHash,
140
+ },
141
+ update: {
142
+ password: passwordHash,
143
+ },
144
+ }),
145
+ prisma.userSession.deleteMany({
146
+ where: { userId: user.id },
147
+ }),
148
+ ]);
149
+ // Send password changed confirmation email
150
+ await sendEmail(TPL_PASSWORD_CHANGED_EMAIL, {
151
+ to: user.email,
152
+ data: {},
153
+ });
154
+ return { success: true };
155
+ }
156
+ //# sourceMappingURL=password-reset.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"password-reset.service.js","sourceRoot":"","sources":["../../../../../../../../src/local-auth/core/generators/auth-email-password/templates/module/services/password-reset.service.ts"],"names":[],"mappings":"AAAA,cAAc;AAId,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,+BAA+B,GAChC,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EACL,eAAe,EACf,+BAA+B,GAChC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,MAAM,WAAW,G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ESET_TOKEN_EXPIRY_SEC,
9
+ } from '$constantsPassword';
10
+ import {
11
+ createAuthVerification,
12
+ validateAuthVerification,
13
+ } from '%authModuleImports';
14
+ import { config } from '%configServiceImports';
15
+ import { sendEmail } from '%emailModuleImports';
16
+ import {
17
+ BadRequestError,
18
+ handleZodRequestValidationError,
19
+ } from '%errorHandlerServiceImports';
20
+ import { createPasswordHash } from '%passwordHasherServiceImports';
21
+ import { prisma } from '%prismaImports';
22
+ import { memoizeRateLimiter } from '%rateLimitImports';
23
+ import z from 'zod';
24
+
25
+ const PROVIDER_ID = 'email-password';
26
+ const PASSWORD_RESET_TYPE = 'password-reset';
27
+
28
+ /**
29
+ * Rate limiters for password reset operations.
30
+ */
31
+
32
+ // Per-email rate limit: 3 requests/hour
33
+ const getPasswordResetEmailLimiter = memoizeRateLimiter(
34
+ 'password-reset-email',
35
+ {
36
+ points: 3,
37
+ duration: 60 * 60, // 1 hour
38
+ },
39
+ );
40
+
41
+ // Per-IP rate limit: 10 requests/hour (prevents email scanning)
42
+ const getPasswordResetIpLimiter = memoizeRateLimiter('password-reset-ip', {
43
+ points: 10,
44
+ duration: 60 * 60, // 1 hour
45
+ });
46
+
47
+ // Global rate limit: 100 requests/hour (prevents overloading the email service)
48
+ const getPasswordResetGlobalLimiter = memoizeRateLimiter(
49
+ 'password-reset-global',
50
+ {
51
+ points: 100,
52
+ duration: 60 * 60, // 1 hour
53
+ },
54
+ );
55
+
56
+ const requestPasswordResetSchema = z.object({
57
+ email: z
58
+ .email()
59
+ .max(PASSWORD_MAX_LENGTH)
60
+ .transform((value) => value.toLowerCase()),
61
+ });
62
+
63
+ /**
64
+ * Request a password reset for the given email.
65
+ */
66
+ export async function requestPasswordReset({
67
+ email: rawEmail,
68
+ context,
69
+ }: {
70
+ email: string;
71
+ context: RequestServiceContext;
72
+ }): Promise<{ success: true }> {
73
+ const { email } = await requestPasswordResetSchema
74
+ .parseAsync({ email: rawEmail })
75
+ .catch(handleZodRequestValidationError);
76
+
77
+ await Promise.all([
78
+ getPasswordResetIpLimiter().consumeOrThrow(
79
+ context.reqInfo.ip,
80
+ 'Too many password reset attempts. Please try again later.',
81
+ 'too-many-requests',
82
+ ),
83
+ getPasswordResetEmailLimiter().consumeOrThrow(
84
+ email,
85
+ 'Too many password reset attempts. Please try again later.',
86
+ 'too-many-requests',
87
+ ),
88
+ getPasswordResetGlobalLimiter().consumeOrThrow(
89
+ 'global',
90
+ 'Too many password reset attempts. Please try again later.',
91
+ 'too-many-requests',
92
+ ),
93
+ ]);
94
+
95
+ // Find user by email - silently handle non-existent users to prevent enumeration
96
+ const user = await prisma.user.findUnique({
97
+ where: { email },
98
+ select: { id: true, email: true },
99
+ });
100
+
101
+ if (user?.email) {
102
+ const { token } = await createAuthVerification({
103
+ type: PASSWORD_RESET_TYPE,
104
+ userId: user.id,
105
+ expiresInSec: PASSWORD_RESET_TOKEN_EXPIRY_SEC,
106
+ });
107
+
108
+ // Construct reset URL using configured domain
109
+ const resetLink = `${config.AUTH_FRONTEND_URL}/auth/reset-password?token=${encodeURIComponent(token)}`;
110
+
111
+ // Send email asynchronously (queue-based)
112
+ await sendEmail(TPL_PASSWORD_RESET_EMAIL, {
113
+ to: user.email,
114
+ data: { resetLink },
115
+ });
116
+ }
117
+
118
+ // Always return success to prevent user enumeration
119
+ return { success: true };
120
+ }
121
+
122
+ const validateTokenSchema = z.object({
123
+ token: z.string().min(1).max(PASSWORD_MAX_LENGTH),
124
+ });
125
+
126
+ /**
127
+ * Validates a password reset token without consuming it.
128
+ * Used by the frontend to verify the token is valid before showing the reset form.
129
+ */
130
+ export async function validatePasswordResetToken({
131
+ token: rawToken,
132
+ }: {
133
+ token: string;
134
+ }): Promise<{ valid: boolean }> {
135
+ const { token } = await validateTokenSchema
136
+ .parseAsync({ token: rawToken })
137
+ .catch(handleZodRequestValidationError);
138
+
139
+ const record = await validateAuthVerification({
140
+ type: PASSWORD_RESET_TYPE,
141
+ token,
142
+ });
143
+
144
+ return { valid: record !== null };
145
+ }
146
+
147
+ const completePasswordResetSchema = z.object({
148
+ token: z.string().min(1).max(PASSWORD_MAX_LENGTH),
149
+ newPassword: z.string().min(PASSWORD_MIN_LENGTH).max(PASSWORD_MAX_LENGTH),
150
+ });
151
+
152
+ /**
153
+ * Completes the password reset process by setting a new password.
154
+ *
155
+ * Security notes (OWASP Forgot Password Cheat Sheet):
156
+ * - Token is single-use (deleted after successful reset)
157
+ * - Does not auto-login the user
158
+ * - Always invalidates all existing sessions for security
159
+ * - All remaining password-reset tokens for this user are deleted
160
+ */
161
+ export async function completePasswordReset({
162
+ token: rawToken,
163
+ newPassword: rawNewPassword,
164
+ }: {
165
+ token: string;
166
+ newPassword: string;
167
+ }): Promise<{ success: true }> {
168
+ const { token, newPassword } = await completePasswordResetSchema
169
+ .parseAsync({
170
+ token: rawToken,
171
+ newPassword: rawNewPassword,
172
+ })
173
+ .catch(handleZodRequestValidationError);
174
+
175
+ const record = await validateAuthVerification({
176
+ type: PASSWORD_RESET_TYPE,
177
+ token,
178
+ });
179
+
180
+ if (!record?.userId) {
181
+ throw new BadRequestError('Invalid or expired token', 'invalid-token');
182
+ }
183
+
184
+ const user = await prisma.user.findUniqueOrThrow({
185
+ where: { id: record.userId },
186
+ select: { id: true, email: true },
187
+ });
188
+
189
+ if (!user.email) {
190
+ throw new BadRequestError('User has no email', 'user-has-no-email');
191
+ }
192
+
193
+ const passwordHash = await createPasswordHash(newPassword);
194
+
195
+ // Delete token + remaining reset tokens + update password + invalidate sessions
196
+ await prisma.$transaction([
197
+ prisma.authVerification.deleteMany({
198
+ where: { type: PASSWORD_RESET_TYPE, userId: user.id },
199
+ }),
200
+ prisma.userAccount.upsert({
201
+ where: {
202
+ accountId_providerId: {
203
+ accountId: user.email,
204
+ providerId: PROVIDER_ID,
205
+ },
206
+ },
207
+ create: {
208
+ userId: user.id,
209
+ accountId: user.email,
210
+ providerId: PROVIDER_ID,
211
+ password: passwordHash,
212
+ },
213
+ update: {
214
+ password: passwordHash,
215
+ },
216
+ }),
217
+ prisma.userSession.deleteMany({
218
+ where: { userId: user.id },
219
+ }),
220
+ ]);
221
+
222
+ // Send password changed confirmation email
223
+ await sendEmail(TPL_PASSWORD_CHANGED_EMAIL, {
224
+ to: user.email,
225
+ data: {},
226
+ });
227
+
228
+ return { success: true };
229
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"user-password.service.d.ts","sourceRoot":"","sources":["../../../../../../../../src/local-auth/core/generators/auth-email-password/templates/module/services/user-password.service.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AA4BnE,wBAAsB,8BAA8B,CAAC,EACnD,KAAK,GACN,EAAE;IACD,KAAK,EAAE;QACL,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;CACH,GAAG,OAAO,CAAC,IAAI,CAAC,CAiChB;AAED,wBAAsB,gCAAgC,CAAC,EACrD,KAAK,EACL,OAAO,GACR,EAAE;IACD,KAAK,EAAE;QACL,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,OAAO,EAAE,qBAAqB,CAAC;CAChC,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,kBAAkB,CAAC;IAAC,IAAI,EAAE,IAAI,CAAA;CAAE,CAAC,CAKvD;AAED,wBAAsB,oCAAoC,CAAC,EACzD,KAAK,EACL,OAAO,GACR,EAAE;IACD,KAAK,EAAE;QACL,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,OAAO,EAAE,qBAAqB,CAAC;CAChC,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,kBAAkB,CAAA;CAAE,CAAC,CAkC3C;AAOD;;;;;;;;GAQG;AACH,wBAAsB,kBAAkB,CAAC,EACvC,MAAM,EACN,KAAK,GACN,EAAE;IACD,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE;QACL,eAAe,EAAE,MAAM,CAAC;QACxB,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC;CACH,GAAG,OAAO,CAAC,IAAI,CAAC,CAyChB;AAMD;;;;;;;;GAQG;AACH,wBAAsB,iBAAiB,CAAC,EACtC,MAAM,EACN,KAAK,GACN,EAAE;IACD,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE;QACL,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC;CACH,GAAG,OAAO,CAAC,IAAI,CAAC,CA2ChB"}
1
+ {"version":3,"file":"user-password.service.d.ts","sourceRoot":"","sources":["../../../../../../../../src/local-auth/core/generators/auth-email-password/templates/module/services/user-password.service.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAuDnE,wBAAsB,8BAA8B,CAAC,EACnD,KAAK,GACN,EAAE;IACD,KAAK,EAAE;QACL,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;CACH,GAAG,OAAO,CAAC,IAAI,CAAC,CAiChB;AAED,wBAAsB,gCAAgC,CAAC,EACrD,KAAK,EACL,OAAO,GACR,EAAE;IACD,KAAK,EAAE;QACL,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,OAAO,EAAE,qBAAqB,CAAC;CAChC,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,kBAAkB,CAAC;IAAC,IAAI,EAAE,IAAI,CAAA;CAAE,CAAC,CAevD;AAED,wBAAsB,oCAAoC,CAAC,E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