Fix PIN generator
This commit is contained in:
parent
625fdcaee8
commit
e9085d6b9e
3 changed files with 5 additions and 4 deletions
|
@ -26,6 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
### Fixed
|
||||
|
||||
- Fixed the PIN generation
|
||||
- Fixed calculation of order total to ensure 8 decimal places
|
||||
- Fixed test for looking for an order with incorrect ID
|
||||
- Fixed payment scan to focus only on new transactions
|
||||
|
|
|
@ -99,9 +99,9 @@ validateUser session =
|
|||
(select ["session" =: session] "users")
|
||||
["$set" =: ["validated" =: True]]
|
||||
|
||||
generatePin :: IO T.Text
|
||||
generatePin = do
|
||||
g <- newStdGen
|
||||
generatePin :: Int -> IO T.Text
|
||||
generatePin s = do
|
||||
let g = mkStdGen s
|
||||
pure $
|
||||
T.pack (padLeft (show . head $ randomRs (1 :: Integer, 10000000) g) '0' 7)
|
||||
|
||||
|
|
|
@ -405,7 +405,7 @@ addUser _ _ _ _ _ Nothing = return () --`debug` "addUser got Nothing"
|
|||
addUser nodeUser nodePwd p db node (Just tx) = do
|
||||
isNew <- liftIO $ isUserNew p db tx
|
||||
when isNew $ do
|
||||
let newPin = unsafePerformIO generatePin
|
||||
let newPin = unsafePerformIO (generatePin (fromIntegral $ blocktime tx))
|
||||
_ <- sendPin nodeUser nodePwd node (address tx) newPin
|
||||
insert_
|
||||
"users"
|
||||
|
|
Loading…
Reference in a new issue