Fix email verification
This commit is contained in:
parent
12e2d2a3e0
commit
cbcf23e316
|
@ -96,10 +96,11 @@ isMember user = not_ $ isApplicant user
|
|||
verifyEmailSecret :: MonadDB m => Text -> m Bool
|
||||
verifyEmailSecret secret = runQuery $ do
|
||||
update $ \email -> do
|
||||
verification <- from $ table @DBEmailVerification
|
||||
set email [DBEmailVid =. val Nothing]
|
||||
where_ $ email ^. DBEmailVid ==. just (verification ^. DBEmailVerificationId)
|
||||
&&. verification ^. DBEmailVerificationSecret ==. val secret
|
||||
where_ $ (>. val (0 :: Int)) $ subSelectCount $ do
|
||||
verification <- from $ table @DBEmailVerification
|
||||
where_ $ email ^. DBEmailVid ==. just (verification ^. DBEmailVerificationId)
|
||||
&&. verification ^. DBEmailVerificationSecret ==. val secret
|
||||
fmap (> 0) $ deleteCount $ do
|
||||
verification <- from (table @DBEmailVerification)
|
||||
where_ $ verification ^. DBEmailVerificationSecret ==. val secret
|
||||
|
|
Loading…
Reference in New Issue