Browse Source

bugfix: session invalidation enabled again

master
Christian Mueller 12 years ago
parent
commit
f94fccb4bc
  1. 3
      resources/public/style.less
  2. 8
      src/NoteHub/storage.clj
  3. 11
      src/NoteHub/views/pages.clj

3
resources/public/style.less

@ -101,9 +101,6 @@ html, body { @@ -101,9 +101,6 @@ html, body {
margin: 0;
padding: 0;
}
#stats tr > td:first-child {
text-align: right;
}
#hero {
padding-top: 5em;
padding-bottom: 5em;

8
src/NoteHub/storage.clj

@ -47,11 +47,9 @@ @@ -47,11 +47,9 @@
token)))
(defn invalidate-session [token]
; Jedis is buggy & returns an NPE for token == nil
(when token
(let [was-valid (redis/sismember db sessions token)]
(do (redis/srem db sessions token)
was-valid))))
(let [was-valid (redis/sismember db sessions token)]
(redis/srem db sessions token)
was-valid))
(defn edit-note
[noteID text]

11
src/NoteHub/views/pages.clj

@ -157,7 +157,9 @@ @@ -157,7 +157,9 @@
psk (storage/get-psk pid)]
(if (storage/valid-publisher? pid)
(let [resp (api/post-note note pid (api/get-signature (str pid psk note)) password)]
(if (get-in resp [:status :success])
(if (and
(storage/invalidate-session session)
(get-in resp [:status :success]))
(redirect (:longURL resp))
(response 400)))
(response 500)))
@ -179,8 +181,8 @@ @@ -179,8 +181,8 @@
; Here lives the API
(defpage "/api" args
(let [title (get-message :api-title)]
(layout title [:article.markdown (slurp "API.md")])))
(layout (get-message :api-title)
[:article.markdown (slurp "API.md")]))
(defpage [:get "/api/note"] {:keys [version noteID]}
(generate-string (api/get-note noteID)))
@ -189,5 +191,4 @@ @@ -189,5 +191,4 @@
(generate-string (api/post-note note pid signature password)))
(defpage [:put "/api/note"] {:keys [version noteID note pid signature password]}
(generate-string (api/update-note noteID note pid signature password)))
(generate-string (api/update-note noteID note pid signature password)))
Loading…
Cancel
Save