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>
This commit is contained in:
parent
5c8a749cfa
commit
ee961d3b1d
1 changed files with 18 additions and 0 deletions
|
@ -10,6 +10,7 @@ import (
|
||||||
"path"
|
"path"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
"sync"
|
||||||
|
|
||||||
"github.com/gdamore/tcell/v2"
|
"github.com/gdamore/tcell/v2"
|
||||||
"github.com/go-ini/ini"
|
"github.com/go-ini/ini"
|
||||||
|
@ -72,6 +73,21 @@ type AccountWizard struct {
|
||||||
complete []ui.Interactive
|
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 {
|
func NewAccountWizard(conf *config.AercConfig, aerc *Aerc) *AccountWizard {
|
||||||
wizard := &AccountWizard{
|
wizard := &AccountWizard{
|
||||||
accountName: ui.NewTextInput("", &conf.Ui).Prompt("> "),
|
accountName: ui.NewTextInput("", &conf.Ui).Prompt("> "),
|
||||||
|
@ -119,10 +135,12 @@ func NewAccountWizard(conf *config.AercConfig, aerc *Aerc) *AccountWizard {
|
||||||
wizard.imapUri()
|
wizard.imapUri()
|
||||||
wizard.smtpUri()
|
wizard.smtpUri()
|
||||||
})
|
})
|
||||||
|
var once sync.Once
|
||||||
wizard.imapPassword.OnChange(func(_ *ui.TextInput) {
|
wizard.imapPassword.OnChange(func(_ *ui.TextInput) {
|
||||||
wizard.smtpPassword.Set(wizard.imapPassword.String())
|
wizard.smtpPassword.Set(wizard.imapPassword.String())
|
||||||
wizard.imapUri()
|
wizard.imapUri()
|
||||||
wizard.smtpUri()
|
wizard.smtpUri()
|
||||||
|
once.Do(func() { showPasswordWarning(aerc) })
|
||||||
})
|
})
|
||||||
wizard.smtpServer.OnChange(func(_ *ui.TextInput) {
|
wizard.smtpServer.OnChange(func(_ *ui.TextInput) {
|
||||||
wizard.smtpUri()
|
wizard.smtpUri()
|
||||||
|
|
Loading…
Reference in a new issue