diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index ecf5dcf4ae..cc42075ccf 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -49,16 +49,17 @@ def store_location end def after_sign_in_path_for(resource) - if from_external_domain? || request.referer.eql?(new_user_session_url(:protocol => 'https')) || request.referer.eql?(new_user_registration_url(:protocol => 'https')) + referer_path = URI(request.referer).path unless request.referer.nil? or nil + if from_external_domain? || referer_path.eql?(new_user_session_path) || referer_path.eql?(new_user_registration_path) || referer_path.nil? root_path else - return request.referer unless request.referer.nil? - root_path + request.referer end end def after_sign_up_path_for(resource) - if from_external_domain? or request.referer.eql?(new_user_session_url(:protocol => 'https')) + referer_path = URI(request.referer).path unless request.referer.nil? or nil + if from_external_domain? || referer_path.eql?(new_user_session_path) || referer_path.nil? root_path else request.referer @@ -85,11 +86,11 @@ def failed_create_error(obj, obj_name) def failed_update_error(obj, obj_name) "#{_('Could not update your %{o}.') % {o: obj_name}} #{errors_to_s(obj)}" end - + def failed_destroy_error(obj, obj_name) "#{_('Could not delete the %{o}.') % {o: obj_name}} #{errors_to_s(obj)}" end - + def success_message(obj_name, action) "#{_('Successfully %{action} your %{object}.') % {object: obj_name, action: action}}" end @@ -108,7 +109,7 @@ def is_json_array_of_objects?(string) private # Override rails default render action to look for a branded version of a - # template instead of using the default one. If no override exists, the + # template instead of using the default one. If no override exists, the # default version in ./app/views/[:controller]/[:action] will be used # # The path in the app/views/branded/ directory must match the the file it is @@ -117,7 +118,7 @@ def is_json_array_of_objects?(string) def prepend_view_paths prepend_view_path "app/views/branded" end - + def errors_to_s(obj) if obj.errors.count > 0 msg = "
" @@ -126,7 +127,7 @@ def errors_to_s(obj) msg += "#{_(e)} - #{_(m)}
" else msg += "'#{obj[e]}' - #{_(m)}
" - end + end end msg end diff --git a/app/views/shared/_access_controls.html.erb b/app/views/shared/_access_controls.html.erb index 7ab3e50465..a1ebef53f7 100644 --- a/app/views/shared/_access_controls.html.erb +++ b/app/views/shared/_access_controls.html.erb @@ -5,11 +5,13 @@ <%= _('Sign in') %> -
  • - - <%= _('Create account') %> - -
  • + <% unless isActivePage(new_user_registration_path, true) %> +
  • + + <%= _('Create account') %> + +
  • + <% end %>
    @@ -18,14 +20,16 @@
    <%= render :partial => 'shared/sign_in_form' %>
    -
    + -
    -
    -
    - <%= render :partial => 'shared/create_account_form', locals: {extended: false} %> + <% unless isActivePage(new_user_registration_path, true) %> +
    +
    +
    + <%= render :partial => 'shared/create_account_form', locals: {extended: false} %> +
    -
    + <% end %>
    -
    \ No newline at end of file +