Merge pull request #647 from hennevogel/master
Some more sign in/up & ichain stuff
This commit is contained in:
commit
d3e0066f88
5 changed files with 26 additions and 13 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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'
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue