Sha256: e90b4ed0c6a5c373eec55a39604b11ede8e03d9fb84221c343416f7f2bd3084c

Contents?: true

Size: 1.11 KB

Versions: 46

Compression:

Stored size: 1.11 KB

Contents

class Admin::WelcomeController < ApplicationController
  no_login_required
  before_filter :never_cache
  skip_before_filter :verify_authenticity_token

  def index
    redirect_to admin_pages_url
  end

  def login
    if request.post?
      @username_or_email = params[:username_or_email]
      password = params[:password]
      announce_invalid_user unless self.current_user = User.authenticate(@username_or_email, password)
    end
    if current_user
      if params[:remember_me]
        current_user.remember_me
        set_session_cookie
      end
      redirect_to(session[:return_to] || welcome_url)
      session[:return_to] = nil
    end
  end

  def logout
    request.cookies[:session_token] = { :expires => 1.day.ago.utc }
    self.current_user.forget_me if self.current_user
    self.current_user = nil
    announce_logged_out
    redirect_to login_url
  end

  private

    def never_cache
      expires_now
    end

    def announce_logged_out
      flash[:notice] = t('welcome_controller.logged_out')
    end

    def announce_invalid_user
      flash.now[:error] = t('welcome_controller.invalid_user')
    end

end

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
trusty-cms-2.0.13 app/controllers/admin/welcome_controller.rb
trusty-cms-2.0.12 app/controllers/admin/welcome_controller.rb
trusty-cms-2.0.11 app/controllers/admin/welcome_controller.rb
trusty-cms-2.0.10.pre.beta app/controllers/admin/welcome_controller.rb
trusty-cms-2.0.9.pre.beta app/controllers/admin/welcome_controller.rb
trusty-cms-2.0.8.pre.beta app/controllers/admin/welcome_controller.rb
trusty-cms-2.0.7.pre.beta app/controllers/admin/welcome_controller.rb
trusty-cms-2.0.5.pre.beta app/controllers/admin/welcome_controller.rb
trusty-cms-2.0.4.pre.beta app/controllers/admin/welcome_controller.rb
trusty-cms-2.0.3.pre.beta app/controllers/admin/welcome_controller.rb
trusty-cms-2.0.2.pre.beta app/controllers/admin/welcome_controller.rb
trusty-cms-2.0.1.pre.beta app/controllers/admin/welcome_controller.rb
trusty-cms-2.0.0.pre.beta app/controllers/admin/welcome_controller.rb
trusty-cms-1.2.29 app/controllers/admin/welcome_controller.rb
trusty-cms-1.2.28 app/controllers/admin/welcome_controller.rb
trusty-cms-1.1.28 app/controllers/admin/welcome_controller.rb
trusty-cms-1.1.27 app/controllers/admin/welcome_controller.rb
trusty-cms-1.1.26 app/controllers/admin/welcome_controller.rb
trusty-cms-1.1.25 app/controllers/admin/welcome_controller.rb
trusty-cms-1.1.24 app/controllers/admin/welcome_controller.rb