@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 =
|
|
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
|
|
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");
|