Commit 8285f7d3 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[ADMIN] log instructions by email

parent 00900141
dev 102-dev-graph-refresh 104-dev-john-snow-nlp 106-dev-ngrams-score-fix 111-dev-refactor-text-corpus-api-with-conduit 111-dev-refactor-text-corpus-api-with-conduit-alp 117-dev-gql-tree-parent-resolver 118-dev-gql-security 118-dev-gql-security-fix 119-dev-hal-notebook 121-dev-arxiv 124-dev-corpus-export-csv 131-dev-ngrams-table-db-connection 131-dev-ngrams-table-db-connection-2 141-dev-node-stories-db-optimization 143-dev-ngrams-repo-conflicts 144-NgramsTable_Optim 145-dev-graph-explorer-search-tfidf 145-graphExplorerSearch 149-dev-ngrams-table-sorting-fix 151-dev-pubmed-api-key 155-dev-export-list-as-csv 158-dev-ngrams-table-patch-sync 159-dev-node-story-versions-fix 161-dev-conduit-insert-db-fix 162-dev-ghc-9.4 162-dev-ghc-9.x 162-dev-haskell-9.2 163-dev-patch-fix 164-dev-node-write-analysis 175-dev-doc-table-count 175-dev-doc-table-count-temp 177-welcome-door-to-enter-the-project 184-dev-add-nlp-to-gargantext-ini 184-dev-add-support-for-multiple-languages-in-ini-file 186-dev-ngrams-score-fixes 190-dev-framecalc-async-fix 191-dev-list-upload-fixes 193-dev-api-query-dev-fix 199-dev-materialized-view-refresh-issue 201-dev-user-pubmed-api-key 203-dev-corpus-json-import 205-dev-ethercalc-codimd-doc-upload 206-dev-phylo 213-dev-implement-json-errors 217-dev-ngrams-patch 233-dev-terms-dates 234-dev-doc-table-score 239-readme-test-reinstall-project-with-cabal-and-update-the-readme-file 239-readme-test-reinstall-project-with-cabal-and-update-the-readme-file-2 244-dev-cabal-dependencies-versions 244-dev-hal-language-fix-for-abstracts 244-dev-stack2cabal 250-dev-fix-corpus-hyperdata-update 259-dev-security-fixes 260-readme-add-note-about-libraries-devlopment 263-node-content-breadcrumb-display-the-full-path-of-a-node-as-a-breadcrumb-with-each-clickable-parent 267-dev-fix-nginx-config-for-frames 272-dev-fixes-for-node-score 274-dev-more-protolude-in-prelude 275-dev-date-split-fix 280-dev-xml-code-cleanup 281-dev-ngrams-fixes 374-dev-document-fix 376-dev-annuaire-contacts-page 376-dev-annuaire-fields 396-dev-team-management 398-dev-ngram-type-parameter 405-dev-lost-password-design 415-dev-user-empty-field 428-dev-profile-img-upload 428-dev-profile-img-upload-2 430-dev-docs-date-filter 438-dev-team-node-creator 443-dev-doc-upload-improvement 445-dev-doc-upload-lang 452-dev-teams-security 465-dev-hyperdata-graph-angle 469-dev-email-change 475-dev-node-team-invite 476-dev-fix-node-story-versions 481-dev-node-calc-upload 497-dev-node-write-selection 506-dev-search-in-tree 506-dev-tree-search-fix 513-dev-pin-tree 548-dev-reverse-url-search 551-dev-graphql-contexts-ngrams 561-dev-document-date 571-dev-node-corpus-api-search-fixes 571-dev-node-corpus-api-search-fixes-take-2 582-dev-node-phylo-init 59-dev-404-error-when-node-doesnt-exist 592-dev-document-upload-abstract 594-dev-ngrams-click-fixes 596-dev-ngrams-initial-sync-fix 603-dev-istex-zip-file-upload 67-dev-ci 68-dev-garg-v3-csv-parser 70-dev-searx-parser 73-dev-more-generic-csv-parser 74-dev-frame-calc-csv-import 77-dev-search-result-type-fix 78-dev-list-ids 79-dev-rewrite-better-record-syntax 81-dev-fix-parsers-conduit-length 81-dev-zip-upload 86-dev-graphql 86-dev-graphql-alp 86-dev-graphql-nested 87-term-s-grouping-broken-on-cnrs-gargantext-org 90-dev-async-jobs-with-push-event 90-dev-flow-corpus-progress-report 90-dev-hal-box-fix 90-dev-hal-fixes 90-dev-max-docs-scrapers-parsers 97-dev-istex-search adinapoli/developer-guidelines adinapoli/disable-policy-checks adinapoli/drop-servant-static-th adinapoli/fix-datafield-instance adinapoli/fix-phylo-types adinapoli/fix-scheduler adinapoli/hotfix-for-datafield-json-instance adinapoli/improve-cabal adinapoli/improve-cabal-ci-caching adinapoli/improve-cabal-old adinapoli/investigate-issue-192 adinapoli/issue-180-deps-audit adinapoli/issue-182 adinapoli/issue-185-job-api adinapoli/issue-185-job-api-part-2 adinapoli/issue-187-update-haskell-igraph adinapoli/issue-188 adinapoli/issue-198 adinapoli/issue-198-part-2 adinapoli/issue-217 adinapoli/issue-226 adinapoli/issue-250 adinapoli/issue-252 adinapoli/issue-258 adinapoli/issue-258-part-2 adinapoli/issue-259 adinapoli/issue-259-design-1 adinapoli/issue-261 adinapoli/issue-267 adinapoli/issue-267-part-2 adinapoli/issue-267-part-3 adinapoli/issue-273 adinapoli/issue-273-part-2 adinapoli/issue-276 adinapoli/issue-279 adinapoli/issue-284 adinapoli/issue-incorrect-pagination adinapoli/mac-fixes adinapoli/more-db-test-coverage adinapoli/raw-query-to-pubmed adinapoli/restore-ci adinapoli/switch-hsvm adinapoli/try-stack2cabal alp/nix alp/no-gfortran-extralib client-executable client-graphql-endpoint dbg-perf-order2-graph debug-nans dev-104-adding-language dev-177-DoorWelcome dev-177-DoorWelcome-v2 dev-250-addChineze dev-593-pubmed-api-key dev-9.0-upgrade dev-addDoc dev-bdd dev-bench dev-big-file-upload dev-bipartite dev-cache-optimization dev-charts-update-economy dev-ci dev-client dev-code dev-contributing dev-corpora-from-write-nodes dev-debian-install-script dev-debug dev-debug-invitation dev-demo dev-distributional dev-doc-table-cache-issue dev-doc-table-score dev-dockerfile-ca-certificates-fix dev-docs-chart-update dev-docs-download dev-docs-in-abstract dev-ekg-monitoring dev-epo-integration dev-epo-patents dev-fix-broken-pure-refactor dev-fix-node-children dev-fix-node-update-endpoint dev-forgot-password dev-gargantext-ini-fix dev-ghc9.2-acc1.3-etc dev-gql-tree-api dev-graph-multipartite dev-graph-screenshot-corpus-id-fix dev-graph-search-in-groups-not-in-labels dev-hackathon-fixes dev-ihaskell-codebook dev-ilike-search-fix dev-indexation dev-infomap dev-ini-fixes dev-invitation-error dev-iramuteq dev-kawen dev-listfix dev-lts-16.26-upgrade dev-maplist dev-merge dev-merge-nix dev-merge-nix-2 dev-ngrams-groups dev-ngrams-repo-optim dev-ngrams-table-online dev-no-freeze dev-node-board-add-text-cells dev-notebook dev-openalex dev-optim dev-order1 dev-order2 dev-padagraph dev-phylo dev-phylo-accuracy dev-phylo-merge dev-phylo-quality dev-phylo-strict dev-phylo-uniform_accuracy dev-phyloDebug dev-public-node-api dev-pubmed dev-refactor-metrics dev-scores dev-small-fixes dev-social-list dev-sources-chart-sort dev-stack-18.16-upgrade dev-stack-upgrade dev-term-list-fix dev-test dev-tokens-lemma dev-tree-gql-improvements dev-tree-reload dev-treedebug dev-typeclasses-refactoring dev-userid-in-auth dev-websockets dev-wikidata developer-guidelines fix-confluence-indices-bugs fix-haddock-parse-error flexible-job-queue garg-init-errror-msg jobqueue-fairness jobqueue-test-delay mailmap master nix nothunks phylo_paper revert-0b51636b stable testing 0.0.6.9.9.9.3.1 0.0.6.9.9.9.3 0.0.6.9.9.9.2 0.0.6.9.9.9.1 0.0.6.9.9.9 0.0.6.9.9.8.3.4 0.0.6.9.9.8.3.3 0.0.6.9.9.8.3.2 0.0.6.9.9.8.3.1 0.0.6.9.9.8.3 0.0.6.9.9.8.2 0.0.6.9.9.8.1 0.0.6.9.9.8 0.0.6.9.9.7.9 0.0.6.9.9.7.8 0.0.6.9.9.7.7 0.0.6.9.9.7.6.4 0.0.6.9.9.7.6.3 0.0.6.9.9.7.6.2 0.0.6.9.9.7.6.1 0.0.6.9.9.7.6 0.0.6.9.9.7.5.1 0.0.6.9.9.7.5 0.0.6.9.9.7.4 0.0.6.9.9.7.3 0.0.6.9.9.7.2 0.0.6.9.9.7.1 0.0.6.9.9.7 0.0.6.9.9.6.9 0.0.6.9.9.6.8 0.0.6.9.9.6.7 0.0.6.9.9.6.6 0.0.6.9.9.6.5 0.0.6.9.9.6.4 0.0.6.9.9.6.3 0.0.6.9.9.6.2 0.0.6.9.9.6.1 0.0.6.9.9.6 0.0.6.9.9.5.8 0.0.6.9.9.5.7 0.0.6.9.9.5.6 0.0.6.9.9.5.5 0.0.6.9.9.5.4 0.0.6.9.9.5.3 0.0.6.9.9.5.2 0.0.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1 0.0.3 0.0.2.9.6.1 0.0.2.9.6 0.0.2.9.5 0.0.2.9.4 0.0.2.9.3 0.0.2.9.2 0.0.2.9.1 0.0.2.9 0.0.2.8 0.0.2.7.1 0.0.2.7 0.0.2.6 0.0.2.5 0.0.2.4 0.0.2.3 0.0.2.2.1 0.0.2.2 0.0.2.1 0.0.2.0 0.0.1.96.0 0.0.1.95.0 0.0.1.94.1 0.0.1.94.0 0.0.1.93.0 0.0.1.92.0 0.0.1.91.7 0.0.1.91.6 0.0.1.91.5 0.0.1.91.4 0.0.1.91.3 0.0.1.91.2 0.0.1.91.1 0.0.1.91.0 0.0.1.9.10 0.0.1.9.9 0.0.1.9.8 0.0.1.9.7 0.0.1.9.6 0.0.1.9.5 0.0.1.9.4 0.0.1.9.3 0.0.1.9.2 0.0.1.9.1 0.0.1.9 0.0.1.8.6 0.0.1.8.5
No related merge requests found
......@@ -204,7 +204,7 @@ flowCorpusUser l user corpusName ctype ids = do
-- User Flow
(userId, _rootId, userCorpusId) <- getOrMk_RootWithCorpus user corpusName ctype
listId <- getOrMkList userCorpusId userId
_cooc <- insertDefaultNode NodeListCooc listId userId
-- _cooc <- insertDefaultNode NodeListCooc listId userId
-- TODO: check if present already, ignore
_ <- Doc.add userCorpusId ids
......@@ -286,7 +286,7 @@ insertMasterDocs c lang hs = do
, (nId, w) <- Map.toList mapNodeIdWeight
]
_cooc <- insertDefaultNode NodeListCooc lId masterUserId
-- _cooc <- insertDefaultNode NodeListCooc lId masterUserId
-- to be removed
_ <- insertDocNgrams lId indexedNgrams
pure ids'
......
......@@ -15,27 +15,62 @@ module Gargantext.Database.Action.User
where
-- import Data.Maybe (catMaybes)
import Data.Text (Text, unlines)
import Gargantext.Database.Query.Table.User
import Gargantext.Core.Types.Individu
import Gargantext.Database.Prelude
import Gargantext.Prelude
import Gargantext.Prelude.Mail (gargMail)
import Gargantext.Prelude.Mail (gargMail, GargMail(..))
import Gargantext.Database.Query.Table.Node.Error (HasNodeError(..), nodeError, NodeError(..))
import Gargantext.Database.Action.Flow (getOrMkRoot)
------------------------------------------------------------------------
mkUser :: HasNodeError err => NewUser GargPassword -> Cmd err Int64
mkUser u = mkUsers [u]
mkUser :: HasNodeError err => Text -> NewUser GargPassword -> Cmd err Int64
mkUser address u = mkUsers address [u]
mkUsers :: HasNodeError err => [NewUser GargPassword] -> Cmd err Int64
mkUsers us = do
mkUsers :: HasNodeError err => Text -> [NewUser GargPassword] -> Cmd err Int64
mkUsers address us = do
us' <- liftBase $ mapM toUserHash us
r <- insertUsers $ map toUserWrite us'
_ <- mapM getOrMkRoot $ map (\u -> UserName (_nu_username u)) us
_ <- liftBase gargMail
_ <- liftBase $ mapM (mail address) us
pure r
------------------------------------------------------------------------
-- TODO gargantext.ini config
mail :: Text -> NewUser GargPassword -> IO ()
mail address nu@(NewUser u m _) = gargMail (GargMail m (Just u) subject body)
where
subject = "[Your Garg Account]"
body = logInstructions address nu
-- TODO put this in a configurable file (path in gargantext.ini)
logInstructions :: Text -> NewUser GargPassword -> Text
logInstructions address (NewUser u _ (GargPassword p)) =
unlines [ "Hello"
, "You have been invited to test the new GarganText platform!"
, ""
, "You can log on to: " <> address
, "Your login is: " <> u
, "Your password is: " <> p
, ""
, "Please read the full terms of use on:"
, "https://gitlab.iscpif.fr/humanities/tofu/tree/master"
, ""
, "Your feedback will be valuable for further development"
, "of the platform, do not hesitate to contact us and"
, "to contribute on our forum:"
, " https://discourse.iscpif.fr/c/gargantext"
, ""
, "With our best regards,"
, "-- "
, "The Gargantext Team (CNRS)"
]
------------------------------------------------------------------------
------------------------------------------------------------------------
rmUser :: HasNodeError err => User -> Cmd err Int64
rmUser (UserName un) = deleteUsers [un]
......
......@@ -12,26 +12,35 @@ Portability : POSIX
{-# LANGUAGE OverloadedStrings #-}
module Gargantext.Prelude.Mail
(gargMail)
(gargMail, GargMail(..))
where
-- import Data.Text.Internal.Lazy (Text)
import Data.Text (Text)
import Data.Maybe
import Network.Mail.SMTP hiding (htmlPart)
import Gargantext.Prelude
import Network.Mail.Mime (plainPart)
-- | TODO add parameters
gargMail :: IO ()
gargMail = sendMail "localhost" mail
type Email = Text
type Name = Text
data GargMail = GargMail { gm_to :: Email
, gm_name :: Maybe Name
, gm_subject :: Text
, gm_body :: Text
}
-- | TODO add parameters to gargantext.ini
gargMail :: GargMail -> IO ()
gargMail (GargMail to' name subject body) = sendMail "localhost" mail
where
mail = simpleMail from to cc bcc subject [body]
mail = simpleMail from to cc bcc subject [plainPart $ cs body]
from = Address (Just "François Rabelais") "francois.rabelais@gargantext.org"
to = [Address (Just "Anoe") "alexandre@localhost"]
from = Address (Just "GargTeam") "contact@gargantext.org"
to = [Address name to']
cc = []
bcc = []
subject = "email subject"
body = plainPart "email body"
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