diff options
author | Joris | 2016-03-26 12:44:27 +0100 |
---|---|---|
committer | Joris | 2016-03-26 12:44:27 +0100 |
commit | 59c694b0e81deb30ec4e50d5d142b5eda645a27e (patch) | |
tree | 175850ddfe9ace1f50ab6ec11edff094b27da339 /src/server | |
parent | a11ad41b52ed3682d33382f2a378bf3294d688b2 (diff) |
Move no-reply mail from messages to conf
Diffstat (limited to 'src/server')
-rw-r--r-- | src/server/Conf.hs | 4 | ||||
-rw-r--r-- | src/server/Controller/SignIn.hs | 2 | ||||
-rw-r--r-- | src/server/Model/Message/Key.hs | 4 | ||||
-rw-r--r-- | src/server/Model/Message/Translations.hs | 7 | ||||
-rw-r--r-- | src/server/View/Mail/SignIn.hs | 9 |
5 files changed, 10 insertions, 16 deletions
diff --git a/src/server/Conf.hs b/src/server/Conf.hs index f66eb5e..2269cf2 100644 --- a/src/server/Conf.hs +++ b/src/server/Conf.hs @@ -13,6 +13,7 @@ data Conf = Conf , port :: Int , signInExpirationMn :: Int , currency :: Text + , noReplyMail :: Text } deriving (Read, Eq, Show) getConf :: FilePath -> IO (Either Text Conf) @@ -23,5 +24,6 @@ getConf path = Conf.lookup "hostname" conf <*> Conf.lookup "port" conf <*> Conf.lookup "signInExpirationMn" conf <*> - Conf.lookup "currency" conf + Conf.lookup "currency" conf <*> + Conf.lookup "noReplyMail" conf ) diff --git a/src/server/Controller/SignIn.hs b/src/server/Controller/SignIn.hs index b87f7a1..95cfd07 100644 --- a/src/server/Controller/SignIn.hs +++ b/src/server/Controller/SignIn.hs @@ -46,7 +46,7 @@ signIn conf login = Just user -> do token <- liftIO . runDb $ createSignInToken login let url = T.concat ["http://", hostname conf, "?signInToken=", token] - maybeSentMail <- liftIO . sendMail $ SignIn.getMail (entityVal user) url [login] + maybeSentMail <- liftIO . sendMail $ SignIn.getMail conf (entityVal user) url [login] case maybeSentMail of Right _ -> status ok200 diff --git a/src/server/Model/Message/Key.hs b/src/server/Model/Message/Key.hs index b883132..e9cbf99 100644 --- a/src/server/Model/Message/Key.hs +++ b/src/server/Model/Message/Key.hs @@ -14,10 +14,6 @@ data Key = SharedCost - -- Email - - | NoReplyMail - -- Sign | Email diff --git a/src/server/Model/Message/Translations.hs b/src/server/Model/Message/Translations.hs index d34f3d7..b7d9b4f 100644 --- a/src/server/Model/Message/Translations.hs +++ b/src/server/Model/Message/Translations.hs @@ -22,13 +22,6 @@ m l SharedCost = English -> "Shared Cost" French -> "Partage des frais" --- Email - -m l NoReplyMail = - case l of - English -> "no-reply@cost.guyonvarch.me" - French -> "pas-de-reponse@cost.guyonvarch.me" - -- Sign in m l Email = diff --git a/src/server/View/Mail/SignIn.hs b/src/server/View/Mail/SignIn.hs index dca261d..f776ddd 100644 --- a/src/server/View/Mail/SignIn.hs +++ b/src/server/View/Mail/SignIn.hs @@ -13,10 +13,13 @@ import qualified Model.Mail as M import Model.Message.Key import Model.Message -getMail :: User -> Text -> [Text] -> M.Mail -getMail user url to = +import Conf (Conf) +import qualified Conf as Conf + +getMail :: Conf -> User -> Text -> [Text] -> M.Mail +getMail conf user url to = M.Mail - { M.from = (getMessage NoReplyMail) + { M.from = Conf.noReplyMail conf , M.to = to , M.subject = (getMessage SignInMailTitle) , M.plainBody = plainBody user url |