Explorar o código

[GIN] Remove old email block function

Achilleas Koutsou %!s(int64=4) %!d(string=hai) anos
pai
achega
1f17e672a0
Modificáronse 2 ficheiros con 0 adicións e 29 borrados
  1. 0 25
      internal/db/db_gin.go
  2. 0 4
      internal/db/user.go

+ 0 - 25
internal/db/db_gin.go

@@ -229,31 +229,6 @@ func isAddressAllowed(email string) bool {
 	return true
 }
 
-func IsBlockedDomain(email string) bool {
-	fpath := path.Join(setting.CustomPath, "blocklist")
-	if !com.IsExist(fpath) {
-		return false
-	}
-
-	f, err := os.Open(fpath)
-	if err != nil {
-		log.Error(2, "Failed to open file %q: %v", fpath, err)
-		return false
-	}
-	defer f.Close()
-
-	scanner := bufio.NewScanner(f)
-	for scanner.Scan() {
-		// Check provided email address against each line as suffix
-		if strings.HasSuffix(email, scanner.Text()) {
-			log.Trace("New user email matched blocked domain: %q", email)
-			return true
-		}
-	}
-
-	return false
-}
-
 func (u *User) OldGinVerifyPassword(plain string) bool {
 	err := bcrypt.CompareHashAndPassword([]byte(u.Passwd), []byte(plain))
 	return err == nil

+ 0 - 4
internal/db/user.go

@@ -555,10 +555,6 @@ func CreateUser(u *User) (err error) {
 		return ErrEmailAlreadyUsed{u.Email}
 	}
 
-	if IsBlockedDomain(u.Email) {
-		return ErrBlockedDomain{u.Email}
-	}
-
 	if !isAddressAllowed(u.Email) {
 		return ErrBlockedDomain{u.Email}
 	}