aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2023-08-18 20:58:02 +0200
committerRobin Jarry <robin@jarry.cc>2023-08-26 21:41:05 +0200
commitb89a380f4512f21341a80460cdbcee49367e13d3 (patch)
treef2b828b0083d2da33b5fee2e891927e0a0d817d1
parent412493ad10daddfd9cb82188e34dc4b73028422c (diff)
downloadaerc-b89a380f4512f21341a80460cdbcee49367e13d3.tar.gz
wizard: do not require full name
Allow users to omit their full name. Signed-off-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Tristan Partin <tristan@partin.io> Tested-by: Tim Culverhouse <tim@timculverhouse.com>
-rw-r--r--widgets/account-wizard.go15
1 files changed, 7 insertions, 8 deletions
diff --git a/widgets/account-wizard.go b/widgets/account-wizard.go
index 77ac5636..5a629dca 100644
--- a/widgets/account-wizard.go
+++ b/widgets/account-wizard.go
@@ -2,7 +2,6 @@ package widgets
import (
"errors"
- "fmt"
"net"
"net/url"
"os"
@@ -12,11 +11,13 @@ import (
"strings"
"sync"
+ "github.com/emersion/go-message/mail"
"github.com/gdamore/tcell/v2"
"github.com/go-ini/ini"
"github.com/kyoh86/xdg"
"git.sr.ht/~rjarry/aerc/config"
+ "git.sr.ht/~rjarry/aerc/lib/format"
"git.sr.ht/~rjarry/aerc/lib/ui"
"git.sr.ht/~rjarry/aerc/log"
)
@@ -409,11 +410,6 @@ func (wizard *AccountWizard) finish(tutorial bool) {
errors.New("Email address is required"))
return
}
- if wizard.fullName.String() == "" {
- wizard.errorFor(wizard.fullName,
- errors.New("Full name is required"))
- return
- }
if wizard.sourceServer.String() == "" {
wizard.errorFor(wizard.sourceServer,
errors.New("Email source configuration is required"))
@@ -441,8 +437,11 @@ func (wizard *AccountWizard) finish(tutorial bool) {
_, _ = sec.NewKey("source", wizard.sourceUrl.String())
_, _ = sec.NewKey("outgoing", wizard.outgoingUrl.String())
_, _ = sec.NewKey("default", "INBOX")
- _, _ = sec.NewKey("from", fmt.Sprintf("%s <%s>",
- wizard.fullName.String(), wizard.email.String()))
+ from := mail.Address{
+ Name: wizard.fullName.String(),
+ Address: wizard.email.String(),
+ }
+ _, _ = sec.NewKey("from", format.AddressForHumans(&from))
if wizard.outgoingCopyTo.String() != "" {
_, _ = sec.NewKey("copy-to", wizard.outgoingCopyTo.String())
}