send out password hash on reg add

This commit is contained in:
Keagan McClelland
2022-05-26 16:10:21 -06:00
parent eb3649366a
commit 022efd8c6f
2 changed files with 20 additions and 0 deletions

View File

@@ -20,7 +20,13 @@ import Control.Monad.Logger ( LogLevel(..)
, fromLogStr , fromLogStr
, toLogStr , toLogStr
) )
import Crypto.Hash ( SHA256(SHA256)
, hashWith
)
import Data.Aeson ( eitherDecodeStrict ) import Data.Aeson ( eitherDecodeStrict )
import Data.ByteArray.Encoding ( Base(..)
, convertToBase
)
import qualified Data.ByteString.Char8 as B8 import qualified Data.ByteString.Char8 as B8
import qualified Data.ByteString.Lazy as LB import qualified Data.ByteString.Lazy as LB
import Data.Default import Data.Default
@@ -103,6 +109,7 @@ import Startlude ( ($)
, fromIntegral , fromIntegral
, fromMaybe , fromMaybe
, panic , panic
, putStrLn
, show , show
, unlessM , unlessM
, void , void
@@ -280,6 +287,16 @@ regAdd name val = do
PublishCfg cfg <- inputFile auto loc PublishCfg cfg <- inputFile auto loc
let cfg' = insert name val cfg let cfg' = insert name val cfg
writeFile loc (pretty $ embed inject $ PublishCfg cfg') writeFile loc (pretty $ embed inject $ PublishCfg cfg')
putChunkLn $ "Below is the hash to provide to the server operator for your admin credentials" & fore yellow
putChunkLn
. fore yellow
. chunk
. decodeUtf8
. convertToBase Base16
. hashWith SHA256
. B8.pack
. mappend "start9_admin:"
$ publishCfgRepoPass val
regRm :: String -> IO () regRm :: String -> IO ()
regRm name = do regRm name = do

View File

@@ -23,6 +23,7 @@ import Database.Esqueleto.Experimental
, (^.) , (^.)
, desc , desc
, from , from
, groupBy
, ilike , ilike
, in_ , in_
, innerJoin , innerJoin
@@ -49,6 +50,7 @@ import Lib.Types.Emver ( Version )
import Model import Model
import Startlude hiding ( (%) import Startlude hiding ( (%)
, from , from
, groupBy
, on , on
, yield , yield
) )
@@ -90,6 +92,7 @@ searchServices (Just category) query = selectSource $ do
) )
pure service pure service
) )
groupBy (services ^. VersionRecordPkgId)
orderBy [desc (services ^. VersionRecordUpdatedAt)] orderBy [desc (services ^. VersionRecordUpdatedAt)]
pure services pure services