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

[FIX] normalize username when sharing

parent 47ab0d5b
...@@ -25,7 +25,7 @@ import Gargantext.Database.Query.Table.User ...@@ -25,7 +25,7 @@ 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 qualified Data.Text as Text
------------------------------------------------------------------------ ------------------------------------------------------------------------
------------------------------------------------------------------------ ------------------------------------------------------------------------
newUsers :: (CmdM env err m, MonadRandom m, HasNodeError err) newUsers :: (CmdM env err m, MonadRandom m, HasNodeError err)
...@@ -45,9 +45,11 @@ newUserQuick n = do ...@@ -45,9 +45,11 @@ newUserQuick n = do
pure (NewUser u n (GargPassword pass)) pure (NewUser u n (GargPassword pass))
------------------------------------------------------------------------ ------------------------------------------------------------------------
-- | guessUserName
-- guess username and normalize it (Text.toLower)
guessUserName :: Text -> Maybe (Text,Text) guessUserName :: Text -> Maybe (Text,Text)
guessUserName n = case splitOn "@" n of guessUserName n = case splitOn "@" n of
[u',m'] -> if m' /= "" then Just (u',m') [u',m'] -> if m' /= "" then Just (Text.toLower u',m')
else Nothing else Nothing
_ -> Nothing _ -> Nothing
------------------------------------------------------------------------ ------------------------------------------------------------------------
......
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