You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
543 B
22 lines
543 B
1 year ago
|
# frozen_string_literal: true
|
||
|
|
||
|
module RegistrationHelper
|
||
|
extend ActiveSupport::Concern
|
||
|
|
||
|
def allowed_registration?(remote_ip, invite)
|
||
|
!Rails.configuration.x.single_user_mode && !omniauth_only? && (registrations_open? || invite&.valid_for_use?) && !ip_blocked?(remote_ip)
|
||
|
end
|
||
|
|
||
|
def registrations_open?
|
||
|
Setting.registrations_mode != 'none'
|
||
|
end
|
||
|
|
||
|
def omniauth_only?
|
||
|
ENV['OMNIAUTH_ONLY'] == 'true'
|
||
|
end
|
||
|
|
||
|
def ip_blocked?(remote_ip)
|
||
|
IpBlock.where(severity: :sign_up_block).exists?(['ip >>= ?', remote_ip.to_s])
|
||
|
end
|
||
|
end
|