forked from clojars/clojars-web
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Users with wiped password see login failure and password wipe msg
Check for empty password before passing to bcrypt. Otherwise when a user logs in and has a wiped password bcrypt will die. Fixes clojars#47
- Loading branch information
Showing
3 changed files
with
40 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,10 +3,11 @@ | |
[kerodon.core :refer :all] | ||
[kerodon.test :refer :all] | ||
[clojars.test.integration.steps :refer :all] | ||
[clojars.db :as db] | ||
[clojars.web :as web] | ||
[clojars.test.test-helper :as help] | ||
[net.cgrand.enlive-html :as enlive] | ||
[net.cgrand.xml :as x])) | ||
[korma.core :as korma])) | ||
|
||
(help/use-fixtures) | ||
|
||
|
@@ -32,4 +33,17 @@ | |
(follow-redirect) | ||
(has (status? 200)) | ||
(within [:nav [:li enlive/first-child] :a] | ||
(has (text? "login")))))) | ||
(has (text? "login")))))) | ||
|
||
(deftest user-with-password-wipe-gets-message | ||
(-> (session web/clojars-app) | ||
(register-as "fixture" "[email protected]" "password" "")) | ||
(korma/update db/users | ||
(korma/set-fields {:password ""}) | ||
(korma/where {:user "fixture"})) | ||
(-> (session web/clojars-app) | ||
(login-as "fixture" "password") | ||
(follow-redirect) | ||
(has (status? 200)) | ||
(within [:article :div :p.error] | ||
(has (text? "Incorrect username and/or password."))))) |