Skip to content

armgit / fider

Public Imported from GitHub
0

Open platform to collect and prioritize feedback

fix: unencrypted smtp login

goenningd8536f1f3611
diff --git a/app/handlers/signup.go b/app/handlers/signup.go
index 38f5a966e..e9f7865a2 100644
--- a/app/handlers/signup.go
+++ b/app/handlers/signup.go
@@ -117,9 +117,9 @@ func CreateTenant() web.HandlerFunc {
c.Enqueue(tasks.SendSignUpEmail(action, siteURL))
}
- if status == enum.TenantActive && user.Email != "" {
- c.Enqueue(tasks.SendWelcomeEmail(user.Name, user.Email, siteURL))
- }
+ // if status == enum.TenantActive && user.Email != "" {
+ // c.Enqueue(tasks.SendWelcomeEmail(user.Name, user.Email, siteURL))
+ // }
return c.Ok(web.Map{})
}
diff --git a/app/handlers/signup_test.go b/app/handlers/signup_test.go
index 4f3666118..191593ecd 100644
--- a/app/handlers/signup_test.go
+++ b/app/handlers/signup_test.go
@@ -133,6 +133,12 @@ func TestCreateTenantHandler_WithSocialAccount(t *testing.T) {
var newTenant *cmd.CreateTenant
bus.AddHandler(func(ctx context.Context, c *cmd.CreateTenant) error {
newTenant = c
+ c.Result = &entity.Tenant{
+ ID: 1,
+ Name: c.Name,
+ Subdomain: c.Subdomain,
+ Status: enum.TenantActive,
+ }
return nil
})
diff --git a/app/services/email/smtp/auth.go b/app/services/email/smtp/auth.go
index d3b2e72c0..d3a3d2e91 100644
--- a/app/services/email/smtp/auth.go
+++ b/app/services/email/smtp/auth.go
@@ -11,20 +11,17 @@ type agnosticAuth struct {
auth gosmtp.Auth
}
-func (a *agnosticAuth) FindAuth(server *gosmtp.ServerInfo) gosmtp.Auth {
- for _, auth := range server.Auth {
- switch auth {
- case "LOGIN":
- return LoginAuth(a.username, a.password)
- case "PLAIN":
- return gosmtp.PlainAuth(a.identity, a.username, a.password, a.host)
- case "CRAM-MD5":
- return gosmtp.CRAMMD5Auth(a.username, a.password)
- default:
- continue
- }
+func (a *agnosticAuth) createAuth(mode string) gosmtp.Auth {
+ switch mode {
+ case "LOGIN":
+ return LoginAuth(a.username, a.password)
+ case "PLAIN":
+ return gosmtp.PlainAuth(a.identity, a.username, a.password, a.host)
+ case "CRAM-MD5":
+ return gosmtp.CRAMMD5Auth(a.username, a.password)
+ default:
+ return nil
}
- return nil
}
// AgnosticAuth returns an Auth that match the correct authentication
@@ -34,11 +31,19 @@ func AgnosticAuth(identity, username, password, host string) gosmtp.Auth {
}
func (a *agnosticAuth) Start(server *gosmtp.ServerInfo) (string, []byte, error) {
- a.auth = a.FindAuth(server)
- if a.auth != nil {
- return a.auth.Start(server)
+ for _, auth := range server.Auth {
+ a.auth = a.createAuth(auth)
+ if a.auth == nil {
+ continue
+ }
+
+ proto, toServer, err := a.auth.Start(server)
+ if err == nil {
+ return proto, toServer, err
+ }
}
- return "", nil, errors.New("server auth mechanism not supported")
+
+ return "", nil, errors.New("could not find any suitable auth mechanism")
}
func (a *agnosticAuth) Next(fromServer []byte, more bool) ([]byte, error) {