Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Przemyslaw Kaminski
haskell-gargantext
Commits
dacf2fa9
Commit
dacf2fa9
authored
Dec 07, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ORG] Mail organization
parent
0301f5d5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
93 additions
and
71 deletions
+93
-71
Mail.hs
src/Gargantext/Core/Mail.hs
+91
-0
New.hs
src/Gargantext/Database/Action/User/New.hs
+2
-71
No files found.
src/Gargantext/Core/Mail.hs
0 → 100644
View file @
dacf2fa9
{-|
Module : Gargantext.Core.Mail
Description :
Copyright : (c) CNRS, 2017-Present
License : AGPL + CECILL v3
Maintainer : team@gargantext.org
Stability : experimental
Portability : POSIX
TODO put main configuration variables in gargantext.ini
-}
module
Gargantext.Core.Mail
where
import
Data.Text
(
Text
,
unlines
,
splitOn
)
import
Gargantext.Core.Types.Individu
import
Gargantext.Prelude
import
Gargantext.Prelude.Mail
(
gargMail
,
GargMail
(
..
))
import
qualified
Data.List
as
List
------------------------------------------------------------------------
data
SendEmail
=
SendEmail
Bool
type
EmailAddress
=
Text
type
ServerAdress
=
Text
data
MailModel
=
Invitation
|
Update
------------------------------------------------------------------------
isEmail
::
Text
->
Bool
isEmail
=
((
==
)
2
)
.
List
.
length
.
(
splitOn
"@"
)
------------------------------------------------------------------------
mail
::
ServerAdress
->
MailModel
->
NewUser
GargPassword
->
IO
()
mail
server
model
user
@
(
NewUser
u
m
_
)
=
gargMail
(
GargMail
m
(
Just
u
)
subject
body
)
where
subject
=
"[Your Garg Account]"
body
=
emailWith
server
model
user
emailWith
::
ServerAdress
->
MailModel
->
NewUser
GargPassword
->
Text
emailWith
server
model
(
NewUser
u
_
(
GargPassword
p
))
=
unlines
$
[
"Hello"
]
<>
bodyWith
model
<>
[
""
,
"You can log in to: "
<>
server
,
"Your username is: "
<>
u
,
"Your password is: "
<>
p
,
""
]
<>
email_disclaimer
<>
email_signature
bodyWith
::
MailModel
->
[
Text
]
bodyWith
Invitation
=
[
"Congratulation, you have been granted a beta user account to test the"
,
"new GarganText platform!"
]
bodyWith
Update
=
[
"Your account password have been updated on the GarganText platform!"
]
email_disclaimer
::
[
Text
]
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 this account is opened for beta tester only. Hence"
,
"we cannot guarantee neither the perenniality nor the stability of the"
,
"service at this stage. It is therefore advisable to back up important"
,
"data regularly."
,
""
,
"/!
\\
Gargantext is an academic service supported by ISC-PIF partners."
,
"In case of congestion on this service, access to members of the ISC-PIF"
,
"partners will be privileged."
,
""
,
"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"
,
""
]
email_signature
::
[
Text
]
email_signature
=
[
"With our best regards,"
,
"-- "
,
"The Gargantext Team (CNRS)"
]
src/Gargantext/Database/Action/User/New.hs
View file @
dacf2fa9
...
@@ -8,7 +8,6 @@ Stability : experimental
...
@@ -8,7 +8,6 @@ Stability : experimental
Portability : POSIX
Portability : POSIX
-}
-}
{-# OPTIONS_GHC -fno-warn-name-shadowing #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module
Gargantext.Database.Action.User.New
module
Gargantext.Database.Action.User.New
...
@@ -16,7 +15,8 @@ module Gargantext.Database.Action.User.New
...
@@ -16,7 +15,8 @@ module Gargantext.Database.Action.User.New
import
Control.Lens
(
view
)
import
Control.Lens
(
view
)
import
Control.Monad.Random
import
Control.Monad.Random
import
Data.Text
(
Text
,
unlines
,
splitOn
)
import
Data.Text
(
Text
,
splitOn
)
import
Gargantext.Core.Mail
import
Gargantext.Core.Types.Individu
import
Gargantext.Core.Types.Individu
import
Gargantext.Database.Action.Flow
(
getOrMkRoot
)
import
Gargantext.Database.Action.Flow
(
getOrMkRoot
)
import
Gargantext.Database.Prelude
import
Gargantext.Database.Prelude
...
@@ -25,11 +25,9 @@ import Gargantext.Database.Query.Table.User
...
@@ -25,11 +25,9 @@ import Gargantext.Database.Query.Table.User
import
Gargantext.Prelude
import
Gargantext.Prelude
import
Gargantext.Prelude.Config
import
Gargantext.Prelude.Config
import
Gargantext.Prelude.Crypto.Pass.User
(
gargPass
)
import
Gargantext.Prelude.Crypto.Pass.User
(
gargPass
)
import
Gargantext.Prelude.Mail
(
gargMail
,
GargMail
(
..
))
import
qualified
Data.List
as
List
import
qualified
Data.List
as
List
------------------------------------------------------------------------
------------------------------------------------------------------------
type
EmailAddress
=
Text
------------------------------------------------------------------------
------------------------------------------------------------------------
newUsers
::
(
CmdM
env
err
m
,
MonadRandom
m
,
HasNodeError
err
)
newUsers
::
(
CmdM
env
err
m
,
MonadRandom
m
,
HasNodeError
err
)
=>
[
EmailAddress
]
->
m
Int64
=>
[
EmailAddress
]
->
m
Int64
...
@@ -71,8 +69,6 @@ newUsers' address us = do
...
@@ -71,8 +69,6 @@ newUsers' address us = do
pure
r
pure
r
------------------------------------------------------------------------
------------------------------------------------------------------------
data
SendEmail
=
SendEmail
Bool
updateUser
::
HasNodeError
err
updateUser
::
HasNodeError
err
=>
SendEmail
->
Text
->
NewUser
GargPassword
->
Cmd
err
Int64
=>
SendEmail
->
Text
->
NewUser
GargPassword
->
Cmd
err
Int64
updateUser
(
SendEmail
send
)
server
u
=
do
updateUser
(
SendEmail
send
)
server
u
=
do
...
@@ -83,71 +79,6 @@ updateUser (SendEmail send) server u = do
...
@@ -83,71 +79,6 @@ updateUser (SendEmail send) server u = do
False
->
pure
()
False
->
pure
()
pure
n
pure
n
------------------------------------------------------------------------
type
ServerAdress
=
Text
data
MailModel
=
Invitation
|
Update
-- TODO gargantext.ini config
mail
::
ServerAdress
->
MailModel
->
NewUser
GargPassword
->
IO
()
mail
server
model
user
@
(
NewUser
u
m
_
)
=
gargMail
(
GargMail
m
(
Just
u
)
subject
body
)
where
subject
=
"[Your Garg Account]"
body
=
emailWith
server
model
user
emailWith
::
ServerAdress
->
MailModel
->
NewUser
GargPassword
->
Text
emailWith
server
model
(
NewUser
u
_
(
GargPassword
p
))
=
unlines
$
[
"Hello"
]
<>
bodyWith
model
<>
[
""
,
"You can log in to: "
<>
server
,
"Your username is: "
<>
u
,
"Your password is: "
<>
p
,
""
]
<>
email_disclaimer
<>
email_signature
bodyWith
::
MailModel
->
[
Text
]
bodyWith
Invitation
=
[
"Congratulation, you have been granted a beta user account to test the"
,
"new GarganText platform!"
]
bodyWith
Update
=
[
"Your account password have been updated on the GarganText platform!"
]
email_disclaimer
::
[
Text
]
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 this account is opened for beta tester only. Hence"
,
"we cannot guarantee neither the perenniality nor the stability of the"
,
"service at this stage. It is therefore advisable to back up important"
,
"data regularly."
,
""
,
"/!
\\
Gargantext is an academic service supported by ISC-PIF partners."
,
"In case of congestion on this service, access to members of the ISC-PIF"
,
"partners will be privileged."
,
""
,
"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"
,
""
]
email_signature
::
[
Text
]
email_signature
=
[
"With our best regards,"
,
"-- "
,
"The Gargantext Team (CNRS)"
]
------------------------------------------------------------------------
------------------------------------------------------------------------
rmUser
::
HasNodeError
err
=>
User
->
Cmd
err
Int64
rmUser
::
HasNodeError
err
=>
User
->
Cmd
err
Int64
rmUser
(
UserName
un
)
=
deleteUsers
[
un
]
rmUser
(
UserName
un
)
=
deleteUsers
[
un
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment