fix(tui): default SMTP port to 465 in the account form
NewAccountForm prefilled defaults for mode, IMAP port, and both securities but left SMTP port blank. Default it to 465 to match `account add --smtp-port`. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -203,6 +203,9 @@ func NewAccountForm(initial Fields, editing bool) AccountForm {
|
||||
if initial.IMAPSecurity == "" {
|
||||
initial.IMAPSecurity = "tls"
|
||||
}
|
||||
if initial.SMTPPort == "" {
|
||||
initial.SMTPPort = "465"
|
||||
}
|
||||
if initial.SMTPSecurity == "" {
|
||||
initial.SMTPSecurity = "tls"
|
||||
}
|
||||
|
||||
@@ -111,6 +111,17 @@ func TestFieldsFromAccountRoundTrip(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestNewAccountFormDefaultsSMTPPort(t *testing.T) {
|
||||
f := NewAccountForm(Fields{}, false).collect()
|
||||
if f.SMTPPort != "465" {
|
||||
t.Fatalf("SMTP port should default to 465, got %q", f.SMTPPort)
|
||||
}
|
||||
// The other prefilled defaults must remain intact.
|
||||
if f.IMAPPort != "993" || f.Mode != "RO" || f.IMAPSecurity != "tls" || f.SMTPSecurity != "tls" {
|
||||
t.Fatalf("existing defaults regressed: %+v", f)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAccountFormSubmitValid(t *testing.T) {
|
||||
m := NewAccountForm(validFields(), false)
|
||||
// Enter submits; with valid fields the form completes.
|
||||
|
||||
Reference in New Issue
Block a user