aboutsummaryrefslogtreecommitdiff
path: root/src/server/View/Mail/SignIn.hs
blob: f776ddda6bdd1c9ff58d175452661978057c2c3d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
{-# LANGUAGE OverloadedStrings #-}

module View.Mail.SignIn
  ( getMail
  ) where

import Data.Text (Text)
import qualified Data.Text.Lazy as LT
import Data.Text.Lazy.Builder (toLazyText, fromText)

import Model.Database (User(..))
import qualified Model.Mail as M
import Model.Message.Key
import Model.Message

import Conf (Conf)
import qualified Conf as Conf

getMail :: Conf -> User -> Text -> [Text] -> M.Mail
getMail conf user url to =
  M.Mail
    { M.from = Conf.noReplyMail conf
    , M.to = to
    , M.subject = (getMessage SignInMailTitle)
    , M.plainBody = plainBody user url
    }

plainBody :: User -> Text -> LT.Text
plainBody user url = strictToLazy (getParamMessage [userName user, url] SignInMail)

strictToLazy :: Text -> LT.Text
strictToLazy = toLazyText . fromText