我正在尝试在我的网络应用程序上实现朋友身份验证,但是当我尝试登录时,我得到这个 */login?&login_failed=Y&username=*...我的参数是空的,我无法登录,我做错了什么?
这些是我的路线...
(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)
))
这就是我启动码头服务器的方式......
(defn -main []
(run-jetty page {:port 8080 :join? false}))
users 是这样的地图...
{"username" {:username "username" :password "password"}}
:roles 在地图中是必须的吗?也许是因为这个?