diff --git a/.travis.yml b/.travis.yml index bc14e2d..50299bc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,9 @@ - cp config/initializers/devise.rb.example config/initializers/devise.rb - cp config/initializers/recaptcha.rb.example config/initializers/recaptcha.rb - cp config/initializers/wicked_pdf.rb.example config/initializers/wicked_pdf.rb - - bundle exec rake db:migrate RAILS_ENV=test + - bundle exec rake db:drop RAILS_ENV=test + - bundle exec rake db:create RAILS_ENV=test + - bundle exec rake db:schema:load RAILS_ENV=test script: - bundle exec rake test diff --git a/Gemfile.lock b/Gemfile.lock index d430a3c..f0dc2f1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -131,6 +131,7 @@ multipart-post (>= 1.2, < 3) faraday_middleware (0.10.0) faraday (>= 0.7.4, < 0.10) + fast_gettext (1.3.0) feedjira (2.0.0) faraday (~> 0.9) faraday_middleware (~> 0.9) @@ -142,6 +143,8 @@ formtastic_i18n (0.6.0) friendly_id (5.1.0) activerecord (>= 4.0.0) + gettext_i18n_rails (1.8.0) + fast_gettext (>= 0.9.0) globalid (0.3.7) activesupport (>= 4.1.0) has_scope (0.6.0) @@ -370,6 +373,7 @@ feedjira flag_shih_tzu friendly_id + gettext_i18n_rails (~> 1.8) htmltoword i18n-js (>= 3.0.0.rc11) jbuilder diff --git a/app/controllers/orgs_controller.rb b/app/controllers/orgs_controller.rb index 905fd06..4b796cc 100644 --- a/app/controllers/orgs_controller.rb +++ b/app/controllers/orgs_controller.rb @@ -32,7 +32,12 @@ if @org.update_attributes(assign_params) redirect_to admin_show_org_path(params[:id]), notice: I18n.t("admin.org_updated_message") else - flash[:notice] = @org.errors.collect{|e| e.message}.join('
').html_safe + # For some reason our custom validator returns as a string and not a hash like normal activerecord + # errors. We followed the example provided in the Rails guides when building the validator so + # its unclear why its doing this. Placing a check here for the data type. We should reasses though + # when doing a broader eval of the look/feel of the site and we come up with a standardized way of + # displaying errors + flash[:notice] = @org.errors.collect{|a, e| "#{a} - #{(e.instance_of?(String) ? e : e.message)}"}.join('
').html_safe render action: "admin_edit" end rescue Dragonfly::Job::Fetch::NotFound => dflye diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 5b98dd2..0a56bd7 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -113,7 +113,6 @@ # POST /projects def create - puts params return if user_signed_in? then @plan = Plan.new(params[:plan]) diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb index a82b679..6f32f1f 100644 --- a/app/controllers/registrations_controller.rb +++ b/app/controllers/registrations_controller.rb @@ -34,7 +34,7 @@ # POST /resource def create - logger.debug "#{sign_up_params}" + #logger.debug "#{sign_up_params}" if sign_up_params[:accept_terms] != "1" then redirect_to after_sign_up_error_path_for(resource), alert: I18n.t('helpers.you_must_accept') else @@ -136,8 +136,8 @@ end def sign_up_params - params.require(:user).permit(:email, :password, :password_confirmation, :accept_terms, - :organisation_id, :other_organisation) + params.require(:user).permit(:email, :password, :password_confirmation, + :accept_terms, :org_id, :other_organisation) end end diff --git a/app/controllers/users/omniauth_callbacks_controller.rb b/app/controllers/users/omniauth_callbacks_controller.rb index 593e146..16c0516 100644 --- a/app/controllers/users/omniauth_callbacks_controller.rb +++ b/app/controllers/users/omniauth_callbacks_controller.rb @@ -64,16 +64,19 @@ redirect_to root_path else auth = request.env['omniauth.auth'] || {} - eppn = auth['extra']['raw_info']['eppn'] + + eppn = auth['extra']['raw_info']['eppn'] unless auth['extra'].nil? uid = nil if !eppn.blank? then uid = eppn elsif !auth['uid'].blank? then uid = auth['uid'] - elsif !auth['extra']['raw_info']['targeted-id'].blank? then - uid = auth['extra']['raw_info']['targeted-id'] + elsif !auth['extra'].nil? + if !auth['extra']['raw_info']['targeted-id'].blank? then + uid = auth['extra']['raw_info']['targeted-id'] + end end - + if !uid.nil? && !uid.blank? then s_user = User.where(shibboleth_id: uid).first # Take out previous record if was not confirmed. @@ -95,6 +98,8 @@ sign_out current_user session.delete(:shibboleth_data) s_user = User.find(user_id) + flash[:notice] = I18n.t('devise.omniauth_callbacks.success', :kind => 'Shibboleth') + sign_in s_user redirect_to edit_user_registration_path else diff --git a/app/views/layouts/_navigation.html.erb b/app/views/layouts/_navigation.html.erb index 5400e0d..b7bd219 100644 --- a/app/views/layouts/_navigation.html.erb +++ b/app/views/layouts/_navigation.html.erb @@ -49,10 +49,6 @@
  • > <%= link_to _('Help'), help_path %>
  • - -
  • > - <%= link_to _('Public DMPs'), public_plans_path %> -