summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKoni Marti <koni.marti@gmail.com>2022-08-08 22:14:56 +0200
committerRobin Jarry <robin@jarry.cc>2022-08-22 09:30:37 +0200
commitee961d3b1d5ef412b3daf0ef0b8c18ac8957b365 (patch)
treea4931a16bf1f613fee767990b909c250ce702398
parent5c8a749cfa97b3ad9184f0f80a7d5c7921e8c073 (diff)
downloadaerc-ee961d3b1d5ef412b3daf0ef0b8c18ac8957b365.tar.gz
aerc-ee961d3b1d5ef412b3daf0ef0b8c18ac8957b365.zip
wizard: add plaintext password warning
Warn users that the passwords are stored as plaintext. Add recommmendation to use personal password store. Implements: https://todo.sr.ht/~rjarry/aerc/39 Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
-rw-r--r--widgets/account-wizard.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/widgets/account-wizard.go b/widgets/account-wizard.go
index 3673ed1c..4856c608 100644
--- a/widgets/account-wizard.go
+++ b/widgets/account-wizard.go
@@ -10,6 +10,7 @@ import (
"path"
"strconv"
"strings"
+ "sync"
"github.com/gdamore/tcell/v2"
"github.com/go-ini/ini"
@@ -72,6 +73,21 @@ type AccountWizard struct {
complete []ui.Interactive
}
+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."
+ warning := NewSelectorDialog(
+ title, text, []string{"OK"}, 0,
+ aerc.SelectedAccountUiConfig(),
+ func(_ string, _ error) {
+ aerc.CloseDialog()
+ },
+ )
+ aerc.AddDialog(warning)
+}
+
func NewAccountWizard(conf *config.AercConfig, aerc *Aerc) *AccountWizard {
wizard := &AccountWizard{
accountName: ui.NewTextInput("", &conf.Ui).Prompt("> "),
@@ -119,10 +135,12 @@ func NewAccountWizard(conf *config.AercConfig, aerc *Aerc) *AccountWizard {
wizard.imapUri()
wizard.smtpUri()
})
+ var once sync.Once
wizard.imapPassword.OnChange(func(_ *ui.TextInput) {
wizard.smtpPassword.Set(wizard.imapPassword.String())
wizard.imapUri()
wizard.smtpUri()
+ once.Do(func() { showPasswordWarning(aerc) })
})
wizard.smtpServer.OnChange(func(_ *ui.TextInput) {
wizard.smtpUri()