[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Artanis] Using Session and Cookies in the Same Call
From: |
Jonathan Schmeling |
Subject: |
[Artanis] Using Session and Cookies in the Same Call |
Date: |
Sun, 5 May 2019 18:49:21 +0000 |
It's always plausible that this isn't something that was designed,
intentionally, but is it feasible to spawn sessions in the same call as
you set! a cookie?
I was trying out a call like
--------------------CODE--------------------
(post "/auth/sign_in" #:auth `(table PEOPLE "USERNAME" "PASSWORD"
"SALT" ,SALTER)
#:cookies '(names sess)
#:session #t
#:from-post 'qstr-safe
(lambda (rc)
(cond
[(:session rc 'check) (redirect-to rc "/")]
[(:auth rc) (:session rc 'spawn)
(:cookies-set!
rc
'sess
"account"
(uri-decode (:from-post rc 'get "USERNAME")))
(redirect-to rc "/")]
[else "Go to fail page."])))
--------------------CODE--------------------
but when that code is run, the session seems to get stored as a cookie
in the browser and, at the very least, definitely does not get
recognized as an active session (the page the above redirects to is
suppose to redirect back to the sign_in page if (:session rc 'check) is
false and it always does with the above code but doesn't when I remove
the cookies parts from the above so it's just the session that's being
spawned).
Unrelated, I also discovered that .html.tpl files seem to not get
rendered when with \" or \' get used in JavaScript. I tried seeing if it
was just escaping, in general, that caused the issue but any other use
of the backslash seemed fine – it only seemed to be when either
quotation was escaped in JavaScript that Artanis suddenly couldn't
render the view.
Thanks!
Jonathan
- [Artanis] Using Session and Cookies in the Same Call,
Jonathan Schmeling <=