Sha256: 3e8fb84c6b47386c3f5442e349a197526e5c87ae63d5bf7b8874929bb9671e4b

Contents?: true

Size: 657 Bytes

Versions: 3

Compression:

Stored size: 657 Bytes

Contents

class SessionsController < ApplicationController
  before_filter :check_authentication, only: :destroy

  def new
    if authenticated?
      flash[:notice] = 'You are already logged in.'
      redirect_to landing_url
    end
  end

  def create
    user = User.authenticate params[:username], params[:password]
    if user
      signin user.username
      flash[:notice] = 'You have been logged in.'
      redirect_to landing_url
    else
      flash.now[:alert] = 'Your username and/or password are incorrect.'
      render :new
    end
  end

  def destroy
    signout
    flash[:notice] = 'You have been logged out.'
    redirect_to login_url
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
dismissible_blocks-1.1.1 test/dummy/app/controllers/sessions_controller.rb
dismissible_blocks-1.1.0 test/dummy/app/controllers/sessions_controller.rb
dismissible_blocks-0.0.2 test/dummy/app/controllers/sessions_controller.rb