aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Types/Session.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Types/Session.hs')
-rw-r--r--src/Types/Session.hs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/Types/Session.hs b/src/Types/Session.hs
index a4dba93..5d037a4 100644
--- a/src/Types/Session.hs
+++ b/src/Types/Session.hs
@@ -41,6 +41,18 @@ makeClockCookie now session =
, cookiePath = Nothing
, cookieSecure = False}
+makeSsCookie :: ClockTime -> Session -> Cookie
+makeSsCookie now session =
+ Cookie { cookieName = "ss_cookie"
+ , cookieValue =
+ case currentClass session of
+ Nothing -> "0"
+ Just c -> show $ numberOfSs c
+ , cookieExpires = Just $ endOfSchoolDay now
+ , cookieDomain = Nothing
+ , cookiePath = Nothing
+ , cookieSecure = False}
+
endOfSchoolDay :: ClockTime -> CalendarTime
endOfSchoolDay now = (toUTCTime . addToClockTime noTimeDiff { tdHour = hoursTilEndOfDay }) now
where