From a864b0e4853fb5248d61ff3dee68454004390ff4 Mon Sep 17 00:00:00 2001 From: Nai-Yuan Chen Date: Tue, 29 Nov 2016 11:24:50 +0800 Subject: [PATCH 1/2] update blacklist --- disposable_email_blacklist.conf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/disposable_email_blacklist.conf b/disposable_email_blacklist.conf index 4cda52d..d84a340 100644 --- a/disposable_email_blacklist.conf +++ b/disposable_email_blacklist.conf @@ -586,6 +586,7 @@ esprity.com etranquil.com etranquil.net etranquil.org +euaqa.com evanfox.info evopo.com example.com @@ -869,6 +870,7 @@ hungpackage.com huskion.net hvastudiesucces.nl hwsye.net +iaoss.com ibnuh.bz icantbelieveineedtoexplainthisshit.com icx.in From 4c6825ae9b4e40ac686e8b48c6e9cb0fb67b15ed Mon Sep 17 00:00:00 2001 From: Nai-Yuan Chen Date: Tue, 29 Nov 2016 14:39:54 +0800 Subject: [PATCH 2/2] README.md, add using example for ruby on rails --- README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/README.md b/README.md index f6f5500..0b43d5c 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,23 @@ function is_temp_mail($mail) { return in_array(explode('@', $mail)[1], $mail_domains_ko); } ``` +Ruby on Rails + +In resource model, usually it is `user.rb` +```Ruby +before_validation :reject_email_blacklist + +def reject_email_blacklist + blacklist = File.read('config/disposable_email_blacklist.conf').split("\n") + + if blacklist.include?(email.split('@')[1]) +    errors[:email] << 'invalid email' + return false + else + return true + end +end +``` Contributing ============