Skip to content

Commit

Permalink
Use updated, more lenient email matching
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeer committed Sep 15, 2016
1 parent 77dd08e commit d27bf85
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/concerns/blacklight/catalog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ def sms_mappings
def validate_email_params
if params[:to].blank?
flash[:error] = I18n.t('blacklight.email.errors.to.blank')
elsif !params[:to].match(defined?(Devise) ? Devise.email_regexp : /^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/)
elsif !params[:to].match(Blacklight::Engine.config.email_regexp)
flash[:error] = I18n.t('blacklight.email.errors.to.invalid', :to => params[:to])
end

Expand Down
2 changes: 2 additions & 0 deletions lib/blacklight/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,7 @@ class Engine < Rails::Engine
}

config.bookmarks_http_method = :post

config.email_regexp = defined?(Devise) ? Devise.email_regexp : /\A[^@\s]+@[^@\s]+\z/
end
end

0 comments on commit d27bf85

Please sign in to comment.