From 776579ba5bbee3755764e9fd53ca6af55b76a4bc Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Thu, 22 Aug 2024 16:40:27 +0530 Subject: [PATCH] feat: enable disposable email check for account creation (#9989) This PR disallows usage of disposable emails when creating an account --------- Co-authored-by: Pranav --- Gemfile.lock | 6 +++--- app/builders/account_builder.rb | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index de348a2b5..1bd5f4f05 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -467,7 +467,7 @@ GEM mini_magick (4.12.0) mini_mime (1.1.5) mini_portile2 (2.8.7) - minitest (5.24.1) + minitest (5.25.1) mock_redis (0.36.0) ruby2_keywords msgpack (1.7.0) @@ -480,7 +480,7 @@ GEM uri net-http-persistent (4.0.2) connection_pool (~> 2.2) - net-imap (0.4.12) + net-imap (0.4.14) date net-protocol net-pop (0.1.2) @@ -796,7 +796,7 @@ GEM uniform_notifier (1.16.0) uri (0.13.0) uri_template (0.7.0) - valid_email2 (4.0.6) + valid_email2 (5.2.6) activemodel (>= 3.2) mail (~> 2.5) version_gem (1.1.4) diff --git a/app/builders/account_builder.rb b/app/builders/account_builder.rb index f179c6405..a3a90451d 100644 --- a/app/builders/account_builder.rb +++ b/app/builders/account_builder.rb @@ -33,10 +33,10 @@ class AccountBuilder def validate_email address = ValidEmail2::Address.new(@email) - if address.valid? # && !address.disposable? + if address.valid? && !address.disposable? true else - raise InvalidEmail.new(valid: address.valid?) + raise InvalidEmail.new({ valid: address.valid?, disposable: address.disposable? }) end end