generated from ali/HarmonyTemplate
fix: re-fetch host from DB before connecting so persisted password applies
persistPassword writes the DB directly; ConnectionsPage keeps a long-lived in-memory host list, so reconnects used a stale passwordEnc=null copy and prompted again despite 'remember password'. connectHost now re-reads the host profile before building ConnectSpec. Verified E2E: tick remember -> connect -> READY -> close -> reconnect goes straight to READY (no prompt), command execution verified (PW-FREE-OK).
This commit is contained in:
@@ -124,6 +124,25 @@ export struct ConnectionsPage {
|
||||
}
|
||||
|
||||
private connectHost(host: HostProfile): void {
|
||||
this.launchFromDb(host.id, host);
|
||||
}
|
||||
|
||||
/**
|
||||
* Re-fetch the host from the DB before connecting so a password persisted
|
||||
* by an earlier session (persistPassword writes the DB, not this page's
|
||||
* in-memory list) is picked up without requiring a page reload.
|
||||
*/
|
||||
private async launchFromDb(id: number, fallback: HostProfile): Promise<void> {
|
||||
let host: HostProfile = fallback;
|
||||
try {
|
||||
const repo: HostRepository = await this.ensureRepo();
|
||||
const fresh: HostProfile | null = await repo.getById(id);
|
||||
if (fresh !== null) {
|
||||
host = fresh;
|
||||
}
|
||||
} catch (e) {
|
||||
// Fall back to the in-memory copy on any DB hiccup.
|
||||
}
|
||||
this.launch(specFromHost(host));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user