@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 +9 -3
- package/dist/index.cjs +11 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +11 -3
- package/dist/index.js.map +1 -1
- package/dist/modules/auth.cjs +11 -3
- package/dist/modules/auth.cjs.map +1 -1
- package/dist/modules/auth.d.cts +9 -2
- package/dist/modules/auth.d.ts +9 -2
- package/dist/modules/auth.js +11 -3
- package/dist/modules/auth.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -913,10 +913,17 @@ var AuthModule = class {
|
|
|
913
913
|
*
|
|
914
914
|
* @example
|
|
915
915
|
* ```typescript
|
|
916
|
+
* // Link mode (default): emails a clickable reset URL
|
|
916
917
|
* await baasix.auth.forgotPassword({
|
|
917
918
|
* email: 'user@example.com',
|
|
918
919
|
* redirectUrl: 'https://myapp.com/reset-password'
|
|
919
920
|
* });
|
|
921
|
+
*
|
|
922
|
+
* // Code mode: emails a short one-time code, no redirectUrl needed
|
|
923
|
+
* await baasix.auth.forgotPassword({
|
|
924
|
+
* email: 'user@example.com',
|
|
925
|
+
* mode: 'code'
|
|
926
|
+
* });
|
|
920
927
|
* ```
|
|
921
928
|
*/
|
|
922
929
|
async forgotPassword(options) {
|
|
@@ -924,17 +931,18 @@ var AuthModule = class {
|
|
|
924
931
|
"/auth/password/reset",
|
|
925
932
|
{
|
|
926
933
|
email: options.email,
|
|
927
|
-
link: options.redirectUrl
|
|
934
|
+
link: options.redirectUrl,
|
|
935
|
+
mode: options.mode || "link"
|
|
928
936
|
},
|
|
929
937
|
{ skipAuth: true }
|
|
930
938
|
);
|
|
931
939
|
}
|
|
932
940
|
/**
|
|
933
|
-
* Reset password using a reset token
|
|
941
|
+
* Reset password using a reset token or emailed one-time code
|
|
934
942
|
*
|
|
935
943
|
* @example
|
|
936
944
|
* ```typescript
|
|
937
|
-
* await baasix.auth.resetPassword('reset-token', 'newpassword123');
|
|
945
|
+
* await baasix.auth.resetPassword('reset-token-or-code', 'newpassword123');
|
|
938
946
|
* ```
|
|
939
947
|
*/
|
|
940
948
|
async resetPassword(token, newPassword) {
|