Skip to content

Commit

Permalink
messagetracking: add detection of 2fa setup required error
Browse files Browse the repository at this point in the history
Signed-off-by: Sumner Evans <[email protected]>
  • Loading branch information
sumnerevans committed Apr 30, 2024
1 parent 9af0d73 commit 930da0a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions messagetracking.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,16 @@ func (portal *Portal) sendMessageMetrics(evt *event.Event, err error, part strin
level = log.LevelDebug
}
portal.log.Logfln(level, "%s %s %s from %s: %v", part, msgType, evtDescription, evt.Sender, err)

// Detect two_factor_setup_required errors and also set the user's
// state to BAD_CREDENTIALS.
if err.Error() == "two_factor_setup_required" {
portal.bridge.SendBridgeState(context.TODO(), &status.BridgeState{
StateEvent: status.StateBadCredentials,
Reason: err.Error(),
})
}

reason, statusCode, isCertain, sendNotice, _ := errorToStatusReason(err)
checkpointStatus := status.ReasonToCheckpointStatus(reason, statusCode)
portal.bridge.SendMessageCheckpoint(evt, status.MsgStepRemote, err, checkpointStatus, ms.getRetryNum())
Expand Down

0 comments on commit 930da0a

Please sign in to comment.