mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-08-02 19:55:18 +02:00
feat: Enhance session cookie domain handling for IP addresses and single-label hostnames
This commit is contained in:
parent
7cea432353
commit
1c15e85986
4 changed files with 18 additions and 16 deletions
|
@ -58,8 +58,10 @@ export const actions: Actions = {
|
|||
|
||||
// Check if hostname is an IP address
|
||||
const isIPAddress = /^\d{1,3}(\.\d{1,3}){3}$/.test(hostname);
|
||||
const isLocalhost = hostname === 'localhost';
|
||||
const isSingleLabel = hostname.split('.').length === 1;
|
||||
|
||||
if (!isIPAddress) {
|
||||
if (!isIPAddress && !isSingleLabel && !isLocalhost) {
|
||||
const parsed = psl.parse(hostname);
|
||||
|
||||
if (parsed && parsed.domain) {
|
||||
|
|
|
@ -120,8 +120,10 @@ function handleSuccessfulLogin(event: RequestEvent<RouteParams, '/login'>, respo
|
|||
|
||||
// Check if hostname is an IP address
|
||||
const isIPAddress = /^\d{1,3}(\.\d{1,3}){3}$/.test(hostname);
|
||||
const isLocalhost = hostname === 'localhost';
|
||||
const isSingleLabel = hostname.split('.').length === 1;
|
||||
|
||||
if (!isIPAddress) {
|
||||
if (!isIPAddress && !isSingleLabel && !isLocalhost) {
|
||||
const parsed = psl.parse(hostname);
|
||||
|
||||
if (parsed && parsed.domain) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue