Sha256: 4a6b452cc1e79d30677e35a0839c198c71aa816b67a50bd6b6c2a8b4553cadcc

Contents?: true

Size: 784 Bytes

Versions: 10

Compression:

Stored size: 784 Bytes

Contents

class SessionsController < ApplicationController
  layout 'login'

  before_filter :redirect?, :only => [:new, :create]
  before_filter :redirect_to_new, :only => [:index, :show]

  def new
    @session = UserSession.new
  end

  def create
    if (@session = UserSession.create(params[:session])).valid?
      flash[:notice] = t('sessions.login_successful') if refinery_user?
      redirect_back_or_default(admin_root_url)
    else
      render :action => 'new'
    end
  end

  def destroy
    current_user_session.destroy if logged_in?

    redirect_to(root_url)
  end

protected

  def redirect?
    if refinery_user?
      redirect_to admin_root_url
    elsif logged_in?
      redirect_to root_url
    end
  end

  def redirect_to_new
    redirect_to :action => "new"
  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
refinerycms-0.9.8.9 vendor/refinerycms/authentication/app/controllers/sessions_controller.rb
refinerycms-0.9.8.8 vendor/refinerycms/authentication/app/controllers/sessions_controller.rb
refinerycms-0.9.8.7 vendor/refinerycms/authentication/app/controllers/sessions_controller.rb
refinerycms-0.9.8.6 vendor/refinerycms/authentication/app/controllers/sessions_controller.rb
refinerycms-0.9.8.5 vendor/refinerycms/authentication/app/controllers/sessions_controller.rb
refinerycms-0.9.8.4 vendor/refinerycms/authentication/app/controllers/sessions_controller.rb
refinerycms-0.9.8.3 vendor/refinerycms/authentication/app/controllers/sessions_controller.rb
refinerycms-0.9.8.2 vendor/refinerycms/authentication/app/controllers/sessions_controller.rb
refinerycms-0.9.8.1 vendor/refinerycms/authentication/app/controllers/sessions_controller.rb
refinerycms-0.9.8 vendor/refinerycms/authentication/app/controllers/sessions_controller.rb