sanitize user emails for marketing partners
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin
lib
.gitignore
.travis.yml
Gemfile
LICENSE.txt
README.md
Rakefile
partner_friendly.gemspec

README.md

PartnerFriendly

Are you a marketer? PartnerFriendly is for you.

When savvy users register for applications, they append their email with strings like "+yourapp" preceding their domain.

Users do this to identify your organization if they receive unsolicited email from one of your marketing partners, such as a co-branded newsletter.

PartnerFriendly neutralizes this issue by removing such identifiers, transforming

Before Validation ---> After Validation

upon entry to your database.

Installation

Add to your application's Gemfile:

gem 'partner_friendly'

Then execute:

$ bundle

Or install it yourself as:

$ gem install partner_friendly

Usage

In your User model, add:

...
    before_validation :clean
...
    def clean
        PartnerFriendly::Process.clean(self)
    end

FAQ

The user may try to trick the system with multiple identifiers,

Multiple Identifier Example

however this just yields:

After Validation

ProTip: opting for before_save or before_create instead of before_validation may throw a nasty database error:

PG Unique Violation

In this case, simply rescue from the error with a redirect or existing authentication flash for "user already exists."

Contributing

Bug reports and pull requests are welcome.

  1. Fork it ( http://github.com/ryanckulp/partnerfriendly/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

License

The gem is available as open source under the terms of the MIT License.