Redirect to registration edit page when user is already registered

This commit is contained in:
chrisbr 2015-04-09 10:19:32 +02:00
parent 3bd82039ad
commit 6f64602d85

View file

@ -5,9 +5,14 @@ class ConferenceRegistrationsController < ApplicationController
before_action :set_registration, only: [:edit, :update, :destroy, :show]
def new
# Redirect to registration edit when user is already registered
if @conference.user_registered?(current_user)
redirect_to edit_conference_conference_registrations_path(@conference.short_title)
return
# ichain does not allow us to create users during registration
if CONFIG['authentication']['ichain']['enabled'] && !current_user
elsif CONFIG['authentication']['ichain']['enabled'] && !current_user
redirect_to root_path, alert: 'You need to sign in or sign up before continuing.'
return
end
@registration = Registration.new
@registration.build_user