summaryrefslogtreecommitdiffstats
path: root/services/auth/source/smtp/auth.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2021-11-24 17:49:20 +0800
committerGitHub <noreply@github.com>2021-11-24 17:49:20 +0800
commita666829a37be6f9fd98f9e7dd1767c420f7f3b32 (patch)
tree9ab1434b759a8a2cb275a83149903a823851e309 /services/auth/source/smtp/auth.go
parent4e7ca946da2a2642a62f114825129bf5d7ed9196 (diff)
downloadgitea-a666829a37be6f9fd98f9e7dd1767c420f7f3b32.tar.gz
gitea-a666829a37be6f9fd98f9e7dd1767c420f7f3b32.zip
Move user related model into models/user (#17781)
* Move user related model into models/user * Fix lint for windows * Fix windows lint * Fix windows lint * Move some tests in models * Merge
Diffstat (limited to 'services/auth/source/smtp/auth.go')
-rw-r--r--services/auth/source/smtp/auth.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/services/auth/source/smtp/auth.go b/services/auth/source/smtp/auth.go
index d797982da1..c5bd09b0a7 100644
--- a/services/auth/source/smtp/auth.go
+++ b/services/auth/source/smtp/auth.go
@@ -6,13 +6,12 @@ package smtp
import (
"crypto/tls"
+ "errors"
"fmt"
"net"
"net/smtp"
"os"
"strconv"
-
- "code.gitea.io/gitea/models"
)
// _________ __________________________
@@ -52,6 +51,11 @@ const (
// Authenticators contains available SMTP authentication type names.
var Authenticators = []string{PlainAuthentication, LoginAuthentication, CRAMMD5Authentication}
+var (
+ // ErrUnsupportedLoginType login source is unknown error
+ ErrUnsupportedLoginType = errors.New("Login source is unknown")
+)
+
// Authenticate performs an SMTP authentication.
func Authenticate(a smtp.Auth, source *Source) error {
tlsConfig := &tls.Config{
@@ -101,5 +105,5 @@ func Authenticate(a smtp.Auth, source *Source) error {
return client.Auth(a)
}
- return models.ErrUnsupportedLoginType
+ return ErrUnsupportedLoginType
}