about summary refs log tree commit diff
path: root/web
diff options
context:
space:
mode:
authorGriffin Smith <grfn@gws.fyi>2020-07-28T22·38-0400
committerglittershark <grfn@gws.fyi>2020-07-31T02·05+0000
commitf46aa2a20c9e1e3c3b89748af0ce8c950e13c14f (patch)
tree4964eaf7cd6f337a12d2d74351498a0cfb0c0b18 /web
parentaddcba11b05500ba28ade309de6bd53f8153a6c4 (diff)
feat(web/panettone): Redirect to original URL after login r/1507
Add an original-uri query param to the target of the Log In link
pointing at the current URL, so that when the user eventually
successfully logs in they are redirected to the page they were
originally on

Fixes: #21
Change-Id: I75ed7b75fa00b1b09c8b26bf4dcf5bc6b6d7f53a
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1498
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
Diffstat (limited to 'web')
-rw-r--r--web/panettone/src/panettone.lisp7
1 files changed, 6 insertions, 1 deletions
diff --git a/web/panettone/src/panettone.lisp b/web/panettone/src/panettone.lisp
index b85a2e91cc..3d1bf41b4a 100644
--- a/web/panettone/src/panettone.lisp
+++ b/web/panettone/src/panettone.lisp
@@ -105,7 +105,12 @@ successful, `nil' otherwise"
                   :action "/logout"
                   (:input :type "submit" :value "Log Out")))
           (who:htm
-           (:a :href "/login" "Log In")))))))
+           (:a :href
+               (format nil
+                       "/login?original-uri=~A"
+                       (drakma:url-encode (hunchentoot:request-uri*)
+                                          :utf-8))
+               "Log In")))))))
 
 (defmacro render ((&key (footer t)) &body body)
   `(who:with-html-output-to-string (*standard-output* nil :prologue t)