```ruby
class ApplicationController < ActionController::Base
  protect_from_forgery

  force_ssl if: :ssl_configured?

  before_filter :authenticate_user
  before_filter :ensure_team

  def authenticate_user
    find_user
    redirect_to '/login' unless @current_user
  end

  def find_user
    @current_user = LoginUserFinder.new(session[:user_id]).find
  end

  def current_user
    @current_user
  end
  helper_method :current_user

  def require_staff
    if current_user
      redirect_to "/" unless current_user.staff?
    end
  end

  def ssl_configured?
    !(Rails.env.development? || Rails.env.test?)
  end

  def is_staff?
    current_user.staff?
  end

  def ensure_team
    return true if is_staff?
    if current_user and current_user.team_id.nil?
      redirect_to "/join"
    end
  end

end
```

Fix in the right location
user
```ruby
class ApplicationController < ActionController::Base
  protect_from_forgery

  force_ssl if: :ssl_configured?

  before_filter :authenticate_user
  before_filter :ensure_team

  def authenticate_user
    find_user
    redirect_to '/login' unless @current_user
  end

  def find_user
    @current_user = LoginUserFinder.new(session[:user_id]).find
  end

  def current_user
    @current_user
  end
  helper_method :current_user

  def require_staff
    redirect_to "/" unless current_user.staff?
  end

  def ssl_configured?
    !(Rails.env.development? || Rails.env.test?)
  end

  def is_staff?
    current_user && current_user.staff?
  end

  def ensure_team
    return true if is_staff?
    if current_user and current_user.team_id.nil?
      redirect_to "/join"
    end
  end

end
```
assistant