mirror of
https://github.com/grafana/grafana.git
synced 2024-11-30 20:54:22 -06:00
21 lines
339 B
Go
21 lines
339 B
Go
package social
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
)
|
|
|
|
func isEmailAllowed(email string, allowedDomains []string) bool {
|
|
if len(allowedDomains) == 0 {
|
|
return true
|
|
}
|
|
|
|
valid := false
|
|
for _, domain := range allowedDomains {
|
|
emailSuffix := fmt.Sprintf("@%s", domain)
|
|
valid = valid || strings.HasSuffix(email, emailSuffix)
|
|
}
|
|
|
|
return valid
|
|
}
|