diff --git a/src/babillard_page.eml.html b/src/babillard_page.eml.html index 7baa444..0fff090 100644 --- a/src/babillard_page.eml.html +++ b/src/babillard_page.eml.html @@ -1,9 +1,8 @@ let f request = -% let redirect = Dream.to_percent_encoded "/new_thread" in % let new_thread_url = % if Option.is_none @@ Dream.session "nick" request then -% Format.sprintf "/login?redirect=%s" redirect +% Format.sprintf "/login?redirect=%s" (Dream.to_percent_encoded "/new_thread") % else "/new_thread" % in diff --git a/src/login.eml.html b/src/login.eml.html index 56d7754..11b8207 100644 --- a/src/login.eml.html +++ b/src/login.eml.html @@ -1,5 +1,12 @@ let f request = -<%s! Dream.form_tag ~action:"/login" request %> + +% let url = +% match Dream.query request "redirect" with +% | None -> "/login" +% | Some r -> +% Format.sprintf "/login?redirect=%s" r +% in +<%s! Dream.form_tag ~action:url request %>
diff --git a/src/newthread_page.eml.html b/src/newthread_page.eml.html index 0b3f55e..658b954 100644 --- a/src/newthread_page.eml.html +++ b/src/newthread_page.eml.html @@ -2,8 +2,7 @@ let f request = % begin match Dream.session "nick" request with % | None -> % let redirect = Dream.to_percent_encoded "/new_thread" in -% Format.printf "%s@." redirect; -Login to make a new thread. + Login to make a new thread. % | Some _nick ->

New thread

diff --git a/src/permap.ml b/src/permap.ml index 93fc019..e235223 100644 --- a/src/permap.ml +++ b/src/permap.ml @@ -54,7 +54,7 @@ let login_post request = | Ok () -> let url = match Dream.query request "redirect" with - | None -> "/jpp" + | None -> "/" | Some redirect -> Dream.from_percent_encoded redirect in Dream.respond ~status:`See_Other diff --git a/src/thread_page.eml.html b/src/thread_page.eml.html index de145ef..1c4a4dd 100644 --- a/src/thread_page.eml.html +++ b/src/thread_page.eml.html @@ -3,8 +3,8 @@ let f thread_view thread_id request = <%s! thread_view %> % begin match Dream.session "nick" request with % | None -> -% let redirect = Dream.to_percent_encoded (Format.sprintf "redirect=/thread/%s" thread_id) in -Login to reply! +% let redirect = Dream.to_percent_encoded (Format.sprintf "/thread/%s" thread_id) in +Login to reply! % | Some _ ->
<%s! Dream.form_tag ~action:( Format.sprintf "/thread/%s" thread_id)