1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | module Domain.Auth ( login ) where import Data.Text import Data.Text.Encoding import Crypto.BCrypt (validatePassword) import Models login :: Maybe UserAuth -> Text -> Maybe Text login mUser password = case mUser of Nothing -> Nothing Just user -> if validatePassword (encodeUtf8 user.hashPass) (encodeUtf8 password) then Just user.id else Nothing |