Web アプリにフレンド認証を実装しようとしていますが、ログインしようとすると */login?&login_failed=Y&username=*...my param is empty and I can't login.何が間違っているのでしょうか?
これらは私のルートです...
(defroutes routes
(GET "/" [] (index))
(GET "/indexMessage" [] (indexMessage))
(GET "/login" req (index))
(POST "/insert-user" {params :params}
(let [firstname (get params "firstname")
lastname (get params "lastname")
email (get params "email")
password (get params "password")
sex (get params "sex")
year (get params "year")
month (get params "month")
day (get params "day")]
(def date (str year"-"month"-"day))
(insert-user firstname lastname email password sex date)))
(route/resources "/public")
(route/not-found "Page not found")
)
必要なすべてのミドルウェアを使用しました...
(def page (handler/site
(friend/authenticate
routes
{:allow-anon? true
:login-uri "/login"
:default-landing-uri "/"
:unauthorized-handler #(-> (html5 [:h2 "You do not have sufficient privileges to access " (:uri %)])
resp/response
(resp/status 401))
:credential-fn #(creds/bcrypt-credential-fn @users %)
:workflows [(workflows/interactive-form)]})
(wrap-keyword-params routes)
(wrap-nested-params routes)
(wrap-params routes)
(wrap-session routes)
))
そして、これが私のjettyサーバーの起動方法です...
(defn -main []
(run-jetty page {:port 8080 :join? false}))
ユーザーはこのようなマップです...
{"username" {:username "username" :password "password"}}
:roles はマップで必須ですか?それが原因でしょうか?