Rails & restful_authentication горе с Internet Explorer (все версии) - PullRequest
1 голос
/ 12 мая 2009

У меня развернуто приложение rails, которое отлично работает в Safari, Firefox и Opera. Однако когда я пытаюсь войти в систему из Internet Explorer 6+, я попадаю на правильную страницу, но ничего не появляется Источник говорит, что все есть, но страница просто пуста. Когда я нажимаю обновить все работает нормально. Кто-нибудь имеет опыт работы с этим?


Соответствующий код:

## контроллер приложения

# Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.

class ApplicationController < ActionController::Base
  helper :all # include all helpers, all the time 
  layout 'public'
  before_filter :presenter

  include AuthenticatedSystem
  # See ActionController::RequestForgeryProtection for details
  # Uncomment the :secret if you're not using the cookie session store
  protect_from_forgery  :secret => 'secrete code'

  # See ActionController::Base for details 
  # Uncomment this to filter the contents of submitted sensitive data parameters
  # from your application log (in this case, all fields with names like "password"). 
  # filter_parameter_logging :password

  def index
  end

  def terms
  end


  def contact
    @contact = Contact.new
  end

  def send_contact_request
    @contact = Contact.new(params['contact'])

    if @contact.save
     begin
        UserMailer.deliver_contact_message(@contact)
        flash[:notice] = @presenter.notify("notification", "Success!", "Your message has been delivered.")
        redirect_to root_path
     rescue
        flash[:notice] = @presenter.notify("error", "Error!", "There was an error delivering your request.")
        render :action=>"contact"
    end
    else
      render :action=>"contact"
    end
  end

  def schedule
    @schedule = Schedule.new
  end

  def schedule_testing
    @schedule = Schedule.new(params['schedule'])

    if @schedule.save && @schedule.agreed?
        UserMailer.deliver_testing_request(@schedule)
        flash[:notice] = @presenter.notify("notification", "Success!", "Your request has been delivered.")
        redirect_to root_path
    else
      flash[:notice] = @presenter.notify("error", "Error!", "There was an error delivering your request.")
      render :action => "schedule"
    end
  end

  protected
    def presenter 
      @presenter = AdminPresenter.new(:param => current_user)
    end
end

## контроллер сессий

# This controller handles the login/logout function of the site.  
class SessionsController < ApplicationController

  # Be sure to include AuthenticationSystem in Application Controller instead
  include AuthenticatedSystem

  layout 'public'

  before_filter :presenter

  # render new.rhtml
  def new
  end

  def create
    logout_keeping_session!
    user = User.authenticate(params[:email], params[:password])
    if user
      # Protects against session fixation attacks, causes request forgery
      # protection if user resubmits an earlier form using back
      # button. Uncomment if you understand the tradeoffs.
      # reset_session
      self.current_user = user
      new_cookie_flag = (params[:remember_me] == "1")
      handle_remember_cookie! new_cookie_flag
      if user.password_changed?    
        redirect_back_or_default(admin_index_path)
        flash[:notice] = @presenter.notify("notification", "Welcome!", "Logged in successfully.")
      else
        redirect_to edit_admin_user_path(user)        
        flash[:notice] = @presenter.notify("warning", "Welcome!", "Please change your password to something more memorable.")
      end
    else
      note_failed_signin
      @email       = params[:email]
      @remember_me = params[:remember_me]
      render :action => 'new'
    end
  end

  def destroy
    logout_killing_session!
    redirect_to admin_index_path
    flash.now[:notice] = @presenter.notify("notification", "Success!", "You have been logged out.")
  end

protected
  # Track failed login attempts
  def note_failed_signin
    @email = params[:email]
    flash[:notice] = @presenter.notify("error", "Error!", "Could not log you in as #{@email}.")
    logger.warn "Failed login for '#{params[:email]}' from #{request.remote_ip} at #{Time.now.utc}"
  end

    def presenter
      @presenter = AdminPresenter.new(:param => @map)
    end
end

## регистрация ответа для IE

Processing SessionsController#create (for IP ADDY at 2009-05-12 14:44:57) [POST]
  Session ID: fccb95ca6fd7a7730b7a585f1c8457a3
  Parameters: {"commit"=>"Log in", "authenticity_token"=>"8a05db56dbd6e7116fb82e4f3fdb77df75383ede", "password"=>"secret", "email"=>"secret@secret.com"}
