        :url "/boards"
        :chan ch})))
 
-(defn input [owner id placeholder & type]
-  (dom/input #js {:type (or (first type) "text")
+(defn input [id placeholder on-change & [type]]
+  (dom/input #js {:type (or type "text")
                   :id (name id)
-                  :onChange (fn [e]
-                              (om/set-state! owner id
-                                             (.. e -target -value)))
+                  :onChange on-change
                   :placeholder placeholder}))
+
+(defn handle-change [owner id]
+  (fn [e]
+    (let [new-value (.. e -target -value)]
+      (om/set-state! owner id new-value))))
 
 (defn login-view [app owner {:keys [on-login]}]
   (reify

      (dom/div #js {:id "login-signup"}
               (dom/form #js {:id "login"
                              :style (display (= screen :login))}
                         (input owner :email "Your username or email")
                         (input owner :password "Your password" "password")
                         (dom/button
                          #js {:onClick (fn [e]
                                          (.preventDefault e)

                                "or sign up"))
               (dom/form #js {:id "signup"
                              :style (display (= screen :signup))}
                         (input :username "Choose a username"
                                (handle-change owner :username))
                         (input :email "Your email"
                                (handle-change owner :email))
                         (input :password "Choose a password"
                                (handle-change owner :password)
                                "password")
                         (dom/button
                          #js {:onClick (fn [e]
                                          (.preventDefault e)
