imalooney / t3tr0s

30th anniversary tetris in ClojureScript
t3tr0s.com
Other
468 stars 28 forks source link

Need to html-escape player names #42

Open oakmac opened 7 years ago

oakmac commented 7 years ago

cc @colonelrascals

oakmac commented 7 years ago

I did this quick hack locally on client/pages/login.cljs

(defn- valid-username? [name]
  (and (string? name)
       (not (str/blank? name))
       (= -1 (.indexOf name "<"))))

(defn- on-form-submit [js-evt]
  (.preventDefault js-evt)
  (let [username (dom/get-value "nameInput")]
    (when (valid-username? username)
      (reset! client.state/username username)
      (send-login! username)
      (aset js/location "hash" "#/lobby"))))