Is there a way to create a blacklist to disallow certain users from signing up by filter through their parameters during the registration process?
The idea is to prevent users that use displosable email addresses (e.g. 10minutemail) from signing up.
There is a gem for that:
https://github.com/lisinge/valid_email2
Install it and add:
validates :email, email: { mx: true, disposable: true }
Not sure of a gem but I think it's pretty simple to roll your own. Just place a before_filter that calls up a method :permitted?
You could use a table on the db or a yaml file depending on your needs. - Use yaml file if the contents are statics (also it's much faster)
in the permitted method check use a regex to check if it matches
def permitted?
config=YAML.load_file('file.yml')
config.each do |domain|
email.match(domain)
end
You can use different regex to do the matches
Here is JavaScript solution: https://github.com/AppBeat-io/JavaScript
Usage example:
AppBeat.Email.isDisposable('[email protected]'); //returns true
AppBeat.Email.isDisposable('[email protected]'); //returns true
AppBeat.Email.isDisposable(' [email protected] '); //returns true
AppBeat.Email.isDisposable('@mailinator.com'); //returns true
AppBeat.Email.isDisposable('mailinator.com'); //returns true
AppBeat.Email.isDisposable('unknown-domain.some-domain'); //returns false
AppBeat.Email.isDisposable('[email protected]'); //returns false
AppBeat.Email.isDisposable('[email protected]'); //returns false (whitelisted)
AppBeat.Email.isDisposable('[email protected]'); //returns false (whitelisted)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With