        [:div.login-content
         [:input.input-text
          {:name "email"
+          :ref "email"
+          :value (:email form "")
+          :on-change #(login-field-change local :email %)
           :placeholder "Email or Username"
           :type "text"}]
         [:input.input-text
          {:name "password"
+          :ref "password"
+          :value (:password form "")
+          :on-change #(login-field-change local :password %)
           :placeholder "Password"
           :type "password"}]
         #_[:div.input-checkbox.check-primary

(ns uxbox.ui.auth
  (:require [sablono.core :as html :refer-macros [html]]
            [lentes.core :as l]
            [rum.core :as rum]
            [uxbox.router :as r]
            [uxbox.state :as s]
            [uxbox.rstore :as rs]
            [uxbox.data.auth :as da]
            [uxbox.ui.icons :as i]
            [uxbox.ui.messages :as uum]
            [uxbox.ui.navigation :as nav]

;; Login
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defn- login-submit
  [local]
  (let [form (:form @local)]
    (rs/emit! (da/login {:username (:email form)
                         :password (:password form)}))))

(defn- login-submit-enabled?
  [local]
  (let [form (:form @local)]
    (and (not (str/empty? (:email form "")))
         (not (str/empty? (:password form ""))))))

(defn- login-field-change
  [local field event]
  (let [value (str/trim (dom/event->value event))]
    (println @local value)
    (swap! local assoc-in [:form field] value)))

(defn- login-render
  [own local]
  (let [on-submit #(login-submit local)
        submit-enabled? (login-submit-enabled? local)
        form (:form @local)]
    (println "submit-enabled?" submit-enabled?)
    (html
     [:div.login
      [:div.login-body
