Skip to content

Supplying blacklist / whitelist domains from array vs yml file? #222

Open
@scouttyg

Description

@scouttyg

Hey there,

I've used this library quite a few times in the past, and even initially suggested the MX spam lookup trick (#95)

It's now a few years later, and I have a new suggestion -- allowing the blacklist / whitelist option to take an array vs a boolean.

E.g. right now we can do:

validates :email, 'valid_email_2/email': { blacklist: true } # This is the default behavior

But it would be really cool if we could do:

validates :email, 'valid_email_2/email': { blacklist: ["cool.com", "fun.com", etc...] }

This could then be used to support things like AR models, e.g.

validates :email, 'valid_email_2/email': { blacklist: proc { EmailPermissions.where(blacklist: true).pluck(:domain) } }

The benefit here is that with large websites, spammers target you quite often, and so if you need to commit and push an updated config/blacklisted_email_domains.yml every time, it's going to be quite painful. By having the default be the same, but being able to override the default to be more dynamic, you can have perhaps have the best of both worlds.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions