MM-11521/MM-11522 Fix being able to create users with invalid emails through API (#9199)
* MM-11522 Fix being able to create users with invalid emails through API * Ensure store tests are using valid emails * Add missing license header * Remove invalid test case * Fix TestUpdateOAuthUserAttrs
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
a8cc646eed
Коммит
c34b30a6e7
@@ -279,16 +279,18 @@ func IsLower(s string) bool {
|
||||
}
|
||||
|
||||
func IsValidEmail(email string) bool {
|
||||
|
||||
if !IsLower(email) {
|
||||
return false
|
||||
}
|
||||
|
||||
if _, err := mail.ParseAddress(email); err == nil {
|
||||
return true
|
||||
if addr, err := mail.ParseAddress(email); err != nil {
|
||||
return false
|
||||
} else if addr.Name != "" {
|
||||
// mail.ParseAddress accepts input of the form "Billy Bob <billy@example.com>" which we don't allow
|
||||
return false
|
||||
}
|
||||
|
||||
return false
|
||||
return true
|
||||
}
|
||||
|
||||
var reservedName = []string{
|
||||
|
||||
Ссылка в новой задаче
Block a user