diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index fca129ac..df6bedff 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -44,7 +44,9 @@ class ApplicationController < ActionController::Base rescue_from CanCan::AccessDenied do |exception| Rails.logger.debug "Access denied on #{exception.action} #{exception.subject.inspect}" - redirect_to root_path, alert: exception.message + message = exception.message + message << ' Maybe you need to sign in?' if !current_user + redirect_to root_path, alert: message end rescue_from IChainRecordNotFound do diff --git a/app/models/ability.rb b/app/models/ability.rb index 4a1abe99..0f89057e 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -49,12 +49,13 @@ class Ability # can view Commercials of confirmed Events can :show, Commercial, commercialable_type: 'Event', commercialable_id: Event.where(state: 'confirmed').pluck(:id) can :show, User - can [:show, :create], Registration do |registration| - registration.new_record? - end - - can [:show, :create], Event do |event| - event.new_record? + unless CONFIG['authentication']['ichain']['enabled'] + can [:show, :create], Registration do |registration| + registration.new_record? + end + can [:show, :create], Event do |event| + event.new_record? + end end end diff --git a/app/views/conference_registrations/_form.html.haml b/app/views/conference_registrations/_form.html.haml index ef619583..073eae1d 100644 --- a/app/views/conference_registrations/_form.html.haml +++ b/app/views/conference_registrations/_form.html.haml @@ -30,11 +30,13 @@ = f.inputs 'Your Travel Info' do = f.input :arrival, as: :string, label: 'Your arrival time', input_html: { value: (f.object.arrival.to_formatted_s(:db_without_seconds) unless f.object.arrival.nil?), id: 'registration-arrival-datepicker', readonly: 'readonly' } = f.input :departure, as: :string, label: 'Your departure time', input_html: { value: (f.object.departure.to_formatted_s(:db_without_seconds) unless f.object.departure.nil?), id: 'registration-departure-datepicker', readonly: 'readonly' } - %p.pull-right - - if @conference.user_registered?(current_user) - = f.action :submit, button_html: { value: 'Update Registration', class: 'btn btn-primary' } - - else - = f.action :submit, button_html: { value: 'Register', class: 'btn btn-primary', id: 'register' } + .row + .col-md-12 + %p.pull-right + - if @conference.user_registered?(current_user) + = f.action :submit, button_html: { value: 'Update Registration', class: 'btn btn-primary' } + - else + =f.action :submit, button_html: { value: 'Register', class: 'btn btn-primary', id: 'register' } .tab-pane{role: 'tabpanel', id: 'signin'} - if !CONFIG['authentication']['ichain']['enabled'] = form_tag(new_user_session_path, class: 'form-horizontal') do diff --git a/app/views/layouts/_navigation.html.haml b/app/views/layouts/_navigation.html.haml index 0e908e95..ff0a5698 100644 --- a/app/views/layouts/_navigation.html.haml +++ b/app/views/layouts/_navigation.html.haml @@ -41,7 +41,7 @@ %span.fa.fa-user Sign In %span.caret - .dropdown-menu{:style => "padding: 17px;"} + .dropdown-menu{:style => "padding: 17px; min-width: 225px;"} - if CONFIG['authentication']['ichain']['enabled'] = form_tag User.ichain_login_url do = text_field_tag 'username', nil, id: 'user_ichain_email_dd', placeholder: 'Username' diff --git a/config/environments/development.rb b/config/environments/development.rb index c66c56f0..8167887f 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -85,4 +85,12 @@ Osem::Application.configure do } ) + + config.after_initialize do + Devise.setup do |devise_config| + # Enable ichain test mode + devise_config.ichain_test_mode = true + end + end + end