Web Development with Clojure, Third Edition: bug in Restrict Posting to Authenticated Users? (page 194)

@Dmitri @svmbrown

At the end of Restrict Posting to Authenticated Users, I think there’s a bug but I’m not able to find any solution.

Consider this scenario, an user loads the page without logging in, then after staying on the same page, logging in and trying to post will leads to error "Please log in before posting". I’m able to see that it’s the direct result of websocket.clj returning {:unauthorized true} to client and it triggers the :form/set-server-errors.

Does this have anything to do with open websocket remains unauthenticated after browser successfully visits /login?