Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/API.hs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import qualified Data.ByteString.Char8 as B8
( pack
, unpack
)
import Data.Char (toLower)
import Data.Int ( Int64 )
import Data.NewUser
import Data.Proxy ( Proxy(..) )
Expand Down Expand Up @@ -243,7 +244,7 @@ loginHandler
)

loginHandler cookieSettings jwtSettings connString (Login email password) = do
mUser <- liftIO $ fetchUserByEmailPG connString email
mUser <- liftIO $ fetchUserByEmailPG connString (toLower <$> email)
case mUser of
Nothing -> throwError err401
Just user -> do
Expand Down
3 changes: 2 additions & 1 deletion src/Database.hs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import Data.Int ( Int64 )
import qualified Data.ByteString as BS
( ByteString )
import qualified Data.ByteString.Char8 as B8
import Data.Char (toLower)

import Data.NewUser
import Data.Pool ( Pool )
Expand Down Expand Up @@ -96,7 +97,7 @@ hashUser (NewUser name email pw) = do
return
$ (\hashedPW -> User
{ userName = name
, userEmail = email
, userEmail = toLower <$> email
, userHashedPassword = hashedPW
}
)
Expand Down
12 changes: 12 additions & 0 deletions stack.yaml.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# This file was autogenerated by Stack.
# You should not edit this file by hand.
# For more information, please see the documentation at:
# https://docs.haskellstack.org/en/stable/lock_files

packages: []
snapshots:
- completed:
size: 503674
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/12/10.yaml
sha256: 3f6a3139a4fe86c154496156ba9bc45328debae508485f0e314609eb9cc7e467
original: lts-12.10