typoed_email_validator: add new endings to the typo list

This commit is contained in:
Georg Gadinger 2022-06-21 19:33:51 +02:00
parent 483c413796
commit c375775daa
2 changed files with 17 additions and 0 deletions

View File

@ -6,17 +6,23 @@ class TypoedEmailValidator < ActiveModel::EachValidator
# without @: # without @:
".con", ".con",
".coom", ".coom",
".cmo",
".mail", ".mail",
# with @: # with @:
*%w[ *%w[
fmail.com fmail.com
gail.com
gamil.com
gemail.com gemail.com
gmail.cm
gmail.co gmail.co
gmaile.com gmaile.com
gmaill.com gmaill.com
gmali.com gmali.com
hotamil.com
hotmaill.com hotmaill.com
iclooud.com
iclould.com iclould.com
icluod.com icluod.com
].map { "@#{_1}" } ].map { "@#{_1}" }

View File

@ -73,20 +73,31 @@ RSpec.describe User, type: :model do
include_examples "invalid email", "fritz.fantom@protonmail.con" include_examples "invalid email", "fritz.fantom@protonmail.con"
# neither is .coom # neither is .coom
include_examples "invalid email", "fritz.fantom@gmail.coom" include_examples "invalid email", "fritz.fantom@gmail.coom"
# nor .cmo
include_examples "invalid email", "gustav.geldsack@gmail.cmo"
# nor .mail (.email is, however) # nor .mail (.email is, however)
include_examples "invalid email", "fritz.fantom@proton.mail" include_examples "invalid email", "fritz.fantom@proton.mail"
# common typos: # common typos:
include_examples "invalid email", "fritz.fantom@fmail.com" include_examples "invalid email", "fritz.fantom@fmail.com"
include_examples "invalid email", "fritz.fantom@gamil.com"
include_examples "invalid email", "fritz.fantom@gemail.com" include_examples "invalid email", "fritz.fantom@gemail.com"
include_examples "invalid email", "fritz.fantom@gmail.cm"
include_examples "invalid email", "fritz.fantom@gmail.co" include_examples "invalid email", "fritz.fantom@gmail.co"
include_examples "invalid email", "fritz.fantom@gmailcom" include_examples "invalid email", "fritz.fantom@gmailcom"
include_examples "invalid email", "fritz.fantom@gmaile.com" include_examples "invalid email", "fritz.fantom@gmaile.com"
include_examples "invalid email", "fritz.fantom@gmaill.com" include_examples "invalid email", "fritz.fantom@gmaill.com"
include_examples "invalid email", "fritz.fantom@gmali.com" include_examples "invalid email", "fritz.fantom@gmali.com"
include_examples "invalid email", "fritz.fantom@hotamil.com"
include_examples "invalid email", "fritz.fantom@hotmailcom" include_examples "invalid email", "fritz.fantom@hotmailcom"
include_examples "invalid email", "fritz.fantom@hotmaill.com" include_examples "invalid email", "fritz.fantom@hotmaill.com"
include_examples "invalid email", "fritz.fantom@iclooud.com"
include_examples "invalid email", "fritz.fantom@iclould.com" include_examples "invalid email", "fritz.fantom@iclould.com"
include_examples "invalid email", "fritz.fantom@icluod.com" include_examples "invalid email", "fritz.fantom@icluod.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
# retrospring, feel free to open a PR that removes this ;-)
include_examples "invalid email", "fritz.fantom@gail.com"
# no TLD # no TLD
include_examples "invalid email", "fritz.fantom@gmail" include_examples "invalid email", "fritz.fantom@gmail"
include_examples "invalid email", "fritz.fantom@protonmail" include_examples "invalid email", "fritz.fantom@protonmail"