Commit df84cdf698ec1e0e7db9b1b0609ef9df05276972

Authored by Braulio Bhavamitra
1 parent d3c1bfbb

rails4: make login possible without touching user_data

app/controllers/application_controller.rb
... ... @@ -8,9 +8,7 @@ class ApplicationController < ActionController::Base
8 8 before_filter :init_noosfero_plugins
9 9 before_filter :allow_cross_domain_access
10 10  
11   - # AuthenticatedSystem filters must come before login_from_cookie
12 11 include AuthenticatedSystem
13   - before_filter :login_from_cookie
14 12 before_filter :login_required, :if => :private_environment?
15 13  
16 14 before_filter :verify_members_whitelist, :if => [:private_environment?, :user]
... ...
lib/authenticated_system.rb
... ... @@ -3,8 +3,10 @@ module AuthenticatedSystem
3 3 protected
4 4  
5 5 def self.included base
6   - # See impl. from http://stackoverflow.com/a/2513456/670229
7   - base.around_filter :user_set_current if base.is_a? ActionController::Base
  6 + if base.is_a? ActionController::Base
  7 + base.around_filter :user_set_current
  8 + base.before_filter :login_from_cookie
  9 + end
8 10  
9 11 # Inclusion hook to make #current_user and #logged_in?
10 12 # available as ActionView helper methods.
... ... @@ -40,6 +42,7 @@ module AuthenticatedSystem
40 42 @current_user = User.current = new_user
41 43 end
42 44  
  45 + # See impl. from http://stackoverflow.com/a/2513456/670229
43 46 def user_set_current
44 47 User.current = current_user
45 48 yield
... ...
vendor/plugins/noosfero_caching/init.rb
... ... @@ -27,7 +27,7 @@ module NoosferoHttpCaching
27 27 end
28 28  
29 29 def noosfero_session_check
30   - return if (params[:controller] == 'account' && params[:action] != 'user_data')
  30 + return unless params[:controller] == 'account'
31 31 headers["X-Noosfero-Auth"] = (session[:user] != nil).to_s
32 32 end
33 33  
... ...