Add legacy remote credential migration notices

This commit is contained in:
Joe Julian
2026-04-06 17:31:58 -07:00
parent 8b4f3f91be
commit 03ea224773
2 changed files with 79 additions and 0 deletions
+25
View File
@@ -159,8 +159,11 @@ type recentRemoteRecord struct {
LocalVaultPath string `json:"localVaultPath,omitempty"`
RemoteProfileID string `json:"remoteProfileId,omitempty"`
CredentialEntryID string `json:"credentialEntryId,omitempty"`
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"`
LastGroup []string `json:"lastGroup,omitempty"`
UsedAt string `json:"usedAt,omitempty"`
NeedsMigration bool `json:"-"`
}
type uiPreferences struct {
@@ -668,6 +671,9 @@ func newUIWithState(mode string, sess appstate.CurrentSession, paths statePaths)
u.setCustomFieldRows(nil)
u.loadRecentVaults()
u.loadRecentRemotes()
if u.hasLegacyRecentRemoteCredentialMigration() {
u.showStatusMessage("Some saved remote sign-ins came from an older KeePassGO build. Reopen those remotes and save them in the vault to migrate them.")
}
u.consumePendingSharedVaultImport()
u.restoreStartupLifecycleTarget()
u.requestMasterPassFocus = u.hasSelectedLifecycleTarget()
@@ -1695,9 +1701,16 @@ func (u *ui) loadRecentRemotes() {
record.LocalVaultPath = strings.TrimSpace(record.LocalVaultPath)
record.RemoteProfileID = strings.TrimSpace(record.RemoteProfileID)
record.CredentialEntryID = strings.TrimSpace(record.CredentialEntryID)
record.Username = strings.TrimSpace(record.Username)
record.Password = strings.TrimSpace(record.Password)
if record.BaseURL == "" || record.Path == "" {
continue
}
if record.Username != "" || record.Password != "" {
record.NeedsMigration = true
record.Username = ""
record.Password = ""
}
key := record.BaseURL + "|" + record.Path
if seen[key] {
continue
@@ -1715,6 +1728,15 @@ func (u *ui) loadRecentRemotes() {
}
}
func (u *ui) hasLegacyRecentRemoteCredentialMigration() bool {
for _, record := range u.recentRemotes {
if record.NeedsMigration {
return true
}
}
return false
}
func (u *ui) saveRecentVaults() {
if strings.TrimSpace(u.recentVaultsPath) == "" {
return
@@ -2092,6 +2114,9 @@ func (u *ui) applyRecentRemoteRecord(record recentRemoteRecord) {
u.selectedVaultRemoteCredentialEntryID = strings.TrimSpace(record.CredentialEntryID)
u.remotePassword.Mask = '•'
u.selectedRemoteConnection = true
if record.NeedsMigration && strings.TrimSpace(record.RemoteProfileID) == "" && strings.TrimSpace(record.CredentialEntryID) == "" {
u.showStatusMessage("This saved remote came from an older local-sign-in format. Open it again, then save the remote in the vault to migrate it.")
}
}
func (u *ui) remotePreferencesCurrentSummary() string {