Commit 71b8eeb2 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[FEAT] Giving the instance Name to the user

parent 11db8126
## Version 0.0.6.7.1 ## Version 0.0.6.7.1
* [BACK][OPTIM][Ngrams Table, queries optimization (#144)](https://gitlab.iscpif.fr/gargantext/haskell-gargantext/issues/144) * [BACK][OPTIM][Ngrams Table, queries optimization (#144)](https://gitlab.iscpif.fr/gargantext/haskell-gargantext/issues/144)
* [BACK][CONFIG] gargantext.ini needs new field
BACKEND_NAME = THE INSTANCE NAME
## Version 0.0.6.7 ## Version 0.0.6.7
* [GRAPH][FIX] Nodes with one edge only are removed now * [GRAPH][FIX] Nodes with one edge only are removed now
......
...@@ -5,7 +5,7 @@ cabal-version: 1.12 ...@@ -5,7 +5,7 @@ cabal-version: 1.12
-- see: https://github.com/sol/hpack -- see: https://github.com/sol/hpack
name: gargantext name: gargantext
version: 0.0.6.7.1 version: 0.0.6.7.1
synopsis: Search, map, share synopsis: Search, map, share
description: Please see README.md description: Please see README.md
category: Data category: Data
......
...@@ -17,7 +17,7 @@ import Data.Text (Text, unlines, splitOn) ...@@ -17,7 +17,7 @@ import Data.Text (Text, unlines, splitOn)
import Gargantext.Core.Types.Individu import Gargantext.Core.Types.Individu
import Gargantext.Database.Schema.User (UserLight(..)) import Gargantext.Database.Schema.User (UserLight(..))
import Gargantext.Prelude import Gargantext.Prelude
import Gargantext.Prelude.Config (gc_url) import Gargantext.Prelude.Config (gc_url, gc_backend_name)
import Gargantext.Database.Prelude import Gargantext.Database.Prelude
-- import Gargantext.Prelude.Config (gc_url) -- import Gargantext.Prelude.Config (gc_url)
import Gargantext.Prelude.Mail (gargMail, GargMail(..)) import Gargantext.Prelude.Mail (gargMail, GargMail(..))
...@@ -34,7 +34,9 @@ data SendEmail = SendEmail Bool ...@@ -34,7 +34,9 @@ data SendEmail = SendEmail Bool
type EmailAddress = Text type EmailAddress = Text
type Name = Text type Name = Text
type ServerAddress = Text data ServerAddress = ServerAddress { sa_name :: Text
, sa_url :: Text
}
data MailModel = Invitation { invitation_user :: NewUser GargPassword } data MailModel = Invitation { invitation_user :: NewUser GargPassword }
| PassUpdate { passUpdate_user :: NewUser GargPassword } | PassUpdate { passUpdate_user :: NewUser GargPassword }
...@@ -50,7 +52,7 @@ mail mailCfg model = do ...@@ -50,7 +52,7 @@ mail mailCfg model = do
let let
(m,u) = email_to model (m,u) = email_to model
subject = email_subject model subject = email_subject model
body = emailWith (view gc_url cfg) model body = emailWith (ServerAddress (view gc_backend_name cfg) (view gc_url cfg)) model
liftBase $ gargMail mailCfg (GargMail { gm_to = m liftBase $ gargMail mailCfg (GargMail { gm_to = m
, gm_name = Just u , gm_name = Just u
, gm_subject = subject , gm_subject = subject
...@@ -76,14 +78,14 @@ email_to' (NewUser u m _) = (m,u) ...@@ -76,14 +78,14 @@ email_to' (NewUser u m _) = (m,u)
------------------------------------------------------------------------ ------------------------------------------------------------------------
bodyWith :: ServerAddress -> MailModel -> [Text] bodyWith :: ServerAddress -> MailModel -> [Text]
bodyWith server (Invitation u) = [ "Congratulation, you have been granted a user account to test the" bodyWith server@(ServerAddress name _url) (Invitation u) = [ "Congratulation, you have been granted a user account to test the"
, "new GarganText platform!" , "new GarganText platform called " <> name <> " !"
] <> (email_credentials server u) ] <> (email_credentials server u)
bodyWith server (PassUpdate u) = [ "Your account password have been updated on the GarganText platform!" bodyWith server (PassUpdate u) = [ "Your account password have been updated on the GarganText platform!"
] <> (email_credentials server u) ] <> (email_credentials server u)
bodyWith server (MailInfo _ _) = [ "Your last analysis is over on the server: " <> server] bodyWith (ServerAddress _ url) (MailInfo _ _) = [ "Your last analysis is over on the server: " <> url]
bodyWith _server (ForgotPassword { user = UserLight { userLight_forgot_password_uuid = Nothing }}) = bodyWith _server (ForgotPassword { user = UserLight { userLight_forgot_password_uuid = Nothing }}) =
[ "Cannot send you link to forgot password, no UUID" ] [ "Cannot send you link to forgot password, no UUID" ]
bodyWith server (ForgotPassword { user = UserLight { userLight_forgot_password_uuid = Just uuid }}) = bodyWith server (ForgotPassword { user = UserLight { userLight_forgot_password_uuid = Just uuid }}) =
...@@ -91,7 +93,7 @@ bodyWith server (ForgotPassword { user = UserLight { userLight_forgot_password_u ...@@ -91,7 +93,7 @@ bodyWith server (ForgotPassword { user = UserLight { userLight_forgot_password_u
, forgot_password_link server uuid ] , forgot_password_link server uuid ]
forgot_password_link :: ServerAddress -> Text -> Text forgot_password_link :: ServerAddress -> Text -> Text
forgot_password_link server uuid = server <> "/#/forgotPassword?uuid=" <> uuid <> "&server=" <> encodeText server forgot_password_link (ServerAddress _ server) uuid = server <> "/#/forgotPassword?uuid=" <> uuid <> "&server=" <> encodeText server
------------------------------------------------------------------------ ------------------------------------------------------------------------
email_subject :: MailModel -> Text email_subject :: MailModel -> Text
...@@ -102,7 +104,7 @@ email_subject (ForgotPassword _) = "[GarganText] Forgot Password" ...@@ -102,7 +104,7 @@ email_subject (ForgotPassword _) = "[GarganText] Forgot Password"
email_credentials :: ServerAddress -> NewUser GargPassword -> [Text] email_credentials :: ServerAddress -> NewUser GargPassword -> [Text]
email_credentials server (NewUser u _ (GargPassword p)) = email_credentials (ServerAddress _ server) (NewUser u _ (GargPassword p)) =
[ "" [ ""
, "You can log in to: " <> server , "You can log in to: " <> server
, "Your username is: " <> u , "Your username is: " <> u
...@@ -113,22 +115,20 @@ email_credentials server (NewUser u _ (GargPassword p)) = ...@@ -113,22 +115,20 @@ email_credentials server (NewUser u _ (GargPassword p)) =
email_disclaimer :: [Text] email_disclaimer :: [Text]
email_disclaimer = email_disclaimer =
[ "" [ ""
, "If you log in you agree with the following terms of use:"
, " https://gitlab.iscpif.fr/humanities/tofu/tree/master"
, ""
, ""
, "/!\\ Please note that your account is opened for beta tester only. Hence" , "/!\\ Please note that your account is opened for beta tester only. Hence"
, "we cannot guarantee neither the perenniality nor the stability of the" , "we cannot guarantee neither the perenniality nor the stability of the"
, "service at this stage. It is therefore advisable to back up important" , "service at this stage. It is therefore advisable to back up important"
, "data regularly." , "data regularly."
, "" , ""
, "/!\\ Gargantext is an academic service supported by ISC-PIF partners." , "/!\\ Gargantext is an academic service supported by CNRS/ISC-PIF partners."
, "In case of congestion on this service, access to members of the ISC-PIF" , "In case of congestion on this service, access to members of the ISC-PIF"
, "partners will be privileged." , "partners will be privileged."
, "" , ""
, "If you log in you agree with the following terms of use:"
, " https://gitlab.iscpif.fr/humanities/tofu/tree/master"
, ""
, "Your feedback will be valuable for further development of the platform," , "Your feedback will be valuable for further development of the platform,"
, "do not hesitate to contact us and to contribute on our forum:" , "do not hesitate to contact us and to contribute on our forum:"
, ""
, " https://discourse.iscpif.fr/c/gargantext" , " https://discourse.iscpif.fr/c/gargantext"
, "" , ""
] ]
......
...@@ -33,7 +33,7 @@ ghc-options: ...@@ -33,7 +33,7 @@ ghc-options:
extra-deps: extra-deps:
- git: https://gitlab.iscpif.fr/gargantext/haskell-gargantext-prelude.git - git: https://gitlab.iscpif.fr/gargantext/haskell-gargantext-prelude.git
commit: 08096a4913572cf22762fa77613340207ec6d9fd commit: 03c3c381ba9df6da02a7a3c8d7b78cde9a380d04
- git: https://gitlab.iscpif.fr/gargantext/gargantext-graph.git - git: https://gitlab.iscpif.fr/gargantext/gargantext-graph.git
commit: 588e104fe7593210956610cab0041fd16584a4ce commit: 588e104fe7593210956610cab0041fd16584a4ce
# Data Mining Libs # Data Mining Libs
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment