Sha256: e6232e9f96324be68604719b53f147b5e88f1b3ebb13319da0f09fc5953efe47

Contents?: true

Size: 443 Bytes

Versions: 10

Compression:

Stored size: 443 Bytes

Contents

class SessionsController < ApplicationController
  def new
  end

  def create
    user = User.authenticate(params[:username], params[:password])

    if user
      session[:user_id] = user.id
      redirect_to root_url, notice: "Logged in!"
    else
      flash.now[:error] = "Invalid username or password."
      render "new"
    end
  end

  def destroy
    session[:user_id] = nil
    redirect_to root_url, notice: "Logged out!"
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
neutral-0.0.10 spec/dummy/app/controllers/sessions_controller.rb
neutral-0.0.9 spec/dummy/app/controllers/sessions_controller.rb
neutral-0.0.8 spec/dummy/app/controllers/sessions_controller.rb
neutral-0.0.7 spec/dummy/app/controllers/sessions_controller.rb
neutral-0.0.6 spec/dummy/app/controllers/sessions_controller.rb
neutral-0.0.5 spec/dummy/app/controllers/sessions_controller.rb
neutral-0.0.4 spec/dummy/app/controllers/sessions_controller.rb
neutral-0.0.3 spec/dummy/app/controllers/sessions_controller.rb
neutral-0.0.2 spec/dummy/app/controllers/sessions_controller.rb
neutral-0.0.1 spec/dummy/app/controllers/sessions_controller.rb