mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-18 12:22:10 +03:00
stateful cookie set
This commit is contained in:
parent
e8d2333ec3
commit
80c6f71440
@ -1361,8 +1361,9 @@
|
|||||||
=+ yac=for-client
|
=+ yac=for-client
|
||||||
?- -.ham
|
?- -.ham
|
||||||
$js [%& %js auth:js]
|
$js [%& %js auth:js]
|
||||||
$json =^ jon ..ya stat-json.yac
|
$json =^ jon ya.yac stat-json.yac
|
||||||
[%| (give-json 200 (set-cookie -):yac jon)]
|
=^ cug ya (set-cookie -):yac
|
||||||
|
[%| (give-json 200 cug jon)]
|
||||||
$xen (show-login-page ~ ses.ham)
|
$xen (show-login-page ~ ses.ham)
|
||||||
::
|
::
|
||||||
$at
|
$at
|
||||||
@ -1377,8 +1378,9 @@
|
|||||||
[%| (resolve-bake `ses.yac dom.yac +.p.pez)]
|
[%| (resolve-bake `ses.yac dom.yac +.p.pez)]
|
||||||
::
|
::
|
||||||
$js
|
$js
|
||||||
=^ jon ..ya stat-json.yac
|
=^ jon ya.yac stat-json.yac
|
||||||
[%| (resolve (set-cookie -):yac p.pez(p (add-json jon p.p.pez)))]
|
=^ cug ya (set-cookie -):yac
|
||||||
|
[%| (resolve cug p.pez(p (add-json jon p.p.pez)))]
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
$del
|
$del
|
||||||
@ -1406,9 +1408,9 @@
|
|||||||
?~(paz.ham | =(u.paz.ham load-secret))
|
?~(paz.ham | =(u.paz.ham load-secret))
|
||||||
==
|
==
|
||||||
~|(%auth-fail !!)
|
~|(%auth-fail !!)
|
||||||
=^ jon ..ya stat-json:(logon:yac him.ham)
|
=^ jon ya.yac stat-json:(logon:yac him.ham)
|
||||||
=/ ship-cookie (set-cookie cookie-domain %ship (scot %p him.ham))
|
=^ cug ya (set-cookie -):yac
|
||||||
=/ cug [ship-cookie (set-cookie -):yac]
|
=. cug :_(cug (set-cookie cookie-domain %ship (scot %p him.ham)))
|
||||||
(give-json 200 cug jon)
|
(give-json 200 cug jon)
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
@ -1419,10 +1421,9 @@
|
|||||||
?~ ses
|
?~ ses
|
||||||
[%& %htme login-page:xml]
|
[%& %htme login-page:xml]
|
||||||
?: (~(has by wup) u.ses)
|
?: (~(has by wup) u.ses)
|
||||||
[%& %htme login-page:xml]
|
[%& %htme login-page:xml] :: XX
|
||||||
=+ yac=(new-ya u.ses)
|
=^ cug ..ya (set-cookie -):(new-ya u.ses)
|
||||||
=/ cug (set-cookie -):yac
|
[%| (give-html 401 cug login-page:xml)]
|
||||||
[%| (give-html(..ya abet.yac) 401 cug login-page:xml)]
|
|
||||||
::
|
::
|
||||||
++ need-ixor (oryx-to-ixor (need grab-oryx))
|
++ need-ixor (oryx-to-ixor (need grab-oryx))
|
||||||
++ for-view ^+(ix (ire-ix need-ixor))
|
++ for-view ^+(ix (ire-ix need-ixor))
|
||||||
@ -1439,6 +1440,7 @@
|
|||||||
(new-ya (rsh 3 1 (scot %p (end 6 1 ney))))
|
(new-ya (rsh 3 1 (scot %p (end 6 1 ney))))
|
||||||
[~ ~(. ya u.lig u.cyz)]
|
[~ ~(. ya u.lig u.cyz)]
|
||||||
::
|
::
|
||||||
|
|
||||||
++ cookie-domain
|
++ cookie-domain
|
||||||
^- cord
|
^- cord
|
||||||
?- r.hat
|
?- r.hat
|
||||||
@ -1473,9 +1475,9 @@
|
|||||||
:: (ames-gram:abet him [lon+[ses (crip (earn pul)) ~] ~])
|
:: (ames-gram:abet him [lon+[ses (crip (earn pul)) ~] ~])
|
||||||
::
|
::
|
||||||
++ set-cookie
|
++ set-cookie
|
||||||
|= domain/(unit @t) ^- (list @t)
|
|= domain/(unit @t) ^+ [*(list @t) ..ya]
|
||||||
?~ domain ~
|
?~ domain [~ ..ya]
|
||||||
[(^set-cookie u.domain cookie-prefix ses)]~
|
[[(^set-cookie u.domain cookie-prefix ses)]~ abet]
|
||||||
::
|
::
|
||||||
++ foreign-hat
|
++ foreign-hat
|
||||||
|= {pul/purl him/ship hat/hart} ^+ ..ya
|
|= {pul/purl him/ship hat/hart} ^+ ..ya
|
||||||
@ -1483,7 +1485,7 @@
|
|||||||
q.q.pul ['~' %am ses q.q.pul]
|
q.q.pul ['~' %am ses q.q.pul]
|
||||||
==
|
==
|
||||||
=+ url=(welp (earn pul(p hat)) '#' (head:earn p.pul))
|
=+ url=(welp (earn pul(p hat)) '#' (head:earn p.pul))
|
||||||
=+ cug=(set-cookie ~ %*(cookie-domain handle hat p.pul))
|
=+ cug=-:(set-cookie ~ %*(cookie-domain handle hat p.pul))
|
||||||
%- give-thou:abet
|
%- give-thou:abet
|
||||||
(add-cookies cug [307 [location+(crip url)]~ ~])
|
(add-cookies cug [307 [location+(crip url)]~ ~])
|
||||||
::
|
::
|
||||||
|
Loading…
Reference in New Issue
Block a user