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:
1 parent
23f72fc46d
commit
ef0b63ceee
2 files changed
+23
-5
No files matched your search
+10
-5
@@ -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)
|
||||
}()
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user