From cb158c1facb6000ab5bc800b5edb801bc3ace362 Mon Sep 17 00:00:00 2001 From: Georg Gadinger Date: Sun, 14 Aug 2022 20:49:51 +0200 Subject: [PATCH] typoed_email_validator: add new endings to the typo list --- app/validators/typoed_email_validator.rb | 3 +++ spec/models/user_spec.rb | 3 +++ 2 files changed, 6 insertions(+) diff --git a/app/validators/typoed_email_validator.rb b/app/validators/typoed_email_validator.rb index 274b587b..3decc3e3 100644 --- a/app/validators/typoed_email_validator.rb +++ b/app/validators/typoed_email_validator.rb @@ -20,13 +20,16 @@ class TypoedEmailValidator < ActiveModel::EachValidator gmaile.com gmaill.com gmali.com + gnail.com hotamil.com hotmai.com hotmaill.com iclooud.com iclould.com icluod.com + xn--gmail-xk1c.com yahooo.com + ☺gmail.com ].map { "@#{_1}" } ].freeze diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 93aaa7f2..ab883a8f 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -87,6 +87,7 @@ RSpec.describe User, type: :model do include_examples "invalid email", "fritz.fantom@gmaile.com" include_examples "invalid email", "fritz.fantom@gmaill.com" include_examples "invalid email", "fritz.fantom@gmali.com" + include_examples "invalid email", "fritz.fantom@gnail.com" include_examples "invalid email", "fritz.fantom@hotamil.com" include_examples "invalid email", "fritz.fantom@hotmai.com" include_examples "invalid email", "fritz.fantom@hotmailcom" @@ -94,7 +95,9 @@ RSpec.describe User, type: :model do include_examples "invalid email", "fritz.fantom@iclooud.com" include_examples "invalid email", "fritz.fantom@iclould.com" include_examples "invalid email", "fritz.fantom@icluod.com" + include_examples "invalid email", "fritz.fantom@xn--gmail-xk1c.com" include_examples "invalid email", "fritz.fantom@yahooo.com" + include_examples "invalid email", "fritz.fantom@☺gmail.com" # gail.com would be a valid email address, but enough people typo it # # if you're the owner of that TLD and would like to use your email on