Skip to content

Commit

Permalink
legacyprovision: fix starting without existing login
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Dec 13, 2024
1 parent f71ce20 commit d37b91f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cmd/mautrix-gmessages/legacyprovision.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,12 @@ func legacyProvGoogleLoginStart(w http.ResponseWriter, r *http.Request) {
return
}
login := exerrors.Must(m.Connector.CreateLogin(r.Context(), user, connector.LoginFlowIDGoogle))
nextStep := exerrors.Must(login.(bridgev2.LoginProcessWithOverride).StartWithOverride(r.Context(), existingLogin))
var nextStep *bridgev2.LoginStep
if existingLogin != nil {
nextStep = exerrors.Must(login.(bridgev2.LoginProcessWithOverride).StartWithOverride(r.Context(), existingLogin))
} else {
nextStep = exerrors.Must(login.Start(r.Context()))
}
if nextStep.StepID != connector.LoginStepIDGoogle {
log.Warn().Str("step_id", nextStep.StepID).Msg("Unexpected step after starting login")
jsonResponse(w, http.StatusInternalServerError, Error{
Expand Down

0 comments on commit d37b91f

Please sign in to comment.