Created
September 14, 2015 11:49
-
-
Save denstepa/491c9991054e4be778f1 to your computer and use it in GitHub Desktop.
rails - stop dots abuseing in emails
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def no_dots_email_abuse | |
if User.where("(regexp_replace(users.email, '\\.', '', 'gi') LIKE ?)", email.gsub('.', '')).any? | |
errors.add(:email, 'is already taken. Please try another email.') | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment