fix(avs): preserve unset pin passwords in update
This commit is contained in:
parent
6761767c6c
commit
8c4f848675
@ -494,7 +494,7 @@ upsertAvsUserById api = do
|
|||||||
whenIsJust pinCard $ \pCard -> -- update pin, but only if it was unset or set to the value of an old card
|
whenIsJust pinCard $ \pCard -> -- update pin, but only if it was unset or set to the value of an old card
|
||||||
unlessM (exists [UserAvsCardCardNo ==. getFullCardNo pCard]) $ do
|
unlessM (exists [UserAvsCardCardNo ==. getFullCardNo pCard]) $ do
|
||||||
let oldPins = Just . personCard2pin . userAvsCardCard . entityVal <$> oldCards
|
let oldPins = Just . personCard2pin . userAvsCardCard . entityVal <$> oldCards
|
||||||
updateWhere [UserId ==. uid, UserPinPassword !=. userPin, UserPinPassword <-. Nothing:oldPins]
|
updateWhere [UserId ==. uid, UserPinPassword !=. userPin, UserPinPassword <-. oldPins] -- check for old pin ensures that unset/manually set passwords remain unchanged
|
||||||
[UserPinPassword =. userPin]
|
[UserPinPassword =. userPin]
|
||||||
insert_ $ UserAvsCard api (getFullCardNo pCard) pCard now
|
insert_ $ UserAvsCard api (getFullCardNo pCard) pCard now
|
||||||
upsertUserCompany uid mbCompany userFirmAddr
|
upsertUserCompany uid mbCompany userFirmAddr
|
||||||
|
|||||||
Reference in New Issue
Block a user