Permalink
Browse files

Fix issue #67

  • Loading branch information...
mightybyte committed Mar 26, 2013
1 parent d0e5f5f commit c3abdcc38011183b28aeaa77b8b8be08b900d11a
Showing with 4 additions and 3 deletions.
  1. +4 −3 src/Snap/Snaplet/Auth/Handlers.hs
@@ -59,7 +59,7 @@ usernameExists username =
------------------------------------------------------------------------------
-- | Lookup a user by her username, check given password and perform login
--
-loginByUsername :: ByteString -- ^ Username/login for user
+loginByUsername :: Text -- ^ Username/login for user
-> Password -- ^ Should be ClearText
-> Bool -- ^ Set remember token?
-> Handler b (AuthManager b) (Either AuthFailure AuthUser)
@@ -79,7 +79,7 @@ loginByUsername unm pwd shouldRemember = do
-> t
-> Handler b (AuthManager b) (Either AuthFailure AuthUser)
loginByUsername' sk cn rp r =
- liftIO (lookupByLogin r $ decodeUtf8 unm) >>=
+ liftIO (lookupByLogin r unm) >>=
maybe (return $! Left UserNotFound) found
where
@@ -450,7 +450,8 @@ loginUser' unf pwdf remf = do
password <- noteT PasswordMissing $ hoistMaybe mbPassword
username <- noteT UsernameMissing $ hoistMaybe mbUsername
- EitherT $ loginByUsername username (ClearText password) remember
+ EitherT $ loginByUsername (decodeUtf8 username)
+ (ClearText password) remember
------------------------------------------------------------------------------

0 comments on commit c3abdcc

Please sign in to comment.