Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
158
Issues
158
List
Board
Labels
Milestones
Merge Requests
11
Merge Requests
11
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
gargantext
haskell-gargantext
Commits
39874d24
Commit
39874d24
authored
Dec 07, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX] email model
parent
3d8c3d05
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
51 deletions
+53
-51
New.hs
src/Gargantext/Database/Action/User/New.hs
+53
-51
No files found.
src/Gargantext/Database/Action/User/New.hs
View file @
39874d24
...
@@ -58,16 +58,16 @@ guessUserName n = case splitOn "@" n of
...
@@ -58,16 +58,16 @@ guessUserName n = case splitOn "@" n of
_
->
Nothing
_
->
Nothing
------------------------------------------------------------------------
------------------------------------------------------------------------
newUser'
::
HasNodeError
err
newUser'
::
HasNodeError
err
=>
Text
->
NewUser
GargPassword
->
Cmd
err
Int64
=>
ServerAdress
->
NewUser
GargPassword
->
Cmd
err
Int64
newUser'
address
u
=
newUsers'
address
[
u
]
newUser'
address
u
=
newUsers'
address
[
u
]
newUsers'
::
HasNodeError
err
newUsers'
::
HasNodeError
err
=>
Text
->
[
NewUser
GargPassword
]
->
Cmd
err
Int64
=>
ServerAdress
->
[
NewUser
GargPassword
]
->
Cmd
err
Int64
newUsers'
address
us
=
do
newUsers'
address
us
=
do
us'
<-
liftBase
$
mapM
toUserHash
us
us'
<-
liftBase
$
mapM
toUserHash
us
r
<-
insertUsers
$
map
toUserWrite
us'
r
<-
insertUsers
$
map
toUserWrite
us'
_
<-
mapM
getOrMkRoot
$
map
(
\
u
->
UserName
(
_nu_username
u
))
us
_
<-
mapM
getOrMkRoot
$
map
(
\
u
->
UserName
(
_nu_username
u
))
us
_
<-
liftBase
$
mapM
(
mail
Invitation
address
)
us
_
<-
liftBase
$
mapM
(
mail
address
Invitation
)
us
pure
r
pure
r
------------------------------------------------------------------------
------------------------------------------------------------------------
...
@@ -75,77 +75,79 @@ data SendEmail = SendEmail Bool
...
@@ -75,77 +75,79 @@ 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
)
address
u
=
do
updateUser
(
SendEmail
send
)
server
u
=
do
u'
<-
liftBase
$
toUserHash
u
u'
<-
liftBase
$
toUserHash
u
n
<-
updateUserDB
$
toUserWrite
u'
n
<-
updateUserDB
$
toUserWrite
u'
_
<-
case
send
of
_
<-
case
send
of
True
->
liftBase
$
mail
Update
address
u
True
->
liftBase
$
mail
server
Update
u
False
->
pure
()
False
->
pure
()
pure
n
pure
n
------------------------------------------------------------------------
------------------------------------------------------------------------
data
Mail
=
Invitation
type
ServerAdress
=
Text
data
MailModel
=
Invitation
|
Update
|
Update
-- TODO gargantext.ini config
-- TODO gargantext.ini config
mail
::
Mail
->
Text
->
NewUser
GargPassword
->
IO
()
mail
::
ServerAdress
->
MailModel
->
NewUser
GargPassword
->
IO
()
mail
mtype
address
nu
@
(
NewUser
u
m
_
)
=
gargMail
(
GargMail
m
(
Just
u
)
subject
body
)
mail
server
model
user
@
(
NewUser
u
m
_
)
=
gargMail
(
GargMail
m
(
Just
u
)
subject
body
)
where
where
subject
=
"[Your Garg Account]"
subject
=
"[Your Garg Account]"
body
=
bodyWith
mtype
address
nu
body
=
emailWith
server
model
user
bodyWith
::
Mail
->
Text
->
NewUser
GargPassword
->
Text
bodyWith
Invitation
add
nu
=
logInstructions
add
nu
bodyWith
Update
add
nu
=
updateInstructions
add
nu
emailWith
::
ServerAdress
->
MailModel
->
NewUser
GargPassword
->
Text
-- TODO put this in a configurable file (path in gargantext.ini)
emailWith
server
model
(
NewUser
u
_
(
GargPassword
p
))
=
unlines
$
logInstructions
::
Text
->
NewUser
GargPassword
->
Text
[
"Hello"
]
logInstructions
address
(
NewUser
u
_
(
GargPassword
p
))
=
<>
bodyWith
model
<>
unlines
[
"Hello"
[
""
,
"You have been invited to test the new GarganText platform!"
,
"You can log in to: "
<>
server
,
""
,
"You can log in to: "
<>
address
,
"Your username is: "
<>
u
,
"Your username is: "
<>
u
,
"Your password is: "
<>
p
,
"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)"
]
]
<>
email_disclaimer
<>
email_signature
updateInstructions
::
Text
->
NewUser
GargPassword
->
Text
bodyWith
::
MailModel
->
[
Text
]
updateInstructions
address
(
NewUser
u
_
(
GargPassword
p
))
=
bodyWith
Invitation
=
[
"Congratulation, you have been granted a beta user account to test the"
unlines
[
"Hello"
,
"new GarganText platform!"
,
"Your account have been updated on the 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"
,
""
,
""
,
"You can log in to: "
<>
address
,
"Your username is: "
<>
u
,
"Your password is: "
<>
p
,
""
,
""
,
"As reminder, please read the full terms of use on:"
,
"/!
\\
Please note that this account is opened for beta tester only. Hence"
,
"https://gitlab.iscpif.fr/humanities/tofu/tree/master"
,
"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:"
,
""
,
""
,
"Your feedback is always 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"
,
" https://discourse.iscpif.fr/c/gargantext"
,
""
,
""
,
"With our best regards,"
]
email_signature
::
[
Text
]
email_signature
=
[
"With our best regards,"
,
"-- "
,
"-- "
,
"The Gargantext Team (CNRS)"
,
"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