Skip to content

Commit

Permalink
Merge pull request #279 from onaio/handle-4xx-on-password-reset
Browse files Browse the repository at this point in the history
Suppress 4xx exceptions when resetting password
  • Loading branch information
Davis Raymond authored Mar 31, 2020
2 parents a5a8e38 + 2bbe0b9 commit 5c96dfb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
:milia-http-default-per-route "10"
:milia-http-threads "20"})

(defproject onaio/milia "0.3.53"
(defproject onaio/milia "0.3.54"
:description "The ona.io Clojure Web API Client."
:dependencies [;; CORE MILIA REQUIREMENTS
[cheshire "5.6.3"]
Expand Down
3 changes: 2 additions & 1 deletion src/milia/api/user.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,10 @@
(parse-http :post url :http-options {:form-params form-params}))))

(defn reset-password
[new-password token uid]
[new-password token uid & {:keys [suppress-4xx-exceptions?]}]
(let [url (make-url "user" "reset.json")]
(parse-http :post url
:suppress-4xx-exceptions? suppress-4xx-exceptions?
:http-options {:form-params {:new_password new-password
:token token
:uid uid}})))
Expand Down
11 changes: 8 additions & 3 deletions test/clj/milia/api/user_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,15 @@
token "aT0k3n"
uid "MtJs"
params {:new_password new-password :token token :uid uid}]
(reset-password new-password token uid) => nil
(reset-password new-password
token
uid
:suppress-4xx-exceptions? true) => nil
(provided
(make-url "user" "reset.json") => :url
(parse-http :post :url :http-options {:form-params params}) => nil)))
(parse-http :post :url
:suppress-4xx-exceptions? true
:http-options {:form-params params}) => nil)))

(fact "patch should submit a patch request"
(patch username :params) => :response
Expand Down Expand Up @@ -281,4 +286,4 @@
(parse-http
:patch :url
:http-options {:form-params {:contactpersons contactpersons}}
:suppress-4xx-exceptions? true) => :contactpersons))))
:suppress-4xx-exceptions? true) => :contactpersons))))

0 comments on commit 5c96dfb

Please sign in to comment.