provisioning/login: set timezone sooner

This commit is contained in:
Sumner Evans 2022-05-21 16:46:49 -06:00
parent f1a4cfe7d5
commit 32032161e2
No known key found for this signature in database
GPG key ID: 8904527AB50022FD

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"