Browse files

Fix issue #31, a bug in loginUser that caused it to always return suc…

…cess.
  • Loading branch information...
1 parent 2cd2f86 commit b6a11d467a50251cd84b2ad09853954707cffe57 @mightybyte mightybyte committed May 28, 2012
Showing with 2 additions and 3 deletions.
  1. +2 −3 src/Snap/Snaplet/Auth/Handlers.hs
View
5 src/Snap/Snaplet/Auth/Handlers.hs
@@ -418,9 +418,8 @@ loginUser
-> Handler b (AuthManager b) ()
-- ^ Upon success
-> Handler b (AuthManager b) ()
-loginUser unf pwdf remf loginFail loginSucc = do
+loginUser unf pwdf remf loginFail loginSucc =
runErrorT go >>= either loginFail (const loginSucc)
-
where
go = do
mbUsername <- getParam unf
@@ -434,7 +433,7 @@ loginUser unf pwdf remf loginFail loginSucc = do
password <- maybe (throwError PasswordMissing) return mbPassword
username <- maybe (fail "Username is missing") return mbUsername
- lift $ loginByUsername username (ClearText password) remember
+ ErrorT $ loginByUsername username (ClearText password) remember
------------------------------------------------------------------------------

0 comments on commit b6a11d4

Please sign in to comment.