@krak-stack/auth 0.1.65 → 0.1.66
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.
|
@@ -182,7 +182,7 @@ const useAuthProjectConfig = (baseUrl, searchString, projectConfig) => {
|
|
|
182
182
|
: Schema.decodeUnknownSync(ExtraProjectPublicConfigSchema)(result.value);
|
|
183
183
|
};
|
|
184
184
|
const text = (value, params) => Object.entries(params ?? {}).reduce((current, [key, replacement]) => current.replace(`{${key}}`, replacement), value);
|
|
185
|
-
const authLinkClassName = cn(buttonVariants({ variant: "link" }), "h-auto
|
|
185
|
+
const authLinkClassName = cn(buttonVariants({ variant: "link", size: null }), "h-auto align-baseline");
|
|
186
186
|
const searchObject = (searchString) => Object.fromEntries(new URLSearchParams(searchString));
|
|
187
187
|
const authMethodSearch = (searchString, method, email) => {
|
|
188
188
|
const search = new URLSearchParams(searchString);
|
|
@@ -407,7 +407,7 @@ export function Signin(props) {
|
|
|
407
407
|
method: selectedAuthMethod,
|
|
408
408
|
otpSent: Boolean(otpSentTo),
|
|
409
409
|
});
|
|
410
|
-
}, children: [!emailSubmitted ? (_jsx(form.email, { label: m.field_email, type: "email", autoComplete: "email", onKeyDown: (event) => {
|
|
410
|
+
}, children: [!emailSubmitted ? (_jsx(form.email, { label: m.field_email, type: "email", autoFocus: true, autoComplete: "email", onKeyDown: (event) => {
|
|
411
411
|
if (event.key !== "Enter")
|
|
412
412
|
return;
|
|
413
413
|
event.preventDefault();
|
package/dist/server/proxy.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const blockedRequestHeaders = [
|
|
2
|
+
"accept-encoding",
|
|
2
3
|
"connection",
|
|
3
4
|
"content-length",
|
|
4
5
|
"forwarded",
|
|
@@ -12,6 +13,22 @@ const blockedRequestHeaders = [
|
|
|
12
13
|
"upgrade",
|
|
13
14
|
"cdn-loop",
|
|
14
15
|
];
|
|
16
|
+
const hostOnlyCookie = (cookie) => cookie.replace(/;\s*domain=[^;]*/gi, "");
|
|
17
|
+
const proxyResponse = async (response) => {
|
|
18
|
+
const headers = new Headers(response.headers);
|
|
19
|
+
const cookies = response.headers.getSetCookie();
|
|
20
|
+
if (cookies.length > 0) {
|
|
21
|
+
headers.delete("set-cookie");
|
|
22
|
+
for (const cookie of cookies) {
|
|
23
|
+
headers.append("set-cookie", hostOnlyCookie(cookie));
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return new Response(response.body, {
|
|
27
|
+
status: response.status,
|
|
28
|
+
statusText: response.statusText,
|
|
29
|
+
headers,
|
|
30
|
+
});
|
|
31
|
+
};
|
|
15
32
|
const forwardedUrl = (request) => {
|
|
16
33
|
return new URL(request.url);
|
|
17
34
|
};
|
|
@@ -29,7 +46,7 @@ const proxyHeaders = (request) => {
|
|
|
29
46
|
headers.set("x-forwarded-proto", url.protocol.replace(":", ""));
|
|
30
47
|
return headers;
|
|
31
48
|
};
|
|
32
|
-
export const proxyAuthRequest = (request, baseUrl) => {
|
|
49
|
+
export const proxyAuthRequest = async (request, baseUrl) => {
|
|
33
50
|
const target = new URL(request.url);
|
|
34
51
|
const authUrl = new URL(baseUrl);
|
|
35
52
|
const init = {
|
|
@@ -43,5 +60,8 @@ export const proxyAuthRequest = (request, baseUrl) => {
|
|
|
43
60
|
if (request.method !== "GET" && request.method !== "HEAD") {
|
|
44
61
|
init.body = request.body;
|
|
45
62
|
}
|
|
46
|
-
|
|
63
|
+
const response = await fetch(new Request(target, init), {
|
|
64
|
+
redirect: "manual",
|
|
65
|
+
});
|
|
66
|
+
return proxyResponse(response);
|
|
47
67
|
};
|