Mirrors the existing client-side check in the v3 signup form (company-email-validator via Vuelidate) so non-business emails can no longer slip in via Google OAuth, direct API calls, or any other path that bypassed the form. The deny list ships as config/deny_listed_email_domains.yml — picked up automatically by ValidEmail2 — and is trimmed to the 6.5k consumer-only domains the gem's disposable list doesn't already cover.
48 lines
1.1 KiB
Ruby
48 lines
1.1 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
module CustomExceptions::Account
|
|
class InvalidEmail < CustomExceptions::Base
|
|
def message
|
|
if @data[:domain_blocked]
|
|
I18n.t 'errors.signup.blocked_domain'
|
|
elsif @data[:disposable]
|
|
I18n.t 'errors.signup.disposable_email'
|
|
elsif @data[:free_email_provider]
|
|
I18n.t 'errors.signup.free_email_provider'
|
|
elsif !@data[:valid]
|
|
I18n.t 'errors.signup.invalid_email'
|
|
end
|
|
end
|
|
end
|
|
|
|
class UserExists < CustomExceptions::Base
|
|
def message
|
|
I18n.t('errors.signup.email_already_exists', email: @data[:email])
|
|
end
|
|
end
|
|
|
|
class InvalidParams < CustomExceptions::Base
|
|
def message
|
|
I18n.t 'errors.signup.invalid_params'
|
|
end
|
|
end
|
|
|
|
class UserErrors < CustomExceptions::Base
|
|
def message
|
|
@data[:errors].full_messages.join(',')
|
|
end
|
|
end
|
|
|
|
class SignupFailed < CustomExceptions::Base
|
|
def message
|
|
I18n.t 'errors.signup.failed'
|
|
end
|
|
end
|
|
|
|
class PlanUpgradeRequired < CustomExceptions::Base
|
|
def message
|
|
I18n.t 'errors.plan_upgrade_required.failed'
|
|
end
|
|
end
|
|
end
|