 (ns cylon.authentication.login
   (:require
    [clojure.tools.logging :refer :all]
-   [cylon.authentication.protocols :as p :refer (AuthenticationInteraction)]
+   [cylon.authentication.protocols
+    :as p
+    :refer (AuthenticationInteraction LoginFormRenderer)]
    [cylon.password :refer (verify-password)]
    [cylon.password.protocols :refer (PasswordVerifier)]
    [cylon.session :refer (session assoc-session-data! respond-with-new-session!)]

                 (redirect-after-post
                  (str (path-for req ::login-form)
                       ;; We must be careful to add back the query string
                       (when post-login-redirect
                         (str "?post_login_redirect=" (URLEncoder/encode post-login-redirect)))))))))))})

  (routes [this]
    ["" {"/login" {:get ::login-form

                             :signup-uri (path-for req :cylon.signup.signup/GET-signup-form)
                             :reset-password (path-for req :cylon.authentication.reset-password/request-reset-password-form)
                             :post-login-redirect (get qparams "post_login_redirect")

                             :fields fields}
                      :login-failed? (Boolean/valueOf (get qparams "login_failed"))})}]
         response))

     ::process-login-attempt