Cookie set: auth_token=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT
  [4;36;1mUser Load (0.1ms)[0m   [0;1mSELECT * FROM `users` WHERE (email = 'zkwentz@gmail.com' and activated_at IS NOT NULL) LIMIT 1[0m
  [4;35;1mSQL (0.0ms)[0m   [0mBEGIN[0m
  [4;36;1mSQL (0.0ms)[0m   [0;1mCOMMIT[0m
Cookie set: auth_token=; path=/
Redirected to /admin
Completed in 1ms (DB: 0) | 302 Found [http://www.gessnerengineering.com/session]


Processing AdminController#index (for IP ADDY at 2009-05-12 14:44:57) [GET]
  Session ID: fccb95ca6fd7a7730b7a585f1c8457a3
  [4;35;1mUser Load (0.0ms)[0m   [0mSELECT * FROM `users` WHERE (`users`.`id` = 12) LIMIT 1[0m
  [4;36;1mProfile Load (0.0ms)[0m   [0;1mSELECT * FROM `profiles` WHERE (approved = 0) [0m
  [4;35;1mProject Load (0.0ms)[0m   [0mSELECT * FROM `projects` WHERE (approved = 0) [0m
  [4;36;1mMap Load (0.0ms)[0m   [0;1mSELECT * FROM `maps` WHERE (approved = 0) [0m
  [4;35;1mProfile Load (0.0ms)[0m   [0mSELECT * FROM `profiles` WHERE (score_approved = 0) [0m
Rendering template within layouts/admin
Rendering admin/index
  [4;36;1mProfile Load (0.0ms)[0m   [0;1mSELECT * FROM `profiles` WHERE (`profiles`.user_id = 12) LIMIT 1[0m
  [4;35;1mRole Load (0.0ms)[0m   [0mSELECT * FROM `roles` WHERE (`roles`.`id` = 1) [0m
Rendered admin/users/_user_bar (0.1ms)
  [4;36;1mCACHE (0.0ms)[0m   [0;1mSELECT * FROM `roles` WHERE (`roles`.`id` = 1) [0m
Completed in 3ms (View: 2, DB: 3) | 200 OK [http://www.gessnerengineering.com/admin]

## журнал ответов для Firefox

Processing SessionsController#create (for IP ADDY at 2009-05-12 14:46:57) [POST]
  Session ID: 163aa367284e7734a17c545fcf85bc95
  Parameters: {"commit"=>"Log in", "authenticity_token"=>"bc549a7f2ae4a937044db12e283c1af13e045b50", "password"=>"secret", "email"=>"secret@secret.com"}
Cookie set: auth_token=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT
  [4;35;1mUser Load (0.1ms)[0m   [0mSELECT * FROM `users` WHERE (email = 'zkwentz@gmail.com' and activated_at IS NOT NULL) LIMIT 1[0m
  [4;36;1mSQL (0.0ms)[0m   [0;1mBEGIN[0m
  [4;35;1mSQL (0.0ms)[0m   [0mCOMMIT[0m
Cookie set: auth_token=; path=/
Redirected to /admin
Completed in 2ms (DB: 0) | 302 Found [http://www.gessnerengineering.com/session]


Processing AdminController#index (for IP ADDY at 2009-05-12 14:46:57) [GET]
  Session ID: 163aa367284e7734a17c545fcf85bc95
  [4;36;1mUser Load (0.1ms)[0m   [0;1mSELECT * FROM `users` WHERE (`users`.`id` = 12) LIMIT 1[0m
  [4;35;1mProfile Load (0.0ms)[0m   [0mSELECT * FROM `profiles` WHERE (approved = 0) [0m
  [4;36;1mProject Load (0.0ms)[0m   [0;1mSELECT * FROM `projects` WHERE (approved = 0) [0m
  [4;35;1mMap Load (0.0ms)[0m   [0mSELECT * FROM `maps` WHERE (approved = 0) [0m
  [4;36;1mProfile Load (0.0ms)[0m   [0;1mSELECT * FROM `profiles` WHERE (score_approved = 0) [0m
Rendering template within layouts/admin
Rendering admin/index
  [4;35;1mProfile Load (0.0ms)[0m   [0mSELECT * FROM `profiles` WHERE (`profiles`.user_id = 12) LIMIT 1[0m
  [4;36;1mRole Load (0.0ms)[0m   [0;1mSELECT * FROM `roles` WHERE (`roles`.`id` = 1) [0m
Rendered admin/users/_user_bar (0.1ms)
  [4;35;1mCACHE (0.0ms)[0m   [0mSELECT * FROM `roles` WHERE (`roles`.`id` = 1) [0m
Completed in 4ms (View: 2, DB: 3) | 200 OK [http://www.gessnerengineering.com/admin]

1 Ответ

1 голос
/ 12 мая 2009

Попробуйте проверить свою разметку (HTML), используя что-то вроде W3 Schools Validator . IE (на удивление) иногда более строг с разметкой, а иногда, если он не может «разобраться», он бомбит и не отображает элементы. Валидатор иногда может отследить незамкнутые теги и т. П.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...