|
|
@ -1,10 +1,10 @@
|
|
|
|
(ns wanijo.auth.routes
|
|
|
|
(ns wanijo.auth
|
|
|
|
(:require [compojure.core :refer [POST GET defroutes]]
|
|
|
|
(:require [compojure.core :refer [POST GET defroutes]]
|
|
|
|
[ring.util.response :refer [redirect]]
|
|
|
|
[ring.util.response :refer [redirect]]
|
|
|
|
[ring.util.anti-forgery :refer [anti-forgery-field]]
|
|
|
|
[ring.util.anti-forgery :refer [anti-forgery-field]]
|
|
|
|
[buddy.hashers :as hashers]
|
|
|
|
[buddy.hashers :as hashers]
|
|
|
|
[hiccup.form :as hform]
|
|
|
|
[hiccup.form :as hform]
|
|
|
|
[wanijo.view :as view]
|
|
|
|
[wanijo.view.page :as page]
|
|
|
|
[wanijo.domain.user :as domain-user]))
|
|
|
|
[wanijo.domain.user :as domain-user]))
|
|
|
|
|
|
|
|
|
|
|
|
(defn- login-check! [req]
|
|
|
|
(defn- login-check! [req]
|
|
|
@ -14,12 +14,13 @@
|
|
|
|
(hashers/check pw hash))]
|
|
|
|
(hashers/check pw hash))]
|
|
|
|
(if pwmatch
|
|
|
|
(if pwmatch
|
|
|
|
(-> (redirect "/")
|
|
|
|
(-> (redirect "/")
|
|
|
|
(assoc-in [:session :ident] uname))
|
|
|
|
(assoc-in [:session :ident] uname)
|
|
|
|
|
|
|
|
(assoc-in [:session :uuid] (:uuid unode)))
|
|
|
|
(-> (redirect "/login")
|
|
|
|
(-> (redirect "/login")
|
|
|
|
(assoc :flash :invalid-credentials)))))
|
|
|
|
(assoc :flash :invalid-credentials)))))
|
|
|
|
|
|
|
|
|
|
|
|
(defn login [req]
|
|
|
|
(defn login [req]
|
|
|
|
(view/layout!
|
|
|
|
(page/layout!
|
|
|
|
:content
|
|
|
|
:content
|
|
|
|
[[:h1 "Kama ken"]
|
|
|
|
[[:h1 "Kama ken"]
|
|
|
|
(hform/form-to
|
|
|
|
(hform/form-to
|