ecrs-auth-core 1.0.115 → 1.0.117
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.
|
@@ -30,7 +30,11 @@ let AuthCustomerController = class AuthCustomerController {
|
|
|
30
30
|
const additionalData = this.extractClientData(request, userAgent);
|
|
31
31
|
const host = request.get("host") || "";
|
|
32
32
|
const hostParts = host.split(".");
|
|
33
|
-
const subdomain = hostParts.length > 2
|
|
33
|
+
const subdomain = hostParts.length > 2
|
|
34
|
+
? hostParts[0]
|
|
35
|
+
: hostParts.length === 2 && hostParts[1].split(":")[0] === "localhost"
|
|
36
|
+
? hostParts[0]
|
|
37
|
+
: null;
|
|
34
38
|
console.log(`📍 Customer Emplyee login attempt from IP: ${clientIp}, User-Agent: ${userAgent}, subdomain: ${subdomain ?? "none"}`);
|
|
35
39
|
const user = await this.authCustomerService.validateUser(body.email, body.password, clientIp, subdomain ?? undefined);
|
|
36
40
|
if (!user) {
|
|
@@ -28,9 +28,13 @@ let JwtCustomerStrategy = class JwtCustomerStrategy extends (0, passport_1.Passp
|
|
|
28
28
|
if (!url)
|
|
29
29
|
return null;
|
|
30
30
|
try {
|
|
31
|
-
const hostname = new URL(url).hostname; // e.g. "acme.ecrs.com"
|
|
31
|
+
const hostname = new URL(url).hostname; // e.g. "acme.ecrs.com" or "wht.localhost"
|
|
32
32
|
const parts = hostname.split(".");
|
|
33
|
-
|
|
33
|
+
if (parts.length > 2)
|
|
34
|
+
return parts[0];
|
|
35
|
+
if (parts.length === 2 && parts[1] === "localhost")
|
|
36
|
+
return parts[0];
|
|
37
|
+
return null;
|
|
34
38
|
}
|
|
35
39
|
catch {
|
|
36
40
|
return null;
|