hard match domains for automatic group membership
This commit is contained in:
parent
088260f053
commit
efd65dcc8c
|
@ -13,7 +13,7 @@ module Jobs
|
|||
|
||||
domains = group.automatic_membership_email_domains.gsub('.', '\.')
|
||||
|
||||
User.where("email ~* '@(#{domains})'").find_each do |user|
|
||||
User.where("email ~* '@(#{domains})$'").find_each do |user|
|
||||
group.add(user) rescue ActiveRecord::RecordNotUnique
|
||||
end
|
||||
end
|
||||
|
|
|
@ -721,7 +721,7 @@ class User < ActiveRecord::Base
|
|||
.where("LENGTH(COALESCE(automatic_membership_email_domains, '')) > 0")
|
||||
.each do |group|
|
||||
domains = group.automatic_membership_email_domains.gsub('.', '\.')
|
||||
if self.email =~ Regexp.new("@(#{domains})", true)
|
||||
if self.email =~ Regexp.new("@(#{domains})$", true)
|
||||
group.add(self) rescue ActiveRecord::RecordNotUnique
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue