diff options
| author | horus_arch | 2015-03-21 14:22:13 +0100 |
|---|---|---|
| committer | horus_arch | 2015-03-21 14:22:13 +0100 |
| commit | a73dad2d4155699668ce14dc463913bb7892d3fc (patch) | |
| tree | 0d4e2c54184141d33d82ca4c60a2a3f0f8608c6b /server.go | |
| parent | fc0c1682b1753c5d02650d6a18671b67959065af (diff) | |
| download | freemail-a73dad2d4155699668ce14dc463913bb7892d3fc.tar.gz | |
Skip dns validation if the MX record points to the correct server. Bugfix: Displays now flash message on success.
Diffstat (limited to 'server.go')
| -rw-r--r-- | server.go | 16 |
1 files changed, 10 insertions, 6 deletions
@@ -8,7 +8,8 @@ import ( ) func CreateNewEntry(email, password string) error { - serverIP := os.Getenv("FREEMAIL_SMTP_MAILER_MX") + server := os.Getenv("FREEMAIL_SMTP_MAILER_MX") + if !ValidateEmail(email) { return errors.New("This doesn't look like a mail adress.") } @@ -22,11 +23,11 @@ func CreateNewEntry(email, password string) error { vD := VirtualDomain{} vD.Name = GetDomain(vU.Email) - if !vD.ValidateDomainMX(serverIP) { - return errors.New("The MX record doesn't point to this server.") - } - if !vD.ValidateDomain(serverIP) { - return errors.New("This doesn't look like a good domain. Host not found.") + // Checks for correct DNS + if !vD.ValidateDomainMX(server) { + if !vD.ValidateDomain(server) { + return errors.New("Neither the MX record nor the domain itself point to this server. Please fix your DNS.") + } } if !vD.DomainExists() { @@ -36,6 +37,9 @@ func CreateNewEntry(email, password string) error { } vU.DomainId = vD.GetPrimaryKey() + if vU.DomainId == 0 { + return errors.New("There was an error.") + } if !vU.CreateEmail() { return errors.New("There was an error.") |
