Sha256: 92213a19d15f4d4a727897747ffd48252f6e765b8a1915b287ddbff335dceeeb

Contents?: true

Size: 1.11 KB

Versions: 17

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_path
  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_path)
      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_path
  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

17 entries across 17 versions & 1 rubygems

Version Path
trusty-cms-2.0.28 app/controllers/admin/welcome_controller.rb
trusty-cms-2.0.27 app/controllers/admin/welcome_controller.rb
trusty-cms-2.0.26 app/controllers/admin/welcome_controller.rb
trusty-cms-2.0.25 app/controllers/admin/welcome_controller.rb
trusty-cms-2.0.24 app/controllers/admin/welcome_controller.rb
trusty-cms-2.0.23 app/controllers/admin/welcome_controller.rb
trusty-cms-2.0.22 app/controllers/admin/welcome_controller.rb
trusty-cms-2.0.21 app/controllers/admin/welcome_controller.rb
trusty-cms-2.0.21.alpha app/controllers/admin/welcome_controller.rb
trusty-cms-2.0.20 app/controllers/admin/welcome_controller.rb
trusty-cms-2.0.2 app/controllers/admin/welcome_controller.rb
trusty-cms-2.0.19 app/controllers/admin/welcome_controller.rb
trusty-cms-2.0.18 app/controllers/admin/welcome_controller.rb
trusty-cms-2.0.17 app/controllers/admin/welcome_controller.rb
trusty-cms-2.0.16 app/controllers/admin/welcome_controller.rb
trusty-cms-2.0.15 app/controllers/admin/welcome_controller.rb
trusty-cms-2.0.14 app/controllers/admin/welcome_controller.rb