Files
openfoodnetwork/app/controllers/registration_controller.rb
Luis Ramos e52937c113 Use rubocop auto correct to add frozen string literal to all files
This is an unsafe auto corection, we will need to trust our build here
2021-06-17 23:07:26 +01:00

28 lines
643 B
Ruby

# frozen_string_literal: true
require 'open_food_network/spree_api_key_loader'
class RegistrationController < BaseController
include OpenFoodNetwork::SpreeApiKeyLoader
layout 'registration'
helper 'map'
before_action :load_spree_api_key, only: [:index]
before_action :check_user, except: :authenticate
def index
@enterprise_attributes = { sells: 'none' }
end
private
def check_user
if spree_current_user.nil?
redirect_to registration_auth_path(anchor: "signup?after_login=#{request.env['PATH_INFO']}")
elsif !spree_current_user.can_own_more_enterprises?
render :limit_reached
end
end
end