Keep remote form open during manual entry
This commit is contained in:
@@ -432,6 +432,7 @@ type ui struct {
|
|||||||
syncDialogOpen bool
|
syncDialogOpen bool
|
||||||
syncMenuOpen bool
|
syncMenuOpen bool
|
||||||
mainMenuOpen bool
|
mainMenuOpen bool
|
||||||
|
selectedRemoteConnection bool
|
||||||
securityDialogOpen bool
|
securityDialogOpen bool
|
||||||
remotePrefsDialogOpen bool
|
remotePrefsDialogOpen bool
|
||||||
showSyncPassword bool
|
showSyncPassword bool
|
||||||
@@ -1779,7 +1780,7 @@ func (u *ui) hasSelectedLifecycleTarget() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (u *ui) hasSelectedRemoteTarget() bool {
|
func (u *ui) hasSelectedRemoteTarget() bool {
|
||||||
return strings.TrimSpace(u.remoteBaseURL.Text()) != "" && strings.TrimSpace(u.remotePath.Text()) != ""
|
return u.selectedRemoteConnection
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *ui) latestRecentVault() (string, time.Time) {
|
func (u *ui) latestRecentVault() (string, time.Time) {
|
||||||
@@ -1830,6 +1831,7 @@ func (u *ui) switchToLifecycleSelection(mode string) {
|
|||||||
u.remoteUsername.SetText("")
|
u.remoteUsername.SetText("")
|
||||||
u.remotePassword.SetText("")
|
u.remotePassword.SetText("")
|
||||||
u.rememberRemoteAuth.Value = false
|
u.rememberRemoteAuth.Value = false
|
||||||
|
u.selectedRemoteConnection = false
|
||||||
default:
|
default:
|
||||||
u.vaultPath.SetText("")
|
u.vaultPath.SetText("")
|
||||||
u.remoteBaseURL.SetText("")
|
u.remoteBaseURL.SetText("")
|
||||||
@@ -1837,6 +1839,7 @@ func (u *ui) switchToLifecycleSelection(mode string) {
|
|||||||
u.remoteUsername.SetText("")
|
u.remoteUsername.SetText("")
|
||||||
u.remotePassword.SetText("")
|
u.remotePassword.SetText("")
|
||||||
u.rememberRemoteAuth.Value = false
|
u.rememberRemoteAuth.Value = false
|
||||||
|
u.selectedRemoteConnection = false
|
||||||
}
|
}
|
||||||
u.requestMasterPassFocus = u.hasSelectedLifecycleTarget()
|
u.requestMasterPassFocus = u.hasSelectedLifecycleTarget()
|
||||||
u.filter()
|
u.filter()
|
||||||
@@ -1885,6 +1888,7 @@ func (u *ui) applyRecentRemoteRecord(record recentRemoteRecord) {
|
|||||||
u.remotePassword.SetText(record.Password)
|
u.remotePassword.SetText(record.Password)
|
||||||
u.remotePassword.Mask = '•'
|
u.remotePassword.Mask = '•'
|
||||||
u.rememberRemoteAuth.Value = strings.TrimSpace(record.Username) != "" || record.Password != ""
|
u.rememberRemoteAuth.Value = strings.TrimSpace(record.Username) != "" || record.Password != ""
|
||||||
|
u.selectedRemoteConnection = true
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *ui) remotePreferencesCurrentSummary() string {
|
func (u *ui) remotePreferencesCurrentSummary() string {
|
||||||
@@ -3050,6 +3054,7 @@ func (u *ui) layout(gtx layout.Context) layout.Dimensions {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
u.lifecycleMode = "remote"
|
u.lifecycleMode = "remote"
|
||||||
|
u.selectedRemoteConnection = false
|
||||||
u.requestMasterPassFocus = true
|
u.requestMasterPassFocus = true
|
||||||
}
|
}
|
||||||
for u.toggleLifecycleAdvanced.Clicked(gtx) {
|
for u.toggleLifecycleAdvanced.Clicked(gtx) {
|
||||||
@@ -3247,6 +3252,7 @@ func (u *ui) layout(gtx layout.Context) layout.Dimensions {
|
|||||||
u.switchToLifecycleSelection("remote")
|
u.switchToLifecycleSelection("remote")
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
u.selectedRemoteConnection = false
|
||||||
u.remoteBaseURL.SetText("")
|
u.remoteBaseURL.SetText("")
|
||||||
u.remotePath.SetText("")
|
u.remotePath.SetText("")
|
||||||
u.remoteUsername.SetText("")
|
u.remoteUsername.SetText("")
|
||||||
|
|||||||
+29
-1
@@ -4421,8 +4421,16 @@ func TestShowRemoteConnectionChooser(t *testing.T) {
|
|||||||
|
|
||||||
u.remoteBaseURL.SetText("https://dav.crew.example.invalid")
|
u.remoteBaseURL.SetText("https://dav.crew.example.invalid")
|
||||||
u.remotePath.SetText("vaults/bellagio.kdbx")
|
u.remotePath.SetText("vaults/bellagio.kdbx")
|
||||||
|
if got := u.showRemoteConnectionChooser(); !got {
|
||||||
|
t.Fatal("showRemoteConnectionChooser() = false, want true while manually entering a remote connection")
|
||||||
|
}
|
||||||
|
|
||||||
|
u.applyRecentRemoteRecord(recentRemoteRecord{
|
||||||
|
BaseURL: "https://dav.crew.example.invalid",
|
||||||
|
Path: "vaults/bellagio.kdbx",
|
||||||
|
})
|
||||||
if got := u.showRemoteConnectionChooser(); got {
|
if got := u.showRemoteConnectionChooser(); got {
|
||||||
t.Fatal("showRemoteConnectionChooser() = true, want false when a remote connection is selected")
|
t.Fatal("showRemoteConnectionChooser() = true, want false after selecting a saved remote connection")
|
||||||
}
|
}
|
||||||
|
|
||||||
u.lifecycleMode = "local"
|
u.lifecycleMode = "local"
|
||||||
@@ -4431,6 +4439,26 @@ func TestShowRemoteConnectionChooser(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestApplyingRecentRemoteRecordMarksSelectedRemoteConnection(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
|
u := newUIWithSession("desktop", &session.Manager{})
|
||||||
|
if u.hasSelectedRemoteTarget() {
|
||||||
|
t.Fatal("hasSelectedRemoteTarget() = true, want false before selecting a saved remote connection")
|
||||||
|
}
|
||||||
|
|
||||||
|
u.applyRecentRemoteRecord(recentRemoteRecord{
|
||||||
|
BaseURL: "https://dav.crew.example.invalid",
|
||||||
|
Path: "vaults/bellagio.kdbx",
|
||||||
|
Username: "dannyocean",
|
||||||
|
Password: "topsecret",
|
||||||
|
})
|
||||||
|
|
||||||
|
if !u.hasSelectedRemoteTarget() {
|
||||||
|
t.Fatal("hasSelectedRemoteTarget() = false, want true after selecting a saved remote connection")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestSwitchToLifecycleSelectionResetsLockedLocalSession(t *testing.T) {
|
func TestSwitchToLifecycleSelectionResetsLockedLocalSession(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user