Commit 99f25621 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[Clean] + missing file

parent 9b14cdf1
Pipeline #1055 canceled with stage
{-|
Module : Gargantext.Prelude.Crypto.Pass
Module : Gargantext.Prelude.Crypto.Pass.Machine
Description :
Copyright : (c) CNRS, 2017-Present
License : Public Domain
......@@ -7,8 +7,7 @@ Maintainer : team@gargantext.org
Stability : experimental
Portability : POSIX
To avoid weak password, just offer an easy way to make "good" one and
let user add his own entropy.
Random Text generator (for machines mainly)
Thanks to
https://zuttobenkyou.wordpress.com/2011/12/23/simple-password-generation-with-haskell/
......@@ -16,7 +15,7 @@ https://zuttobenkyou.wordpress.com/2011/12/23/simple-password-generation-with-ha
-}
module Gargantext.Prelude.Crypto.Pass
module Gargantext.Prelude.Crypto.Pass.Machine
where
import Data.List (nub)
......
{-|
Module : Gargantext.Prelude.Crypto.Pass.User
Description :
Copyright : (c) CNRS, 2017-Present
License : Public Domain
Maintainer : team@gargantext.org
Stability : experimental
Portability : POSIX
-}
module Gargantext.Prelude.Crypto.Pass.User
where
import Data.List ((!!))
import Gargantext.Prelude
import System.Random
getRandomIndex :: Foldable t => t a -> IO Int
getRandomIndex list = randomRIO (0, (length list - 1))
getRandomElement :: [b] -> IO b
getRandomElement list = do
index <- (getRandomIndex list)
pure (list !! index)
generatePassword :: (Num a, Enum a) => a -> [b] -> IO [b]
generatePassword size wlist = mapM (\_ -> getRandomElement wlist) [1..size]
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