mirror of
https://github.com/directorz/mailfull-go.git
synced 2025-12-17 17:47:04 +00:00
Merge pull request #41 from directorz/feature/fix_removed_user
Feature/fix removed user
This commit is contained in:
3
user.go
3
user.go
@@ -100,6 +100,9 @@ func (r *Repository) Users(domainName string) ([]*User, error) {
|
|||||||
|
|
||||||
forwards, err := r.userForwards(domainName, name)
|
forwards, err := r.userForwards(domainName, name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if err == ErrInvalidUserName {
|
||||||
|
continue
|
||||||
|
}
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
8
valid.go
8
valid.go
@@ -33,20 +33,20 @@ func validAliasDomainTarget(target string) bool {
|
|||||||
|
|
||||||
// validUserName returns true if the input is correct format.
|
// validUserName returns true if the input is correct format.
|
||||||
func validUserName(name string) bool {
|
func validUserName(name string) bool {
|
||||||
return regexp.MustCompile(`^[^\s@]+$`).MatchString(name)
|
return regexp.MustCompile(`^[^\.\s@][^\s@]+$`).MatchString(name)
|
||||||
}
|
}
|
||||||
|
|
||||||
// validAliasUserName returns true if the input is correct format.
|
// validAliasUserName returns true if the input is correct format.
|
||||||
func validAliasUserName(name string) bool {
|
func validAliasUserName(name string) bool {
|
||||||
return regexp.MustCompile(`^[^\s@]+$`).MatchString(name)
|
return regexp.MustCompile(`^[^\.\s@][^\s@]+$`).MatchString(name)
|
||||||
}
|
}
|
||||||
|
|
||||||
// validAliasUserTarget returns true if the input is correct format.
|
// validAliasUserTarget returns true if the input is correct format.
|
||||||
func validAliasUserTarget(target string) bool {
|
func validAliasUserTarget(target string) bool {
|
||||||
return regexp.MustCompile(`^[^\s@]+@([A-Za-z0-9\-]+\.)*[A-Za-z]+$`).MatchString(target)
|
return regexp.MustCompile(`^[^\.\s@][^\s@]+@([A-Za-z0-9\-]+\.)*[A-Za-z]+$`).MatchString(target)
|
||||||
}
|
}
|
||||||
|
|
||||||
// validCatchAllUserName returns true if the input is correct format.
|
// validCatchAllUserName returns true if the input is correct format.
|
||||||
func validCatchAllUserName(name string) bool {
|
func validCatchAllUserName(name string) bool {
|
||||||
return regexp.MustCompile(`^[^\s@]+$`).MatchString(name)
|
return regexp.MustCompile(`^[^\.\s@][^\s@]+$`).MatchString(name)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user