Skip to content

Commit d37b91f

Browse files
committed
legacyprovision: fix starting without existing login
1 parent f71ce20 commit d37b91f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

cmd/mautrix-gmessages/legacyprovision.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,12 @@ func legacyProvGoogleLoginStart(w http.ResponseWriter, r *http.Request) {
302302
return
303303
}
304304
login := exerrors.Must(m.Connector.CreateLogin(r.Context(), user, connector.LoginFlowIDGoogle))
305-
nextStep := exerrors.Must(login.(bridgev2.LoginProcessWithOverride).StartWithOverride(r.Context(), existingLogin))
305+
var nextStep *bridgev2.LoginStep
306+
if existingLogin != nil {
307+
nextStep = exerrors.Must(login.(bridgev2.LoginProcessWithOverride).StartWithOverride(r.Context(), existingLogin))
308+
} else {
309+
nextStep = exerrors.Must(login.Start(r.Context()))
310+
}
306311
if nextStep.StepID != connector.LoginStepIDGoogle {
307312
log.Warn().Str("step_id", nextStep.StepID).Msg("Unexpected step after starting login")
308313
jsonResponse(w, http.StatusInternalServerError, Error{

0 commit comments

Comments
 (0)