Sha256: 30b5e6b65ab8bdbc2926d292fa5c9b8d62ba6c32c7998564c7d9effd31b1c505

Contents?: true

Size: 1.26 KB

Versions: 5

Compression:

Stored size: 1.26 KB

Contents

class UserSessionsController < ApplicationController

  def new
    puts "Trying new user session"
    redirect_to(cas_login_url) unless returning_from_cas?
  end


  # POST /user_sessions
  # POST /user_sessions.json
  def create
    @user_session = UserSession.new(params[:user_session])

    respond_to do |format|
      if @user_session.save
        format.html { redirect_to root_path, notice: 'User session was successfully created.' }
        format.json { render json: @user_session, status: :created, location: @user_session }
      else
        format.html { render action: "new" }
        format.json { render json: @user_session.errors, status: :unprocessable_entity }
      end
    end
  end


  def destroy
    @user_session = UserSession.find
    @user_session.destroy

    respond_to do |format|
      format.html { redirect_to root_url }
      format.json { head :ok }
    end
  end


  protected
  def returning_from_cas?
    params[:ticket] || request.referer =~ /^#{::Authlogic::Cas.cas_client.cas_base_url}/
  end


  def cas_login_url
    login_url = ::Authlogic::Cas.cas_client.add_service_to_login_url(users_service_url)
    redirect_url = ""# "&redirect=#{cas_return_to_url}"
    return "#{login_url}#{redirect_url}"
  end
  helper_method :cas_login_url
  
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
authlogic_cloudfuji-0.9.4 spec/scenario/app/controllers/user_sessions_controller.rb
authlogic_cloudfuji-0.9.3 spec/scenario/app/controllers/user_sessions_controller.rb
authlogic_bushido-0.9.2 spec/scenario/app/controllers/user_sessions_controller.rb
authlogic_bushido-0.9.1 spec/scenario/app/controllers/user_sessions_controller.rb
authlogic_bushido-0.9 spec/scenario/app/controllers/user_sessions_controller.rb