 
 (def new-login-form-schema
   {(s/optional-key :uri-context) s/Str
-   (s/optional-key :boilerplate) (s/=> 1)})
+   (s/optional-key :boilerplate) (s/=> 1)
+   (s/optional-key :middleware) (s/=> 1)})
 
 (defn new-login-form [& {:as opts}]
   (component/using

              opts)
  (fn [{{username "username" password "password" requested-uri "requested-uri"} :form-params
        routes :modular.bidi/routes}]

    ;; Check password
    (debugf "Checking username: %s" username)
    (debugf "Checking password: %s" password)
    (debugf "user-domain is %s" user-domain)

    (if (and username
             (not-empty username)

     (:value (get cookies "session")))
    {:status 302 :headers {"Location" "/"}}))

(defrecord LoginForm [uri-context boilerplate middleware]
  WebService
  (ring-handler-map [this]
    {:login (-> (new-login-get-handler :boilerplate boilerplate :middleware middleware)
                 wrap-cookies)
     :process-login (-> (apply new-login-post-handler
                                (apply concat (seq (select-keys this [:user-domain :session-store]))))
