Fixed 404 and 403 errors
This commit is contained in:
@@ -34,4 +34,18 @@ class AdminController < ApplicationController
|
||||
|
||||
redirect_to conference_url(conference.slug)
|
||||
end
|
||||
|
||||
rescue_from ActiveRecord::PremissionDenied do |exception|
|
||||
if logged_in?
|
||||
redirect_to :register
|
||||
else
|
||||
@register_template = :confirm_email
|
||||
@page_title = "articles.conference_registration.headings.#{@this_conference.registration_status == :open ? '': 'Pre_'}Registration_Details"
|
||||
render :register
|
||||
end
|
||||
end
|
||||
|
||||
rescue_from ActiveRecord::RecordNotFound do |exception|
|
||||
do_404
|
||||
end
|
||||
end
|
||||
|
||||
@@ -77,6 +77,10 @@ class ConferenceAdministrationController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
rescue_from ActiveRecord::RecordNotFound do |exception|
|
||||
do_404
|
||||
end
|
||||
|
||||
private
|
||||
# Administration form pages
|
||||
def administrate_administrators
|
||||
|
||||
@@ -306,8 +306,8 @@ class ConferencesController < ApplicationController
|
||||
|
||||
end
|
||||
|
||||
helper_method :registration_steps
|
||||
helper_method :current_registration_steps
|
||||
# helper_method :registration_steps
|
||||
# helper_method :current_registration_steps
|
||||
helper_method :registration_complete?
|
||||
|
||||
def registration_steps(conference = nil)
|
||||
@@ -360,36 +360,6 @@ class ConferencesController < ApplicationController
|
||||
return true
|
||||
end
|
||||
|
||||
def current_registration_steps(registration = @registration)
|
||||
return nil unless registration.present?
|
||||
|
||||
steps = registration_steps(registration.conference)
|
||||
current_steps = []
|
||||
disable_steps = false
|
||||
completed_steps = registration.steps_completed || []
|
||||
registration_complete = registration_complete?(registration)
|
||||
steps.each do | step |
|
||||
# disable the step if we've already found an incomplete step
|
||||
enabled = !disable_steps || registration_complete
|
||||
# record whether or not we've found an incomplete step
|
||||
disable_steps ||= !completed_steps.include?(step.to_s)
|
||||
|
||||
current_steps << {
|
||||
name: step,
|
||||
enabled: enabled
|
||||
}
|
||||
end
|
||||
return current_steps
|
||||
end
|
||||
|
||||
def current_step(registration = @registration)
|
||||
completed_steps = registration.steps_completed || []
|
||||
(registration_steps(registration.conference) || []).each do | step |
|
||||
return step unless completed_steps.include?(step.to_s)
|
||||
end
|
||||
return registration_steps(registration.conference).last
|
||||
end
|
||||
|
||||
rescue_from ActiveRecord::PremissionDenied do |exception|
|
||||
if logged_in?
|
||||
redirect_to :register
|
||||
@@ -400,6 +370,10 @@ class ConferencesController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
rescue_from ActiveRecord::RecordNotFound do |exception|
|
||||
do_404
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def PayPal!
|
||||
|
||||
@@ -352,4 +352,19 @@ class WorkshopsController < ApplicationController
|
||||
|
||||
return redirect_to view_workshop_url(@this_conference.slug, workshop.id, anchor: "comment-#{new_comment.id}")
|
||||
end
|
||||
|
||||
rescue_from ActiveRecord::PremissionDenied do |exception|
|
||||
if logged_in?
|
||||
redirect_to 'conferences/register'
|
||||
else
|
||||
@register_template = :confirm_email
|
||||
@page_title = "articles.conference_registration.headings.#{@this_conference.registration_status == :open ? '': 'Pre_'}Registration_Details"
|
||||
render 'conferences/register'
|
||||
end
|
||||
end
|
||||
|
||||
rescue_from ActiveRecord::RecordNotFound do |exception|
|
||||
do_404
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user