Skip to content

Commit 4024a10

Browse files
committed
Merge branch 'bugfix/#111' into develop
2 parents 9bbbfa4 + bf894d2 commit 4024a10

File tree

2 files changed

+27
-5
lines changed

2 files changed

+27
-5
lines changed

src/Simplify.Web/Modules/LanguageManager.cs

+6-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,12 @@ public void SetCookieLanguage(string language)
5050
if (string.IsNullOrEmpty(language))
5151
throw new ArgumentNullException(nameof(language));
5252

53-
_responseCookies.Append(CookieLanguageFieldName, language, new CookieOptions { Expires = DateTime.Now.AddYears(5) });
53+
_responseCookies.Append(CookieLanguageFieldName, language, new CookieOptions
54+
{
55+
Expires = DateTime.Now.AddYears(5),
56+
SameSite = SameSiteMode.None,
57+
Secure = true
58+
});
5459
}
5560

5661
/// <summary>

src/Simplify.Web/Modules/Redirector.cs

+21-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#nullable disable
22

33
using System;
4+
using Microsoft.AspNetCore.Http;
45
using Microsoft.AspNetCore.Http.Extensions;
56

67
namespace Simplify.Web.Modules
@@ -50,7 +51,11 @@ public Redirector(IWebContext context)
5051
public string PreviousPageUrl
5152
{
5253
get => _context.Request.Cookies[PreviousPageUrlCookieFieldName];
53-
set => _context.Response.Cookies.Append(PreviousPageUrlCookieFieldName, value);
54+
set => _context.Response.Cookies.Append(PreviousPageUrlCookieFieldName, value, new CookieOptions
55+
{
56+
SameSite = SameSiteMode.None,
57+
Secure = true
58+
});
5459
}
5560

5661
/// <summary>
@@ -62,7 +67,11 @@ public string PreviousPageUrl
6267
public string RedirectUrl
6368
{
6469
get => _context.Request.Cookies[RedirectUrlCookieFieldName];
65-
set => _context.Response.Cookies.Append(RedirectUrlCookieFieldName, value);
70+
set => _context.Response.Cookies.Append(RedirectUrlCookieFieldName, value, new CookieOptions
71+
{
72+
SameSite = SameSiteMode.None,
73+
Secure = true
74+
});
6675
}
6776

6877
/// <summary>
@@ -74,7 +83,11 @@ public string RedirectUrl
7483
public string LoginReturnUrl
7584
{
7685
get => _context.Request.Cookies[LoginReturnUrlCookieFieldName];
77-
set => _context.Response.Cookies.Append(LoginReturnUrlCookieFieldName, value);
86+
set => _context.Response.Cookies.Append(LoginReturnUrlCookieFieldName, value, new CookieOptions
87+
{
88+
SameSite = SameSiteMode.None,
89+
Secure = true
90+
});
7891
}
7992

8093
/// <summary>
@@ -86,7 +99,11 @@ public string LoginReturnUrl
8699
public string PreviousNavigatedUrl
87100
{
88101
get => _context.Request.Cookies[PreviousNavigatedUrlCookieFieldName];
89-
set => _context.Response.Cookies.Append(PreviousNavigatedUrlCookieFieldName, value);
102+
set => _context.Response.Cookies.Append(PreviousNavigatedUrlCookieFieldName, value, new CookieOptions
103+
{
104+
SameSite = SameSiteMode.None,
105+
Secure = true
106+
});
90107
}
91108

92109
/// <summary>

0 commit comments

Comments
 (0)