Skip to content

Commit

Permalink
add feature to restrict full email address not by domain
Browse files Browse the repository at this point in the history
  • Loading branch information
typester committed Aug 14, 2014
1 parent a265c9c commit 3b01529
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
3 changes: 2 additions & 1 deletion config_sample.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ auth:

# # restrict domain. (optional)
# domain:
# - yourdomain.com
# - yourdomain.com # restrict by domain
# - example@gmail.com # or specific address

# document root for static files
htdocs: ./
Expand Down
12 changes: 9 additions & 3 deletions httpd.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,15 @@ func restrictDomain(domain []string) martini.Handler {
var user *User
if len(domain) > 0 {
for _, d := range domain {
if strings.HasSuffix(email, "@"+d) {
user = &User{email}
break
if strings.Contains(d, "@") {
if d == email {
user = &User{email}
}
} else {
if strings.HasSuffix(email, "@"+d) {
user = &User{email}
break
}
}
}
} else {
Expand Down

0 comments on commit 3b01529

Please sign in to comment.