@openinc/parse-server-opendash 3.29.4 → 3.29.6

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.
@@ -10,8 +10,9 @@ const config_1 = require("../../config");
10
10
  async function getTicketLink(ticket, user) {
11
11
  //Get hostname from tenant or environment variable or default to localhost
12
12
  let hostname = "localhost";
13
+ const tenant = (await user.fetchWithInclude("tenant", { useMasterKey: true })).get("tenant");
13
14
  try {
14
- const baseurl = user.get("tenant")?.get("baseUrl");
15
+ const baseurl = tenant?.get("baseUrl");
15
16
  const publicurl = config_1.ConfigInstance.getInstance()
16
17
  .get("PARSE_PUBLIC_SERVER_URL")
17
18
  .replace("/parse", "");
@@ -23,7 +24,7 @@ async function getTicketLink(ticket, user) {
23
24
  }
24
25
  }
25
26
  catch (error) {
26
- console.warn("[@openinc/parse-server-opendash] Could not get PARSE_PUBLIC_SERVER_URL from config, defaulting to localhost");
27
+ console.warn("[@openinc/parse-server-opendash] Could not get a hostname, defaulting to localhost");
27
28
  }
28
29
  return `${hostname}/openservice/ticket/${ticket.id}`;
29
30
  }
@@ -83,10 +83,11 @@ async function init(name) {
83
83
  let oldUser = (await new Parse.Query(Parse.User)
84
84
  .equalTo("username", verifiedPayload.oid)
85
85
  .first({ useMasterKey: true }));
86
+ console.log("Payload: ", JSON.stringify(verifiedPayload));
86
87
  if (!user && !oldUser) {
87
88
  user = new Parse.User();
88
89
  user.set("username", account.username);
89
- user.set("email", account.username);
90
+ user.set("email", account.mail ?? account.username);
90
91
  user.set("password", (0, crypto_1.randomBytes)(16).toString("hex"));
91
92
  user.set("microsoftId", verifiedPayload.oid);
92
93
  user.set("name", verifiedPayload.name || verifiedPayload.preferred_username);
@@ -99,6 +100,7 @@ async function init(name) {
99
100
  user = oldUser;
100
101
  user.set("microsoftId", verifiedPayload.oid);
101
102
  user.set("username", account.username);
103
+ user.set("email", account.mail ?? account.username);
102
104
  user = await user.save(null, { useMasterKey: true });
103
105
  }
104
106
  const sessionToken = "r:" + (0, crypto_1.randomBytes)(16).toString("hex");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openinc/parse-server-opendash",
3
- "version": "3.29.4",
3
+ "version": "3.29.6",
4
4
  "description": "Parse Server Cloud Code for open.INC Stack.",
5
5
  "packageManager": "pnpm@10.20.0",
6
6
  "keywords": [