Skip to content

Commit

Permalink
Log also for reg user creation.
Browse files Browse the repository at this point in the history
  • Loading branch information
elland committed Oct 15, 2024
1 parent 73da097 commit ba549eb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 12 additions & 1 deletion services/brig/src/Brig/Data/User.hs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ import Brig.ZAuth qualified as ZAuth
import Cassandra hiding (Set)
import Control.Error
import Control.Lens hiding (from)
import Data.ByteString.Char8 qualified as BS
import Data.Conduit (ConduitM)
import Data.Domain
import Data.Handle (Handle)
Expand All @@ -77,12 +78,15 @@ import Data.Time (addUTCTime)
import Data.UUID.V4
import Imports
import Polysemy
import Polysemy.TinyLog
import System.Logger (msg, val)
import Wire.API.Password
import Wire.API.Provider.Service
import Wire.API.Team.Feature
import Wire.API.User
import Wire.API.User.RichInfo
import Wire.HashPassword
import Wire.Sem.Logger qualified as Log

-- | Authentication errors.
data AuthError
Expand All @@ -109,7 +113,9 @@ data ReAuthError
-- fact that we're setting getting @mbHandle@ from table @"user"@, and when/if it was added
-- there, it was claimed properly.
newAccount ::
(Member HashPassword r) =>
( Member HashPassword r,
Member TinyLog r
) =>
NewUser ->
Maybe InvitationId ->
Maybe TeamId ->
Expand All @@ -124,6 +130,11 @@ newAccount u inv tid mbHandle = do
(Just (toUUID -> uuid), _) -> pure uuid
(_, Just uuid) -> pure uuid
(Nothing, Nothing) -> liftIO nextRandom
env <- ask
_ <-
liftSem $
Log.warn $
msg (val $ "New account with hash opts: " <> (BS.pack . show $ env.settings.passwordHashingOptions))
passwd <- maybe (pure Nothing) (fmap Just . liftSem . hashPassword8) pass
expiry <- case status of
Ephemeral -> do
Expand Down
2 changes: 1 addition & 1 deletion services/brig/src/Brig/Provider/API.hs
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ newAccount new = do
_ <-
lift . liftSem $
Log.warn $
msg (val $ "New account with hash opts: " <> (BS.pack . show $ env.settings.passwordHashingOptions))
msg (val $ "New provider account with hash opts: " <> (BS.pack . show $ env.settings.passwordHashingOptions))
wrapClientE (DB.lookupKey emailKey) >>= mapM_ (const $ throwStd emailExists)
(safePass, newPass) <- case pass of
Just newPass -> do
Expand Down

0 comments on commit ba549eb

Please sign in to comment.