@baasix/sdk 0.1.21 → 0.1.22

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/README.md CHANGED
@@ -204,14 +204,20 @@ const { user, token } = await baasix.auth.verifyMagicLink('verification-token');
204
204
  ### Password Reset
205
205
 
206
206
  ```typescript
207
- // Request reset
207
+ // Request reset (link mode: emails a clickable reset URL)
208
208
  await baasix.auth.forgotPassword({
209
209
  email: 'user@example.com',
210
210
  redirectUrl: 'https://myapp.com/reset-password',
211
211
  });
212
212
 
213
- // Reset password
214
- await baasix.auth.resetPassword('reset-token', 'newpassword123');
213
+ // Request reset (code mode: emails a short one-time code, no redirectUrl needed)
214
+ await baasix.auth.forgotPassword({
215
+ email: 'user@example.com',
216
+ mode: 'code',
217
+ });
218
+
219
+ // Reset password with the token or emailed code
220
+ await baasix.auth.resetPassword('reset-token-or-code', 'newpassword123');
215
221
  ```
216
222
 
217
223
  ### Change Password
package/dist/index.cjs CHANGED
@@ -915,10 +915,17 @@ var AuthModule = class {
915
915
  *
916
916
  * @example
917
917
  * ```typescript
918
+ * // Link mode (default): emails a clickable reset URL
918
919
  * await baasix.auth.forgotPassword({
919
920
  * email: 'user@example.com',
920
921
  * redirectUrl: 'https://myapp.com/reset-password'
921
922
  * });
923
+ *
924
+ * // Code mode: emails a short one-time code, no redirectUrl needed
925
+ * await baasix.auth.forgotPassword({
926
+ * email: 'user@example.com',
927
+ * mode: 'code'
928
+ * });
922
929
  * ```
923
930
  */
924
931
  async forgotPassword(options) {
@@ -926,17 +933,18 @@ var AuthModule = class {
926
933
  "/auth/password/reset",
927
934
  {
928
935
  email: options.email,
929
- link: options.redirectUrl
936
+ link: options.redirectUrl,
937
+ mode: options.mode || "link"
930
938
  },
931
939
  { skipAuth: true }
932
940
  );
933
941
  }
934
942
  /**
935
- * Reset password using a reset token
943
+ * Reset password using a reset token or emailed one-time code
936
944
  *
937
945
  * @example
938
946
  * ```typescript
939
- * await baasix.auth.resetPassword('reset-token', 'newpassword123');
947
+ * await baasix.auth.resetPassword('reset-token-or-code', 'newpassword123');
940
948
  * ```
941
949
  */
942
950
  async resetPassword(token, newPassword) {