fix: reconnect to a passwordless server without a token

The stored connection remembers that no password was set, but the
reconnect path still required a device token and asked for the password.
Reconnect without one when the server issued none.
This commit is contained in:
blumia committed 2026-11-16 10:41:04 +08:00
1 parent 23f72fc46d
commit ef0b63ceee
2 files changed
+23 -5

No files matched your search

+10 -5
View File
@@ -148,17 +148,22 @@ func (c *controller) connect() {
// reconnect retries a stored connection, whose token lives in secure
// storage (readable only off the main thread).
func (c *controller) reconnect(conn storage.Connection) {
params := connectParams{
url: conn.URL,
proxy: conn.Proxy,
insecure: conn.Insecure,
}
if conn.Passwordless {
// No token was issued; the server answers without one.
go func() { c.establish(params, "") }()
return
}
go func() {
token, ok, err := c.st.LoadToken(conn.URL)
if err != nil || !ok {
ui.Post(func() { c.status.Set("请重新输入密码") })
return
}
params := connectParams{
url: conn.URL,
proxy: conn.Proxy,
insecure: conn.Insecure,
}
c.establish(params, token)
}()
}