Commit f882428c authored by Alexandre Delanoë's avatar Alexandre Delanoë

[FIX] updateUsers pwd

parent 63f76792
Pipeline #1262 failed with stage
...@@ -51,6 +51,7 @@ instance Arbitrary ShareNodeParams where ...@@ -51,6 +51,7 @@ instance Arbitrary ShareNodeParams where
] ]
------------------------------------------------------------------------ ------------------------------------------------------------------------
-- TODO permission -- TODO permission
-- TODO refactor userId which is used twice
api :: HasNodeError err api :: HasNodeError err
=> NodeId => NodeId
-> ShareNodeParams -> ShareNodeParams
...@@ -66,7 +67,7 @@ api nId (ShareTeamParams user') = do ...@@ -66,7 +67,7 @@ api nId (ShareTeamParams user') = do
_ <- newUsers [user'] _ <- newUsers [user']
pure u pure u
fromIntegral <$> DB.shareNodeWith (ShareNodeWith_User NodeFolderShared (UserName user)) nId fromIntegral <$> DB.shareNodeWith (ShareNodeWith_User NodeFolderShared (UserName user)) nId
api nId2 (SharePublicParams nId1) = api nId2 (SharePublicParams nId1) =
fromIntegral <$> DB.shareNodeWith (ShareNodeWith_Node NodeFolderPublic nId1) nId2 fromIntegral <$> DB.shareNodeWith (ShareNodeWith_Node NodeFolderPublic nId1) nId2
......
...@@ -70,12 +70,17 @@ newUsers' address us = do ...@@ -70,12 +70,17 @@ newUsers' address us = do
_ <- liftBase $ mapM (mail Invitation address) us _ <- liftBase $ mapM (mail Invitation address) us
pure r pure r
------------------------------------------------------------------------ ------------------------------------------------------------------------
data SendEmail = SendEmail Bool
updateUser :: HasNodeError err updateUser :: HasNodeError err
=> Text -> NewUser GargPassword -> Cmd err Int64 => SendEmail -> Text -> NewUser GargPassword -> Cmd err Int64
updateUser address u = do updateUser (SendEmail send) address u = do
u' <- liftBase $ toUserHash u u' <- liftBase $ toUserHash u
n <- updateUserDB $ toUserWrite u' n <- updateUserDB $ toUserWrite u'
_ <- liftBase $ mail Update address u _ <- case send of
True -> liftBase $ mail Update address u
False -> pure ()
pure n pure n
------------------------------------------------------------------------ ------------------------------------------------------------------------
......
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