edmaxlabs-core 2.6.8 → 2.6.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -86,6 +86,7 @@ declare class Authentication {
86
86
  }) => Promise<Credentials | null>;
87
87
  deleteUser: () => Promise<void>;
88
88
  signOut: () => Promise<void>;
89
+ resetPassword: () => Promise<string>;
89
90
  rules: (path: string, context: Record<string, any>) => Promise<{
90
91
  success: boolean;
91
92
  allowed: any;
package/dist/index.d.ts CHANGED
@@ -86,6 +86,7 @@ declare class Authentication {
86
86
  }) => Promise<Credentials | null>;
87
87
  deleteUser: () => Promise<void>;
88
88
  signOut: () => Promise<void>;
89
+ resetPassword: () => Promise<string>;
89
90
  rules: (path: string, context: Record<string, any>) => Promise<{
90
91
  success: boolean;
91
92
  allowed: any;
package/dist/index.mjs CHANGED
@@ -201,6 +201,20 @@ var _Authentication = class _Authentication {
201
201
  });
202
202
  return;
203
203
  };
204
+ this.resetPassword = async () => {
205
+ const app = this.app?.getDatabase;
206
+ const luid = this.currentUser();
207
+ const payload = {
208
+ uid: luid?.uid,
209
+ ttl: 3
210
+ //minutes
211
+ };
212
+ const id = await app?.collection("_auth_tokens").add(payload);
213
+ if (id) {
214
+ return `https://auth.edmaxlabs.com/reset/${id}`;
215
+ }
216
+ throw new Error("Failed to request reset tokens. Try Again");
217
+ };
204
218
  this.rules = async (path, context) => {
205
219
  const res = await new HttpsRequest({
206
220
  method: "POST" /* POST */,