diff --git a/libs/wire-subsystems/src/Wire/AuthenticationSubsystem/Interpreter.hs b/libs/wire-subsystems/src/Wire/AuthenticationSubsystem/Interpreter.hs index 0a3337eafd0..442ac0f95b1 100644 --- a/libs/wire-subsystems/src/Wire/AuthenticationSubsystem/Interpreter.hs +++ b/libs/wire-subsystems/src/Wire/AuthenticationSubsystem/Interpreter.hs @@ -205,7 +205,7 @@ resetPasswordImpl ident code pw = do verify (k, c) = do now <- Now.get passwordResetData <- codeSelect k - res <- case passwordResetData of + case passwordResetData of Just (PRQueryData codeInDB u _ (Just t)) | c == codeInDB && t >= now -> pure (Just u) Just (PRQueryData codeInDB u (Just n) (Just t)) | n > 1 && t > now -> do -- If we only update retries, there is a chance that this races with @@ -215,4 +215,3 @@ resetPasswordImpl ident code pw = do pure Nothing Just PRQueryData {} -> codeDelete k $> Nothing Nothing -> pure Nothing - pure res diff --git a/libs/wire-subsystems/test/unit/Wire/MockInterpreters/Error.hs b/libs/wire-subsystems/test/unit/Wire/MockInterpreters/Error.hs index 1f947cedb9e..09ed07d043d 100644 --- a/libs/wire-subsystems/test/unit/Wire/MockInterpreters/Error.hs +++ b/libs/wire-subsystems/test/unit/Wire/MockInterpreters/Error.hs @@ -12,4 +12,4 @@ runErrorUnsafe action = do Right x -> pure x catchExpectedError :: (Member (Error e) r) => Sem r a -> Sem r (Maybe e) -catchExpectedError action = (const Nothing <$> action) `catch` (pure . Just) +catchExpectedError action = (Nothing <$ action) `catch` (pure . Just) diff --git a/libs/wire-subsystems/test/unit/Wire/MockInterpreters/PasswordResetCodeStore.hs b/libs/wire-subsystems/test/unit/Wire/MockInterpreters/PasswordResetCodeStore.hs index d4647f7b422..25d6ab11d89 100644 --- a/libs/wire-subsystems/test/unit/Wire/MockInterpreters/PasswordResetCodeStore.hs +++ b/libs/wire-subsystems/test/unit/Wire/MockInterpreters/PasswordResetCodeStore.hs @@ -19,9 +19,9 @@ inMemoryPasswordResetCodeStore = pure . PasswordResetCode . encodeBase64Url $ "email-code" GeneratePhoneCode -> (error "deprecated") CodeSelect resetKey -> do - gets $ \codes -> - mapPRQueryData (Just . runIdentity) - <$> Map.lookup resetKey codes + gets $ + fmap (mapPRQueryData (Just . runIdentity)) + . Map.lookup resetKey CodeInsert resetKey queryData _ttl -> do modify $ Map.insert resetKey queryData CodeDelete resetKey -> do