Skip to content

Commit

Permalink
Removed the error throwing from loginByUsername
Browse files Browse the repository at this point in the history
  • Loading branch information
adinapoli committed Sep 30, 2012
1 parent 9f2bf9f commit cd41db5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/Snap/Snaplet/Auth/Handlers.hs
Expand Up @@ -66,8 +66,7 @@ loginByUsername :: ByteString -- ^ Username/login for user
-> Password -- ^ Should be ClearText
-> Bool -- ^ Set remember token?
-> Handler b (AuthManager b) (Either AuthFailure AuthUser)
loginByUsername _ (Encrypted _) _ =
error "Cannot login with encrypted password"
loginByUsername _ (Encrypted _) _ = return $ Left EncryptedPassword
loginByUsername unm pwd shouldRemember = do
sk <- gets siteKey
cn <- gets rememberCookieName
Expand Down
2 changes: 2 additions & 0 deletions src/Snap/Snaplet/Auth/Types.hs
Expand Up @@ -81,6 +81,7 @@ data AuthFailure = AuthError String
| BackendError
| DuplicateLogin
| EmptyUsername
| EncryptedPassword
| IncorrectPassword
| LockedOut UTCTime -- ^ Locked out until given time
| PasswordMissing
Expand All @@ -93,6 +94,7 @@ instance Show AuthFailure where
show (BackendError) = "Failed to store data in the backend."
show (DuplicateLogin) = "This login already exists in the backend."
show (EmptyUsername) = "Username cannot be empty."
show (EncryptedPassword) = "Cannot login with encrypted password."
show (IncorrectPassword) = "The password provided was not valid."
show (LockedOut time) = "The login is locked out until " ++ show time
show (PasswordMissing) = "No password provided."
Expand Down

0 comments on commit cd41db5

Please sign in to comment.