aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--commands/new-account.go1
-rw-r--r--lib/ui/tab.go6
-rw-r--r--widgets/account-wizard.go29
3 files changed, 20 insertions, 16 deletions
diff --git a/commands/new-account.go b/commands/new-account.go
index 2747b159..d67b5eca 100644
--- a/commands/new-account.go
+++ b/commands/new-account.go
@@ -32,6 +32,7 @@ func (NewAccount) Execute(aerc *widgets.Aerc, args []string) error {
wizard.ConfigureTemporaryAccount(true)
}
}
+ wizard.Focus(true)
aerc.NewTab(wizard, "New account")
return nil
}
diff --git a/lib/ui/tab.go b/lib/ui/tab.go
index b62764fb..6a5cbf50 100644
--- a/lib/ui/tab.go
+++ b/lib/ui/tab.go
@@ -157,6 +157,9 @@ func (tabs *Tabs) selectPriv(index int) bool {
if vis, ok := prev.Content.(Visible); ok {
vis.Show(false)
}
+ if vis, ok := prev.Content.(Interactive); ok {
+ vis.Focus(false)
+ }
tabs.pushHistory(tabs.curIndex)
}
tabs.curIndex = index
@@ -164,6 +167,9 @@ func (tabs *Tabs) selectPriv(index int) bool {
if vis, ok := next.Content.(Visible); ok {
vis.Show(true)
}
+ if vis, ok := next.Content.(Interactive); ok {
+ vis.Focus(true)
+ }
Invalidate()
}
return true
diff --git a/widgets/account-wizard.go b/widgets/account-wizard.go
index 8c9739e6..7fa371fc 100644
--- a/widgets/account-wizard.go
+++ b/widgets/account-wizard.go
@@ -11,7 +11,6 @@ import (
"strconv"
"strings"
"sync"
- "time"
"github.com/gdamore/tcell/v2"
"github.com/go-ini/ini"
@@ -19,7 +18,6 @@ import (
"git.sr.ht/~rjarry/aerc/config"
"git.sr.ht/~rjarry/aerc/lib/ui"
- "git.sr.ht/~rjarry/aerc/log"
)
const (
@@ -74,10 +72,16 @@ type AccountWizard struct {
}
func showPasswordWarning(aerc *Aerc) {
- title := "The Wizard will store your passwords in plaintext"
- text := "It is recommended to remove the plaintext passwords " +
- "and use your personal password store with " +
- "'source-cred-cmd' and 'outgoing-cred-cmd' after the setup."
+ title := "ATTENTION"
+ text := `
+The Wizard will store your passwords as clear text in:
+
+ ~/.config/aerc/accounts.conf
+
+It is recommended to remove the clear text passwords and configure
+'source-cred-cmd' and 'outgoing-cred-cmd' using your own password store
+after the setup.
+`
warning := NewSelectorDialog(
title, text, []string{"OK"}, 0,
aerc.SelectedAccountUiConfig(),
@@ -135,21 +139,14 @@ func NewAccountWizard(aerc *Aerc) *AccountWizard {
wizard.smtpUri()
})
var once sync.Once
- var lastChange time.Time
wizard.imapPassword.OnChange(func(_ *ui.TextInput) {
wizard.smtpPassword.Set(wizard.imapPassword.String())
wizard.imapUri()
wizard.smtpUri()
- lastChange = time.Now()
+ })
+ wizard.imapPassword.OnFocusLost(func(_ *ui.TextInput) {
once.Do(func() {
- // debounce to ensure pasted passwords are pasted completely
- go func() {
- defer log.PanicHandler()
- for !time.Now().After(lastChange.Add(10 * time.Millisecond)) {
- <-time.After(10 * time.Millisecond)
- }
- showPasswordWarning(aerc)
- }()
+ showPasswordWarning(aerc)
})
})
wizard.smtpServer.OnChange(func(_ *ui.TextInput) {