Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #97 from kierendavies/master

retrieve password same way as username
  • Loading branch information...
commit 4d1e8d955123601f3ef99afa9359fa3583b055c6 2 parents 5ed6b54 + 6075c53
@cemerick authored
Showing with 5 additions and 1 deletion.
  1. +5 −1 src/cemerick/friend/workflows.clj
View
6 src/cemerick/friend/workflows.clj
@@ -61,6 +61,10 @@
[form-params params]
(or (get form-params "username") (:username params "")))
+(defn- password
+ [form-params params]
+ (or (get form-params "password") (:password params "")))
+
(defn interactive-login-redirect
[{:keys [form-params params] :as request}]
(ring.util.response/redirect
@@ -79,7 +83,7 @@
(when (and (= (gets :login-uri form-config (::friend/auth-config request)) (req/path-info request))
(= :post request-method))
(let [creds {:username (username form-params params)
- :password (:password params)}
+ :password (password form-params params)}
{:keys [username password]} creds]
(if-let [user-record (and username password
((gets :credential-fn form-config (::friend/auth-config request))

3 comments on commit 4d1e8d9

@pate

Consider naming the password function get-password or extract-password, because it is easily confused with the :password key in the params map. Upon closer reading, so is the username function.

@cemerick
Owner

They're both private, so I'm not so concerned. In any case, both of them will be replaced with a generic lookup fn when I touch this code next.

@pate

Cool :+1:

Please sign in to comment.
Something went wrong with that request. Please try again.