@base44-preview/cli 0.0.50-pr.481.773d5d4 → 0.0.50-pr.481.8015345

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/cli/index.js CHANGED
@@ -253469,6 +253469,7 @@ var import_express2 = __toESM(require_express(), 1);
253469
253469
  var import_jsonwebtoken = __toESM(require_jsonwebtoken(), 1);
253470
253470
  import { randomInt } from "node:crypto";
253471
253471
  var LOCAL_DEV_SECRET = "LOCAL_DEV_SECRET";
253472
+ var TEN_MINUTES = 10 * 60 * 1000;
253472
253473
  var generateCode = () => {
253473
253474
  return randomInt(1e5, 1e6).toString();
253474
253475
  };
@@ -253568,45 +253569,7 @@ In order to complete registration use this verification code: ${otpCode}
253568
253569
  const privateUserData = await privateUserCollection?.findOneAsync({
253569
253570
  email: email3
253570
253571
  });
253571
- if (privateUserData && privateUserData.otpCode === otp_code) {
253572
- if (+Date.now() - privateUserData.createdAt < 10 * 60 * 1000) {
253573
- await privateUserCollection?.updateAsync({
253574
- email: email3
253575
- }, {
253576
- $unset: { otpCode: true }
253577
- });
253578
- const collection = db2.getCollection(USER_COLLECTION);
253579
- const now = getNowISOTimestamp();
253580
- const nameFromEmailMatch = /^([^@]+)/.exec(email3);
253581
- const fullName = nameFromEmailMatch ? nameFromEmailMatch[1] : email3;
253582
- await collection?.insertAsync({
253583
- id: privateUserData.id,
253584
- email: email3,
253585
- full_name: fullName,
253586
- is_service: false,
253587
- is_verified: true,
253588
- disabled: null,
253589
- role: "user",
253590
- collaborator_role: "editor",
253591
- created_date: now,
253592
- updated_date: now
253593
- });
253594
- res.json({
253595
- id: privateUserData.id,
253596
- access_token: createJwtToken(email3),
253597
- message: "Email verified successfully. You are now logged in.",
253598
- success: true
253599
- });
253600
- } else {
253601
- res.status(400).json({
253602
- detail: "Verification code has expired",
253603
- error_type: "HTTPException",
253604
- message: "Verification code has expired",
253605
- request_id: null,
253606
- traceback: ""
253607
- });
253608
- }
253609
- } else {
253572
+ if (!privateUserData || privateUserData.otpCode !== otp_code) {
253610
253573
  const appId = req.params.appId;
253611
253574
  res.status(500).json({
253612
253575
  detail: `{'email': '${email3}', 'app_id': '${appId}}'} -> Object not found`,
@@ -253615,6 +253578,44 @@ In order to complete registration use this verification code: ${otpCode}
253615
253578
  request_id: null,
253616
253579
  traceback: ""
253617
253580
  });
253581
+ return;
253582
+ }
253583
+ if (+Date.now() - privateUserData.createdAt > TEN_MINUTES) {
253584
+ res.status(400).json({
253585
+ detail: "Verification code has expired",
253586
+ error_type: "HTTPException",
253587
+ message: "Verification code has expired",
253588
+ request_id: null,
253589
+ traceback: ""
253590
+ });
253591
+ } else {
253592
+ await privateUserCollection?.updateAsync({
253593
+ email: email3
253594
+ }, {
253595
+ $unset: { otpCode: true }
253596
+ });
253597
+ const collection = db2.getCollection(USER_COLLECTION);
253598
+ const now = getNowISOTimestamp();
253599
+ const nameFromEmailMatch = /^([^@]+)/.exec(email3);
253600
+ const fullName = nameFromEmailMatch ? nameFromEmailMatch[1] : email3;
253601
+ await collection?.insertAsync({
253602
+ id: privateUserData.id,
253603
+ email: email3,
253604
+ full_name: fullName,
253605
+ is_service: false,
253606
+ is_verified: true,
253607
+ disabled: null,
253608
+ role: "user",
253609
+ collaborator_role: "editor",
253610
+ created_date: now,
253611
+ updated_date: now
253612
+ });
253613
+ res.json({
253614
+ id: privateUserData.id,
253615
+ access_token: createJwtToken(email3),
253616
+ message: "Email verified successfully. You are now logged in.",
253617
+ success: true
253618
+ });
253618
253619
  }
253619
253620
  });
253620
253621
  return router;
@@ -260603,4 +260604,4 @@ export {
260603
260604
  CLIExitError
260604
260605
  };
260605
260606
 
260606
- //# debugId=FF5639434B8FD38C64756E2164756E21
260607
+ //# debugId=37F6F106178A823664756E2164756E21