     (common/control-group-form
       :#login.well.form-horizontal
       {:action "/signup" :method "POST"}
-      [{:type "username" :name "Username"}
-       {:type "text" :name "Name" :placeholder "Optional"}
-       {:type "text" :name "Email" :placeholder "Optional"}
-       {:type "password" :name "Password"}
-       {:type "password" :name "Repeat Password"}
+      [{:type "username" :name "Username" :required "yes"
+        :value (escape-html (get user :username))}
+       {:type "text" :name "Name" :placeholder "Optional"
+        :value (escape-html (get user :name))}
+       {:type "email" :name "Email" :placeholder "Optional"
+        :value (escape-html (get user :email))}
+       {:type "password" :name "Password" :required "yes"
+        :value (get user :password)}
+       {:type "password" :name "Repeat Password"
+        :required "yes"}
        {:type "custom" :name "Humans only"
-        :content (recaptcha/get-html errors)}]
+        :content (recaptcha/get-html
+                   (escape-html
+                     (get user :errors)))}]
       [{:eclass :.btn-primary
         :value "Sign Up"}])))
 
 (defpage signup-check [:post "/signup"] {:as user}
-  (if (model/add-user user)
+  (if (is-valid/user? user)
     (do
+      (model/add-user user)
       (flash/put! :success "Successfully Signed Up!")
       (resp/redirect (url-for root)))
     (do
-      (flash/put! :error "Sign Up Failed.")
-      (resp/redirect (url-for signup)))))
+      (flash/put! :error "Sorry, but your input has some validation errors.")
+      (render signup user))))
 
 (defpage about "/about" []
   (common/layout

  (flash/put! :success "You have been logged out.")
  (clear-identity (resp/redirect "/")))

(defpage signup "/signup" {:keys [errors]}
  (common/layout
    [:div.page-header [:h1 "Sign Up"]]
    ; Make the recaptcha theme 'clean'

  (:require [cadence.views.common :as common]
            [cadence.model :as model]
            [cadence.model.recaptcha :as recaptcha]
            [cadence.model.validators :as is-valid]
            [cadence.model.flash :as flash]
            [cemerick.friend :as friend]
            [noir.response :as resp])
