mirror of
https://github.com/muety/wakapi.git
synced 2023-08-10 21:12:56 +03:00
fix: include missing mail headers (resolve #472)
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
package models
|
||||
|
||||
import "regexp"
|
||||
import (
|
||||
"regexp"
|
||||
"strings"
|
||||
)
|
||||
|
||||
const (
|
||||
MailPattern = "[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\\.[a-zA-Z0-9-.]+"
|
||||
@@ -36,6 +39,14 @@ func (m MailAddress) Raw() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m MailAddress) Domain() string {
|
||||
split := strings.Split(m.Raw(), "@")
|
||||
if len(split) != 2 {
|
||||
return ""
|
||||
}
|
||||
return split[1]
|
||||
}
|
||||
|
||||
func (m MailAddress) Valid() bool {
|
||||
return emailAddrRegex.Match([]byte(m))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user