1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
using System.Collections.Generic;
using System.Globalization;
using VSH.Data.Enums;
using VSH.Data.Miscellaneous;
using VSH.Data.Static;
namespace VSH.Services;
public class CookieService
{
private static Dictionary<string, string> XsrfCookieDescriptions => new() {
{
"en",
"This cookie is only required for submitting forms like the order submit form. The cookie is used to prevent abuse, nothing personal is saved or shared with this cookie."
}, {
"nb",
"Denne informasjonskapselen er bare påkrevd for å sende skjema som for eksempel bestillingsskjema. Informasjonskapselen blir brukt for å forhindre misbruk, ingen persondata blir lagret eller delt med denne informasjonskapselen."
},
};
private static Dictionary<string, string> SessionCookieDescriptions => new() {
{
"en",
"This cookie is only required for keeping you logged in while using this site. The cookie is purely functional and nothing personal is saved or shared with this cookie."
}, {
"nb",
"Denne informasjonskapselen er bare påkrevd for å holde deg logget på imens du bruker denne siden. Informasjonskapselen er bare funksjonell og ingen persondata blir lagret eller delt med denne informasjonskapselen."
},
};
private static Dictionary<string, string> CultureCookieDescriptions => new() {
{
"en", "This cookie is used to keep track of your preffered language, nothing personal is saved or shared with this cookie."
}, {
"nb",
"Denne informasjonskapselen bruker vi for å lagre hvilket språk du vil se siden på, ingen persondata blir lagret eller delt med denne informasjonskapselen."
},
};
public static AppCookie GetCookie(CookieType type) {
var isoCode = CultureInfo.DefaultThreadCurrentCulture?.TwoLetterISOLanguageName ?? Startup.DefaultCulture.TwoLetterISOLanguageName;
return type switch {
CookieType.XSRF => AppCookies.Xsrf with {
Description = XsrfCookieDescriptions[isoCode]
},
CookieType.SESSION => AppCookies.Session with {
Description = SessionCookieDescriptions[isoCode]
},
CookieType.CULTURE => AppCookies.Culture with {
Description = CultureCookieDescriptions[isoCode]
},
_ => default
};
}
}
|