Skip to content

Commit

Permalink
Fix issue #31, a bug in loginUser that caused it to always return suc…
Browse files Browse the repository at this point in the history
…cess.
  • Loading branch information
mightybyte committed May 29, 2012
1 parent 2cd2f86 commit b6a11d4
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/Snap/Snaplet/Auth/Handlers.hs
Expand Up @@ -418,9 +418,8 @@ loginUser
-> Handler b (AuthManager b) () -> Handler b (AuthManager b) ()
-- ^ Upon success -- ^ Upon success
-> Handler b (AuthManager b) () -> Handler b (AuthManager b) ()
loginUser unf pwdf remf loginFail loginSucc = do loginUser unf pwdf remf loginFail loginSucc =
runErrorT go >>= either loginFail (const loginSucc) runErrorT go >>= either loginFail (const loginSucc)

where where
go = do go = do
mbUsername <- getParam unf mbUsername <- getParam unf
Expand All @@ -434,7 +433,7 @@ loginUser unf pwdf remf loginFail loginSucc = do


password <- maybe (throwError PasswordMissing) return mbPassword password <- maybe (throwError PasswordMissing) return mbPassword
username <- maybe (fail "Username is missing") return mbUsername username <- maybe (fail "Username is missing") return mbUsername
lift $ loginByUsername username (ClearText password) remember ErrorT $ loginByUsername username (ClearText password) remember




------------------------------------------------------------------------------ ------------------------------------------------------------------------------
Expand Down

0 comments on commit b6a11d4

Please sign in to comment.