Merge pull request #501 from mautrix/sumner/bri-3528

provisioning/login: set timezone sooner
This commit is contained in:
Sumner Evans 2022-05-22 08:44:54 -06:00 committed by GitHub
commit 9a10240293
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -619,6 +619,11 @@ func (prov *ProvisioningAPI) Login(w http.ResponseWriter, r *http.Request) {
return nil
})
if userTimezone := r.URL.Query().Get("tz"); userTimezone != "" {
user.Timezone = userTimezone
user.Update()
}
qrChan, err := user.Login(ctx)
if err != nil {
user.log.Errorln("Failed to log in from provisioning API:", err)
@ -652,11 +657,6 @@ func (prov *ProvisioningAPI) Login(w http.ResponseWriter, r *http.Request) {
"phone": fmt.Sprintf("+%s", jid.User),
"platform": user.Client.Store.Platform,
})
if userTimezone := r.URL.Query().Get("tz"); userTimezone != "" {
user.Timezone = userTimezone
user.Update()
}
case whatsmeow.QRChannelTimeout.Event:
user.log.Debugln("Login via provisioning API timed out")
errCode := "login timed out"